Package org.jivesoftware.smack.chat
Class Chat
java.lang.Object
org.jivesoftware.smack.chat.Chat
Deprecated.
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 Summary
Modifier and TypeMethodDescriptionvoid
addMessageListener
(ChatMessageListener listener) Deprecated.Adds a stanza listener that will be notified of any new messages in the chat.void
close()
Deprecated.Closes the Chat and removes all references to it from theChatManager
.Deprecated.Creates aStanzaCollector
which will accumulate the Messages for this chat.boolean
Deprecated.Deprecated.Returns an unmodifiable set of all of the listeners registered with this chat.Deprecated.Returns the name of the user the chat is with.Deprecated.Returns the thread id associated with this chat, which corresponds to thethread
field of XMPP messages.int
hashCode()
Deprecated.void
removeMessageListener
(ChatMessageListener listener) Deprecated.void
sendMessage
(String text) Deprecated.Sends the specified text as a message to the other chat participant.void
sendMessage
(Message message) Deprecated.Sends a message to the other chat participant.void
sendMessage
(MessageBuilder message) Deprecated.Sends a message to the other chat participant.toString()
Deprecated.
-
Method Details
-
getThreadID
Deprecated.Returns the thread id associated with this chat, which corresponds to thethread
field of XMPP messages. This method may returnnull
if there is no thread ID is associated with this Chat.- Returns:
- the thread ID of this chat.
-
getParticipant
Deprecated.Returns the name of the user the chat is with.- Returns:
- the name of the user the chat is occurring with.
-
sendMessage
public void sendMessage(String text) throws SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(MessageBuilder message) throws SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(Message message) throws SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-
addMessageListener
Deprecated.Adds a stanza listener that will be notified of any new messages in the chat.- Parameters:
listener
- a stanza listener.
-
removeMessageListener
Deprecated. -
close
Deprecated.Closes the Chat and removes all references to it from theChatManager
. The chat will be unusable when this method returns, so it's recommend to drop all references to the instance right after callingclose()
. -
getListeners
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
Deprecated.Creates aStanzaCollector
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
Deprecated. -
hashCode
Deprecated. -
equals
Deprecated.
-
org.jivesoftware.smack.chat2.Chat
fromsmack-extensions
instead.