From a372fba2ac6e91b0c2b98c4c761ede81359fa6c3 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 7 Aug 2013 12:28:46 -0400 Subject: [PATCH] Rename Humbug-based variables/paths in jira plugin. (imported from commit a4596acc5c2d8da5cecad772e9cda5a371189299) --- ...ugListener.groovy => ZulipListener.groovy} | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) rename integrations/jira/org/humbug/jira/{HumbugListener.groovy => ZulipListener.groovy} (88%) diff --git a/integrations/jira/org/humbug/jira/HumbugListener.groovy b/integrations/jira/org/humbug/jira/ZulipListener.groovy similarity index 88% rename from integrations/jira/org/humbug/jira/HumbugListener.groovy rename to integrations/jira/org/humbug/jira/ZulipListener.groovy index 32166cd..e058661 100644 --- a/integrations/jira/org/humbug/jira/HumbugListener.groovy +++ b/integrations/jira/org/humbug/jira/ZulipListener.groovy @@ -2,7 +2,7 @@ * Copyright (c) 2013 Zulip, Inc */ -package org.humbug.jira +package org.zulip.jira import static com.atlassian.jira.event.type.EventType.* @@ -17,21 +17,21 @@ import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.PostMethod import org.apache.commons.httpclient.NameValuePair -class HumbugListener extends AbstractIssueEventListener { - Logger LOGGER = Logger.getLogger(HumbugListener.class.getName()); +class ZulipListener extends AbstractIssueEventListener { + Logger LOGGER = Logger.getLogger(ZulipListener.class.getName()); // The email address of one of the bots you created on your Zulip settings page. - String humbugEmail = "" + String zulipEmail = "" // That bot's API key. - String humbugAPIKey = "" + String zulipAPIKey = "" // What stream to send messages to. Must already exist. - String humbugStream = "jira" + String zulipStream = "jira" // The base JIRA url for browsing String issueBaseUrl = "https://jira.COMPANY.com/browse/" - // Your humbug domain, only change if you have a custom one + // Your zulip domain, only change if you have a custom one String base_url = "https://api.zulip.com" @Override @@ -97,11 +97,11 @@ class HumbugListener extends AbstractIssueEventListener { return } - sendStreamMessage(humbugStream, subject, content) + sendStreamMessage(zulipStream, subject, content) } String post(String method, NameValuePair[] parameters) { - PostMethod post = new PostMethod(humbugUrl(method)) + PostMethod post = new PostMethod(zulipUrl(method)) post.setRequestHeader("Content-Type", post.FORM_URL_ENCODED_CONTENT_TYPE) try { post.setRequestBody(parameters) @@ -132,8 +132,8 @@ class HumbugListener extends AbstractIssueEventListener { } String sendStreamMessage(String stream, String subject, String message) { - NameValuePair[] body = [new NameValuePair("api-key", humbugAPIKey), - new NameValuePair("email", humbugEmail), + NameValuePair[] body = [new NameValuePair("api-key", zulipAPIKey), + new NameValuePair("email", zulipEmail), new NameValuePair("type", "stream"), new NameValuePair("to", stream), new NameValuePair("subject", subject), @@ -141,7 +141,7 @@ class HumbugListener extends AbstractIssueEventListener { return post("send_message", body); } - String humbugUrl(method) { + String zulipUrl(method) { return base_url + "/v1/" + method } }