public class Chat
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(MessageListener listener)
Adds a packet listener that will be notified of any new messages in the
chat.
|
PacketCollector |
createCollector()
Creates a
PacketCollector which will accumulate the Messages
for this chat. |
boolean |
equals(java.lang.Object obj) |
java.util.Collection<MessageListener> |
getListeners()
Returns an unmodifiable collection of all of the listeners registered with this chat.
|
java.lang.String |
getParticipant()
Returns the name of the user the chat is with.
|
java.lang.String |
getThreadID()
Returns the thread id associated with this chat, which corresponds to the
thread field of XMPP messages.
|
void |
removeMessageListener(MessageListener listener) |
void |
sendMessage(Message message)
Sends a message to the other chat participant.
|
void |
sendMessage(java.lang.String text)
Sends the specified text as a message to the other chat participant.
|
public java.lang.String getThreadID()
public java.lang.String getParticipant()
public void sendMessage(java.lang.String text) throws XMPPException
Message message = chat.createMessage(); message.setBody(messageText); chat.sendMessage(message);
text
- the text to send.XMPPException
- if sending the message fails.public void sendMessage(Message message) throws XMPPException
message
- the message to send.XMPPException
- if an error occurs sending the message.public void addMessageListener(MessageListener listener)
listener
- a packet listener.public void removeMessageListener(MessageListener listener)
public java.util.Collection<MessageListener> getListeners()
public PacketCollector createCollector()
PacketCollector
which will accumulate the Messages
for this chat. Always cancel PacketCollectors when finished with them as they will accumulate
messages indefinitely.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2003-2007 Jive Software.