|
||||||||||
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.msg.EventXMessage
public class EventXMessage
This class supports the jabber:x:event namespace. It gives the ability to work
with incoming events and also creating outgoing events. You add the X Message to an existing Message.
The composing event is generated when the user is actively typing a reply to the message. If the user never completes/sends
the reply (or after an idle timeout), an empty jabber:x:event (just contains the id element) should be sent to "clear" the
outstanding composing event. It is suggested that the client first check to make sure the recipient of a composing event is
also in the roster, as it may not be desireable to send such availability information to unknown contacts.
The way the event works is this: First, someone submits a message telling you what kinds of events it can
support (or willing to listen to) and includes a message ID. Then recipient then can start sending back
events specific for that message, but must include the
Receiving Event Requests: You can retrieve sender's willingness to receive certain events by simply calling to see which event it advertised itself to see. Multiple events can be set so each event that you're interested in should be checked.
Sending Event Requests: You can send a request along with the message
to indicate what events you like the remote to send. You can set multiple event types you want to listen for. Note that,
if you set the message ID for the event class, the message is then considered a event reply (not a request anymore).
In this case, the
Receiving Event Replies: you can retrieve information about event replies to your event requests just as you normally would. The only way to tell if the event is a reply and not a request is by looking to see if there is a event Message ID associated with it.
Sending Event Replies: Sending event replies is the same as sending requests, except for the fact that you need to include the original requestor's message ID inside the event to distinguish it as a reply and not a request. You should technically send one event type per event message indicating your current status (delivered, composing, displayed).
Caveats: If you happen to send a composing event reply and would like to clear out the status due to some inactivity or idle time such that the composing message was never sent, then after an idle time period, you should submit another event message that contains only the message id (but no events).
Current Implementation: JEP-0022 Version 1.1
Field Summary | |
---|---|
static java.lang.String |
EVENT_COMPOSING
|
static java.lang.String |
EVENT_DELIVERED
|
static java.lang.String |
EVENT_DISPLAYED
|
static java.lang.String |
EVENT_OFFLINE
|
Fields inherited from class com.echomine.jabber.JabberMessage |
---|
messageID |
Constructor Summary | |
---|---|
EventXMessage()
constructs a default Delay message (with the x element) |
Method Summary | |
---|---|
java.lang.String |
encode()
overrides the parent's method to first add the stored attributes into the DOM and then call the parent's method to encode the data into a string. |
java.lang.String |
getEventMessageID()
retrieves the sender's message ID associated with the event. |
int |
getMessageType()
the default message type is unknown. |
boolean |
isAllClear()
this method checks for you to see if all the event flags are NOT set. |
boolean |
isComposing()
|
boolean |
isDelivered()
|
boolean |
isDisplayed()
|
boolean |
isOffline()
|
JabberMessage |
parse(JabberMessageParser parser,
Element msgTree)
parses out the data from the message |
void |
reset()
this will reset all the flags to false. |
void |
setComposing(boolean composing)
|
void |
setDelivered(boolean delivered)
|
void |
setDisplayed(boolean displayed)
|
void |
setEventMessageID(java.lang.String msgID)
sets the event message id. |
void |
setOffline(boolean offline)
sets the offline flag. |
Methods inherited from class com.echomine.jabber.JabberJDOMMessage |
---|
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 EVENT_OFFLINE
public static final java.lang.String EVENT_DELIVERED
public static final java.lang.String EVENT_COMPOSING
public static final java.lang.String EVENT_DISPLAYED
Constructor Detail |
---|
public EventXMessage()
Method Detail |
---|
public void reset()
public java.lang.String getEventMessageID()
public void setEventMessageID(java.lang.String msgID)
public boolean isOffline()
public boolean isDisplayed()
public boolean isComposing()
public boolean isDelivered()
public boolean isAllClear()
public void setOffline(boolean offline)
public void setDisplayed(boolean displayed)
public void setComposing(boolean composing)
public void setDelivered(boolean delivered)
public JabberMessage parse(JabberMessageParser parser, Element msgTree) throws ParseException
parse
in interface JabberMessageParsable
parse
in class JabberJDOMMessage
ParseException
public java.lang.String encode() throws ParseException
encode
in class JabberJDOMMessage
ParseException
- if something went wrong during encodingpublic int getMessageType()
JabberJDOMMessage
getMessageType
in class JabberJDOMMessage
JabberCode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |