Class Chat


  • @Deprecated
    public class Chat
    extends java.lang.Object
    Deprecated.
    use org.jivesoftware.smack.chat2.Chat from smack-extensions instead.
    A chat is a series of messages sent between two users. Each chat has a unique thread ID, which is used to track which messages are part of a particular conversation. Some messages are sent without a thread ID, and some clients don't send thread IDs at all. Therefore, if a message without a thread ID arrives it is routed to the most recently created Chat with the message sender.
    • Method Detail

      • getThreadID

        public java.lang.String getThreadID()
        Deprecated.
        Returns the thread id associated with this chat, which corresponds to the thread field of XMPP messages. This method may return null if there is no thread ID is associated with this Chat.
        Returns:
        the thread ID of this chat.
      • getParticipant

        public EntityJid getParticipant()
        Deprecated.
        Returns the name of the user the chat is with.
        Returns:
        the name of the user the chat is occuring with.
      • sendMessage

        public void sendMessage​(java.lang.String text)
                         throws SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Deprecated.
        Sends the specified text as a message to the other chat participant. This is a convenience method for:
             Message message = chat.createMessage();
             message.setBody(messageText);
             chat.sendMessage(message);
         
        Parameters:
        text - the text to send.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendMessage

        public void sendMessage​(MessageBuilder message)
                         throws SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Deprecated.
        Sends a message to the other chat participant. The thread ID, recipient, and message type of the message will automatically set to those of this chat.
        Parameters:
        message - the message to send.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendMessage

        public void sendMessage​(Message message)
                         throws SmackException.NotConnectedException,
                                java.lang.InterruptedException
        Deprecated.
        Sends a message to the other chat participant. The thread ID, recipient, and message type of the message will automatically set to those of this chat.
        Parameters:
        message - the message to send.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addMessageListener

        public void addMessageListener​(ChatMessageListener listener)
        Deprecated.
        Adds a stanza listener that will be notified of any new messages in the chat.
        Parameters:
        listener - a stanza listener.
      • close

        public void close()
        Deprecated.
        Closes the Chat and removes all references to it from the ChatManager. The chat will be unusable when this method returns, so it's recommend to drop all references to the instance right after calling close().
      • getListeners

        public java.util.Set<ChatMessageListenergetListeners()
        Deprecated.
        Returns an unmodifiable set of all of the listeners registered with this chat.
        Returns:
        an unmodifiable set of all of the listeners registered with this chat.
      • createCollector

        public StanzaCollector createCollector()
        Deprecated.
        Creates a StanzaCollector which will accumulate the Messages for this chat. Always cancel StanzaCollectors when finished with them as they will accumulate messages indefinitely.
        Returns:
        the StanzaCollector which returns Messages for this chat.
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Deprecated.
        Overrides:
        equals in class java.lang.Object