Skip to content

Instantly share code, notes, and snippets.

@tmacedo
Created May 11, 2011 14:45
Show Gist options
  • Save tmacedo/966579 to your computer and use it in GitHub Desktop.
Save tmacedo/966579 to your computer and use it in GitHub Desktop.
jenkins skype group chat notification
diff --git a/src/main/java/hudson/plugins/skype/im/transport/SkypeIMConnection.java b/src/main/java/hudson/plugins/skype/im/transport/SkypeIMConnection.java
index 744e4b0..7071069 100644
--- a/src/main/java/hudson/plugins/skype/im/transport/SkypeIMConnection.java
+++ b/src/main/java/hudson/plugins/skype/im/transport/SkypeIMConnection.java
@@ -20,6 +20,7 @@ import hudson.plugins.im.IMPresence;
import hudson.plugins.im.bot.Bot;
import hudson.plugins.im.tools.ExceptionHelper;
import hudson.plugins.skype.im.transport.callables.SkypeChatCallable;
+import hudson.plugins.skype.im.transport.callables.SkypeGroupChatCallable;
import hudson.plugins.skype.im.transport.callables.SkypeSetupCallable;
import hudson.plugins.skype.im.transport.callables.SkypeVerifyUserCallable;
import hudson.remoting.VirtualChannel;
@@ -184,9 +185,20 @@ class SkypeIMConnection extends AbstractIMConnection {
}
try {
if (target instanceof GroupChatIMMessageTarget) {
+ System.out.println("trying to send a group chat im");
} else {
verifyUser(target);
//final ChatMessage chat = skypeServ.chat(target.toString(), text);
+ System.out.println("fake group message stuff");
+ SkypeGroupChatCallable g_callable = new SkypeGroupChatCallable(this.groupChats, text);
+ try {
+ getChannel().call(g_callable);
+ } catch (IOException ex) {
+ throw new SkypeIMException(ex);
+ } catch (InterruptedException ex) {
+ throw new SkypeIMException(ex);
+ }
+ System.out.println("trying to send a personal message");
SkypeChatCallable callable = new SkypeChatCallable(new String[]{target.toString()}, text);
try {
getChannel().call(callable);
diff --git a/src/main/java/hudson/plugins/skype/im/transport/SkypePublisher.java b/src/main/java/hudson/plugins/skype/im/transport/SkypePublisher.java
index 33a29a1..4ae7504 100644
--- a/src/main/java/hudson/plugins/skype/im/transport/SkypePublisher.java
+++ b/src/main/java/hudson/plugins/skype/im/transport/SkypePublisher.java
@@ -35,6 +35,7 @@ public class SkypePublisher extends IMPublisher {
@Override
public IMMessageTarget fromString(final String targetAsString) throws IMMessageTargetConversionException {
String f = targetAsString.trim();
+ System.out.println("fromString:" + f);
if (f.length() > 0) {
IMMessageTarget target;
if (f.startsWith("*")) {
@@ -105,10 +106,12 @@ public class SkypePublisher extends IMPublisher {
@Override
public String getTargets() {
+ System.out.println("getTargets()");
List<IMMessageTarget> notificationTargets = getNotificationTargets();
StringBuilder sb = new StringBuilder();
for (IMMessageTarget target : notificationTargets) {
+ System.out.println("target:" + target.toString());
if ((target instanceof GroupChatIMMessageTarget) && (!target.toString().contains("@conference."))) {
sb.append("*");
}
diff --git a/src/main/java/hudson/plugins/skype/im/transport/SkypePublisherDescriptor.java b/src/main/java/hudson/plugins/skype/im/transport/SkypePublisherDescriptor.java
index 7967a9e..c3dafba 100644
--- a/src/main/java/hudson/plugins/skype/im/transport/SkypePublisherDescriptor.java
+++ b/src/main/java/hudson/plugins/skype/im/transport/SkypePublisherDescriptor.java
@@ -259,11 +259,13 @@ public class SkypePublisherDescriptor extends BuildStepDescriptor<Publisher> imp
return this.commandPrefix;
}
+
/**
* Creates a new instance of {@link SkypePublisher} from a submitted form.
*/
@Override
public SkypePublisher newInstance(final StaplerRequest req, JSONObject formData) throws FormException {
+ System.out.println("SkypePublisher newInstance");
Assert.notNull(req, "Parameter 'req' must not be null.");
final String t = req.getParameter(SkypePublisherDescriptor.PARAMETERNAME_TARGETS);
final String[] split;
diff --git a/src/main/java/hudson/plugins/skype/im/transport/callables/SkypeChatCallable.java b/src/main/java/hudson/plugins/skype/im/transport/callables/SkypeChatCallable.java
index d31b7c0..38b6b54 100644
--- a/src/main/java/hudson/plugins/skype/im/transport/callables/SkypeChatCallable.java
+++ b/src/main/java/hudson/plugins/skype/im/transport/callables/SkypeChatCallable.java
@@ -35,5 +35,4 @@ public class SkypeChatCallable implements Callable<ChatMessage, SkypeIMException
throw new SkypeIMException(ex);
}
}
-
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment