public void processBye(RequestEvent requestEvent, ServerTransaction serverTransaction) { try { logger.debug("DEBUG: IMByeProcessing, Processing BYE in progress..."); Request request = requestEvent.getRequest(); MessageFactory messageFactory = imUA.getMessageFactory(); InstantMessagingGUI instantMessagingGUI = imUA.getInstantMessagingGUI(); ListenerInstantMessaging listenerInstantMessaging = instantMessagingGUI.getListenerInstantMessaging(); ChatSessionManager chatSessionManager = listenerInstantMessaging.getChatSessionManager(); String buddy = IMUtilities.getKey(request, "From"); if (chatSessionManager.hasAlreadyChatSession(buddy)) { chatSessionManager.removeChatSession(buddy); // chatSession.setExitedSession(true,"Your contact has exited // the session"); } else { logger.debug("DEBUG: IMByeProcessing, processBye(), no active chatSession"); } // Send an OK Response response = messageFactory.createResponse(Response.OK, request); serverTransaction.sendResponse(response); logger.debug("DEBUG: IMByeProcessing, processBye(), OK replied to the BYE"); logger.debug("DEBUG: IMByeProcessing, Processing BYE completed..."); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Removes the user interface related to the given protocol provider. * * @param protocolProvider the protocol provider to remove */ public void removeProtocolProviderUI(ProtocolProviderService protocolProvider) { OperationSetBasicTelephony<?> telOpSet = protocolProvider.getOperationSet(OperationSetBasicTelephony.class); if (telOpSet != null) { telOpSet.removeCallListener(androidCallListener); } OperationSetPresence presenceOpSet = protocolProvider.getOperationSet(OperationSetPresence.class); if (presenceOpSet != null) { presenceOpSet.removeProviderPresenceStatusListener(androidPresenceListener); } // Removes all chat session for unregistered provider ChatSessionManager.removeAllChatsForProvider(protocolProvider); }
/** * Removes the registration of a <tt>NewChatListener</tt>. * * @param listener listener to be unregistered */ public void removeChatListener(ChatListener listener) { ChatSessionManager.removeChatListener(listener); }
/** * Registers a <tt>NewChatListener</tt> to be informed when new <tt>Chats</tt> are created. * * @param listener listener to be registered */ public void addChatListener(ChatListener listener) { ChatSessionManager.addChatListener(listener); }
/** * Provides all currently instantiated <tt>Chats</tt>. * * @return all active <tt>Chats</tt>. */ public Collection<Chat> getAllChats() { return ChatSessionManager.getActiveChats(); }
/** * Returns the selected <tt>Chat</tt>. * * @return the selected <tt>Chat</tt>. */ public Chat getCurrentChat() { return ChatSessionManager.getCurrentChatSession(); }
/** * Returns a list of all open Chats * * @return A list of all open Chats */ public List<Chat> getChats() { return ChatSessionManager.getActiveChats(); }
/** * Returns the <tt>Chat</tt> corresponding to the given <tt>Contact</tt>. * * @param contact the <tt>Contact</tt> for which the searched chat is about. * @return the <tt>Chat</tt> corresponding to the given <tt>Contact</tt>. */ public Chat getChat(Contact contact) { return ChatSessionManager.findChatForContact(contact, true); }