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.Chatfromsmack-extensionsinstead.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 voidaddMessageListener(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.StanzaCollectorcreateCollector()Deprecated.Creates aStanzaCollectorwhich will accumulate the Messages for this chat.booleanequals(java.lang.Object obj)Deprecated.java.util.Set<ChatMessageListener>getListeners()Deprecated.Returns an unmodifiable set of all of the listeners registered with this chat.EntityJidgetParticipant()Deprecated.Returns the name of the user the chat is with.java.lang.StringgetThreadID()Deprecated.Returns the thread id associated with this chat, which corresponds to thethreadfield of XMPP messages.inthashCode()Deprecated.voidremoveMessageListener(ChatMessageListener listener)Deprecated.voidsendMessage(java.lang.String text)Deprecated.Sends the specified text as a message to the other chat participant.voidsendMessage(Message message)Deprecated.Sends a message to the other chat participant.voidsendMessage(MessageBuilder message)Deprecated.Sends a message to the other chat participant.java.lang.StringtoString()Deprecated.
-
-
-
Method Detail
-
getThreadID
public java.lang.String 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 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.
-
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 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
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Deprecated.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.- Overrides:
equalsin classjava.lang.Object
-
-