|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.jabber.JabberMessage
com.echomine.jabber.JabberJDOMMessage
com.echomine.jabber.AbstractJabberMessage
com.echomine.jabber.JabberChatMessage
public class JabberChatMessage
This is the base message for working with private IM messages, group chats, and anything that is sent
through the
The message body may come in different formats. For instance, it can come in as XHTML for better style support. This is an extension and is NOT considered to be an X Message. Thus, it is retrieved through this class' getHTML(). To display XHTML data in Java is rather easy. You can simply use a JTextPane or JEditorPane, set the Content MIME Type to text/html, and then just set the Text Pane's text to getHTML().
Processing of X Messages are supported as always, but it is up to the developer to implement capabilities to work with the X Message types.
Thread IDs is easy to work with. Normally, if you initiate a chat for the first time with a JID, you should set the Thread ID to a new ID (you can obtain a new ID from the generateThreadID() method, which will return a GUID 32-byte hex string). However, if you are replying to a message, you should set your reply message's Thread ID to the ID of the message that you're replying to. ie. reply.setThreadID(origMsg.getThreadID()). The developer is responsible for setting the Thread IDs for reply messages. However, if this message is a new message, the API will automatically set the Thread ID to a new GUID for you so you don't need to worry about that part. But that's only for new messages.
Field Summary | |
---|---|
static java.lang.String |
TYPE_CHAT
|
static java.lang.String |
TYPE_GROUPCHAT
|
static java.lang.String |
TYPE_HEADLINE
|
static java.lang.String |
TYPE_NORMAL
|
Fields inherited from class com.echomine.jabber.AbstractJabberMessage |
---|
TYPE_ERROR |
Fields inherited from class com.echomine.jabber.JabberMessage |
---|
messageID |
Constructor Summary | |
---|---|
JabberChatMessage()
defaults the message type to a normal type |
|
JabberChatMessage(java.lang.String type)
Normally used for creating an outgoing message |
Method Summary | |
---|---|
static java.lang.String |
generateThreadID()
the method will generate a unique ID for use. |
java.lang.String |
getBody()
retrieves the message body |
DelayXMessage |
getDelayMessage()
convenience method to retrieve the Delay X Message (you can get the message by calling getXMessage() as well) |
EventXMessage |
getEventMessage()
retrieves the event message if there is one associated with it |
java.lang.String |
getHTMLBody()
retrieves the body that is encoded with XHTML. |
int |
getMessageType()
the default message type is unknown. |
PGPEncryptedXMessage |
getPGPMessage()
a convenience method to retrieve the PGP encrypted data if there is one attached to this message |
java.util.List |
getRosterList()
retrieves a list of RosterItem's contained in this message if there are any. |
java.lang.String |
getSubject()
retrieves the message subject |
java.lang.String |
getThreadID()
retrieve the thread id associated with this message. |
boolean |
isRosterMessage()
checks to see if this message contains a jabber:x:roster message. |
JabberMessage |
parse(JabberMessageParser parser,
Element msgTree)
parses the message. |
void |
setBody(java.lang.String body)
sets the outgoing message body |
void |
setHTMLBody(java.lang.String html)
this sets the HTML text. |
void |
setSubject(java.lang.String subject)
sets the message subject. |
void |
setThreadID(java.lang.String threadID)
sets the thread id. |
Methods inherited from class com.echomine.jabber.AbstractJabberMessage |
---|
getErrorMessage, getFrom, getTo, getType, isError, setErrorMessage, setFrom, setTo, setType |
Methods inherited from class com.echomine.jabber.JabberJDOMMessage |
---|
encode, getDOM, getXMLOutputter, setMessageID, toString |
Methods inherited from class com.echomine.jabber.JabberMessage |
---|
getMessageID, getReplyMessage, getTimeout, getXMessage, getXMessages, interrupt, isReplyRequired, isSendXMessages, isSynchronized, replyReceived, setReplyRequired, setSendXMessages, setSynchronized, setTimeout, setXMessage, setXMessages |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TYPE_NORMAL
public static final java.lang.String TYPE_CHAT
public static final java.lang.String TYPE_GROUPCHAT
public static final java.lang.String TYPE_HEADLINE
Constructor Detail |
---|
public JabberChatMessage(java.lang.String type)
public JabberChatMessage()
Method Detail |
---|
public JabberMessage parse(JabberMessageParser parser, Element msgTree) throws ParseException
AbstractJabberMessage
parse
in interface JabberMessageParsable
parse
in class AbstractJabberMessage
ParseException
public java.lang.String getBody()
public void setBody(java.lang.String body)
public java.lang.String getHTMLBody()
public void setHTMLBody(java.lang.String html) throws ParseException
ParseException
public java.lang.String getSubject()
public void setSubject(java.lang.String subject)
public java.lang.String getThreadID()
public void setThreadID(java.lang.String threadID)
public boolean isRosterMessage()
public java.util.List getRosterList()
public EventXMessage getEventMessage()
public DelayXMessage getDelayMessage()
public PGPEncryptedXMessage getPGPMessage()
public static java.lang.String generateThreadID()
public int getMessageType()
JabberJDOMMessage
getMessageType
in class JabberJDOMMessage
JabberCode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |