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 TypeMethodDescriptionvoidaddMessageListener(ChatMessageListener listener) Deprecated.Adds a stanza listener that will be notified of any new messages in the chat.voidclose()Deprecated.Closes the Chat and removes all references to it from theChatManager.org.jivesoftware.smack.StanzaCollectorDeprecated.Creates aStanzaCollectorwhich will accumulate the Messages for this chat.booleanDeprecated.Deprecated.Returns an unmodifiable set of all of the listeners registered with this chat.org.jxmpp.jid.EntityJidDeprecated.Returns the name of the user the chat is with.Deprecated.Returns the thread id associated with this chat, which corresponds to thethreadfield of XMPP messages.inthashCode()Deprecated.voidremoveMessageListener(ChatMessageListener listener) Deprecated.voidsendMessage(String text) Deprecated.Sends the specified text as a message to the other chat participant.voidsendMessage(org.jivesoftware.smack.packet.Message message) Deprecated.Sends a message to the other chat participant.voidsendMessage(org.jivesoftware.smack.packet.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 thethreadfield of XMPP messages. This method may returnnullif there is no thread ID is associated with this Chat.- Returns:
- the thread ID of this chat.
-
getParticipant
public org.jxmpp.jid.EntityJid 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 org.jivesoftware.smack.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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(org.jivesoftware.smack.packet.MessageBuilder message) throws org.jivesoftware.smack.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:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(org.jivesoftware.smack.packet.Message message) throws org.jivesoftware.smack.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:
org.jivesoftware.smack.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
public void 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
public org.jivesoftware.smack.StanzaCollector createCollector()Deprecated.Creates aStanzaCollectorwhich 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
public int hashCode()Deprecated. -
equals
Deprecated.
-
org.jivesoftware.smack.chat2.Chatfromsmack-extensionsinstead.