Class ChatStateManager

    • Method Detail

      • getInstance

        public static ChatStateManager getInstance​(XMPPConnection connection)
        Returns the ChatStateManager related to the XMPPConnection and it will create one if it does not yet exist.
        Parameters:
        connection - the connection to return the ChatStateManager
        Returns:
        the ChatStateManager related the the connection.
      • addChatStateListener

        public boolean addChatStateListener​(ChatStateListener listener)
        Register a ChatStateListener. That listener will be informed about changed chat states.
        Parameters:
        listener - chatStateListener
        Returns:
        true, if the listener was not registered before
      • removeChatStateListener

        public boolean removeChatStateListener​(ChatStateListener listener)
        Unregister a ChatStateListener.
        Parameters:
        listener - chatStateListener
        Returns:
        true, if the listener was registered before
      • setCurrentState

        public void setCurrentState​(ChatState newState,
                                    Chat chat)
                             throws SmackException.NotConnectedException,
                                    java.lang.InterruptedException
        Sets the current state of the provided chat. This method will send an empty bodied Message stanza with the state attached as a ExtensionElement, if and only if the new chat state is different than the last state.
        Parameters:
        newState - the new state of the chat
        chat - the chat.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object