Package org.jivesoftware.smack.chat
Class Chat
- java.lang.Object
-
- org.jivesoftware.smack.chat.Chat
-
@Deprecated public class Chat extends java.lang.Object
Deprecated.useorg.jivesoftware.smack.chat2.Chat
fromsmack-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 Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
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
.org.jivesoftware.smack.StanzaCollector
createCollector()
Deprecated.Creates aStanzaCollector
which will accumulate the Messages for this chat.boolean
equals(java.lang.Object obj)
Deprecated.java.util.Set<ChatMessageListener>
getListeners()
Deprecated.Returns an unmodifiable set of all of the listeners registered with this chat.org.jxmpp.jid.EntityJid
getParticipant()
Deprecated.Returns the name of the user the chat is with.java.lang.String
getThreadID()
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(java.lang.String text)
Deprecated.Sends the specified text as a message to the other chat participant.void
sendMessage(org.jivesoftware.smack.packet.Message message)
Deprecated.Sends a message to the other chat participant.void
sendMessage(org.jivesoftware.smack.packet.MessageBuilder message)
Deprecated.Sends a message to the other chat participant.java.lang.String
toString()
Deprecated.
-
-
-
Method Detail
-
getThreadID
public java.lang.String 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
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 occuring with.
-
sendMessage
public void sendMessage(java.lang.String text) throws org.jivesoftware.smack.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:
org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(org.jivesoftware.smack.packet.MessageBuilder message) throws org.jivesoftware.smack.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:
org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
sendMessage
public void sendMessage(org.jivesoftware.smack.packet.Message message) throws org.jivesoftware.smack.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:
org.jivesoftware.smack.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.
-
removeMessageListener
public void removeMessageListener(ChatMessageListener listener)
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
public java.util.Set<ChatMessageListener> 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 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
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.- Overrides:
equals
in classjava.lang.Object
-
-