Skip to content

Instantly share code, notes, and snippets.

@tmacedo
Created May 13, 2011 05:54
Show Gist options
  • Save tmacedo/970049 to your computer and use it in GitHub Desktop.
Save tmacedo/970049 to your computer and use it in GitHub Desktop.
skype group chat callable
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hudson.plugins.skype.im.transport.callables;
import com.skype.Chat;
import com.skype.ChatMessage;
import com.skype.SkypeException;
import com.skype.SkypeImpl;
import hudson.plugins.skype.im.transport.SkypeIMException;
import hudson.remoting.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author jbh
*/
public class SkypeGroupChatCallable implements Callable<ChatMessage, SkypeIMException> {
private String[] groupChatIds = null;
private String message = null;
public SkypeGroupChatCallable(String[] ids, String msg) {
this.groupChatIds = ids;
this.message = msg;
}
public ChatMessage call() throws SkypeIMException {
try {
Chat[] all_chats = SkypeImpl.getAllChats();
for (Chat chat : all_chats) {
for (String id : groupChatIds) {
System.out.println("trying to send message to: "+ id);
if (chat.getId().equals(id)) {
chat.send(message);
}
else{
System.out.println("non matching chat: " +chat.getId());
}
}
System.out.println("Chat id: "+ chat.getId());
}
return null;
} catch (SkypeException ex) {
throw new SkypeIMException(ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment