Created
May 13, 2011 05:54
-
-
Save tmacedo/970049 to your computer and use it in GitHub Desktop.
skype group chat callable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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