use of org.jivesoftware.spark.ui.ChatRoomListener in project Spark by igniterealtime.
the class BuzzPlugin method initialize.
public void initialize() {
ProviderManager.addExtensionProvider(ELEMENTNAME, NAMESPACE, new BuzzPacket.Provider());
ProviderManager.addExtensionProvider(ELEMENTNAME_OLD, NAMESPACE_OLD, new BuzzPacket.Provider());
SparkManager.getConnection().addAsyncStanzaListener(stanza -> {
if (stanza instanceof Message) {
final Message message = (Message) stanza;
boolean buzz = message.getExtension(ELEMENTNAME_OLD, NAMESPACE_OLD) != null || message.getExtension(ELEMENTNAME, NAMESPACE) != null;
if (buzz) {
SwingUtilities.invokeLater(() -> shakeWindow(message));
}
}
}, new StanzaTypeFilter(Message.class));
SparkManager.getChatManager().addChatRoomListener(new ChatRoomListener() {
public void chatRoomOpened(final ChatRoom room) {
TimerTask task = new SwingTimerTask() {
public void doRun() {
addBuzzFeatureToChatRoom(room);
}
};
TaskEngine.getInstance().schedule(task, 100);
}
public void chatRoomLeft(ChatRoom room) {
}
public void chatRoomClosed(ChatRoom room) {
}
public void chatRoomActivated(ChatRoom room) {
}
public void userHasJoined(ChatRoom room, String userid) {
}
public void userHasLeft(ChatRoom room, String userid) {
}
});
}
Aggregations