/** Adds listeners for the query */ private void initListeners() { for (ProtocolProviderService pps : MUCActivator.getChatRoomProviders()) { addQueryToProviderPresenceListeners(pps); } mucService.addChatRoomListChangeListener(this); mucService.addChatRoomProviderWrapperListener(this); protolProviderRegistrationListener = new ProtocolProviderRegListener(); MUCActivator.bundleContext.addServiceListener(protolProviderRegistrationListener); }
/** Clears any listener we used. */ private void clearListeners() { mucService.removeChatRoomListChangeListener(this); mucService.removeChatRoomProviderWrapperListener(this); if (protolProviderRegistrationListener != null) MUCActivator.bundleContext.removeServiceListener(protolProviderRegistrationListener); protolProviderRegistrationListener = null; for (ProtocolProviderService pps : MUCActivator.getChatRoomProviders()) { removeQueryFromProviderPresenceListeners(pps); } }