org.jivesoftware.smack.chat2.Chat
from smack-extensions
instead.@Deprecated public class Chat extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(ChatMessageListener listener)
Deprecated.
Adds a stanza(/packet) 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 the
ChatManager . |
StanzaCollector |
createCollector()
Deprecated.
Creates a
StanzaCollector 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.
|
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 the
thread field of XMPP messages.
|
int |
hashCode()
Deprecated.
|
void |
removeMessageListener(ChatMessageListener listener)
Deprecated.
|
void |
sendMessage(Message message)
Deprecated.
Sends a message to the other chat participant.
|
void |
sendMessage(java.lang.String text)
Deprecated.
Sends the specified text as a message to the other chat participant.
|
java.lang.String |
toString()
Deprecated.
|
public java.lang.String getThreadID()
public EntityJid getParticipant()
public void sendMessage(java.lang.String text) throws SmackException.NotConnectedException, java.lang.InterruptedException
Message message = chat.createMessage(); message.setBody(messageText); chat.sendMessage(message);
text
- the text to send.SmackException.NotConnectedException
java.lang.InterruptedException
public void sendMessage(Message message) throws SmackException.NotConnectedException, java.lang.InterruptedException
message
- the message to send.SmackException.NotConnectedException
java.lang.InterruptedException
public void addMessageListener(ChatMessageListener listener)
listener
- a stanza(/packet) listener.public void removeMessageListener(ChatMessageListener listener)
public void close()
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()
.public java.util.Set<ChatMessageListener> getListeners()
public StanzaCollector createCollector()
StanzaCollector
which will accumulate the Messages
for this chat. Always cancel StanzaCollectors when finished with them as they will accumulate
messages indefinitely.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object