use of battleship.listener.ChatRoomOpeningListener in project Spark by igniterealtime.
the class BattleshipPlugin method initialize.
@Override
public void initialize() {
ProviderManager.addIQProvider(GameOfferPacket.ELEMENT_NAME, GameOfferPacket.NAMESPACE, GameOfferPacket.class);
ProviderManager.addExtensionProvider(MovePacket.ELEMENT_NAME, MovePacket.NAMESPACE, MovePacket.class);
ProviderManager.addExtensionProvider(MoveAnswerPacket.ELEMENT_NAME, MoveAnswerPacket.NAMESPACE, MoveAnswerPacket.class);
_gameofferListener = new StanzaListener() {
@Override
public void processPacket(Stanza stanza) {
GameOfferPacket invitation = (GameOfferPacket) stanza;
if (invitation.getType() == IQ.Type.get) {
showInvitationInChat(invitation);
}
}
};
SparkManager.getConnection().addAsyncStanzaListener(_gameofferListener, new StanzaTypeFilter(GameOfferPacket.class));
_chatRoomListener = new ChatRoomOpeningListener();
SparkManager.getChatManager().addChatRoomListener(_chatRoomListener);
}
Aggregations