public class MessageEvent extends Object implements ExtensionElement
There are four message events currently defined in this namespace:
Modifier and Type | Field and Description |
---|---|
static String |
CANCELLED |
static String |
COMPOSING |
static String |
DELIVERED |
static String |
DISPLAYED |
static String |
ELEMENT |
static String |
NAMESPACE |
static String |
OFFLINE |
Constructor and Description |
---|
MessageEvent() |
Modifier and Type | Method and Description |
---|---|
String |
getElementName()
Returns the XML element name of the extension sub-packet root element.
|
List<String> |
getEventTypes()
Returns the types of events.
|
String |
getNamespace()
Returns the XML namespace of the extension sub-packet root element.
|
String |
getStanzaId()
Returns the unique ID of the message that requested to be notified of the event.
|
boolean |
isCancelled()
When the message is a notification returns if the receiver of the message cancelled
composing a reply.
|
boolean |
isComposing()
When the message is a request returns if the sender of the message requests to be notified
when the receiver is composing a reply.
|
boolean |
isDelivered()
When the message is a request returns if the sender of the message requests to be notified
when the message is delivered.
|
boolean |
isDisplayed()
When the message is a request returns if the sender of the message requests to be notified
when the message is displayed.
|
boolean |
isMessageEventRequest()
Returns true if this MessageEvent is a request for notifications.
|
boolean |
isOffline()
When the message is a request returns if the sender of the message requests to be notified
when the receiver of the message is offline.
|
void |
setCancelled(boolean cancelled)
When the message is a notification sets if the receiver of the message cancelled
composing a reply.
|
void |
setComposing(boolean composing)
When the message is a request sets if the sender of the message requests to be notified
when the receiver is composing a reply.
|
void |
setDelivered(boolean delivered)
When the message is a request sets if the sender of the message requests to be notified
when the message is delivered.
|
void |
setDisplayed(boolean displayed)
When the message is a request sets if the sender of the message requests to be notified
when the message is displayed.
|
void |
setOffline(boolean offline)
When the message is a request sets if the sender of the message requests to be notified
when the receiver of the message is offline.
|
void |
setStanzaId(String packetID)
Sets the unique ID of the message that requested to be notified of the event.
|
String |
toXML()
Returns the XML representation of a Message Event according the specification.
|
public static final String NAMESPACE
public static final String ELEMENT
public static final String OFFLINE
public static final String COMPOSING
public static final String DISPLAYED
public static final String DELIVERED
public static final String CANCELLED
public MessageEvent()
public String getElementName()
getElementName
in interface NamedElement
public String getNamespace()
getNamespace
in interface ExtensionElement
public boolean isComposing()
public boolean isDelivered()
public boolean isDisplayed()
public boolean isOffline()
public boolean isCancelled()
public String getStanzaId()
public List<String> getEventTypes()
public void setComposing(boolean composing)
composing
- sets if the sender is requesting to be notified when composing or when
notifying that the receiver of the message is composing a replypublic void setDelivered(boolean delivered)
delivered
- sets if the sender is requesting to be notified when delivered or when
notifying that the message was deliveredpublic void setDisplayed(boolean displayed)
displayed
- sets if the sender is requesting to be notified when displayed or when
notifying that the message was displayedpublic void setOffline(boolean offline)
offline
- sets if the sender is requesting to be notified when offline or when
notifying that the receiver of the message is offlinepublic void setCancelled(boolean cancelled)
cancelled
- sets if the receiver of the message cancelled composing a replypublic void setStanzaId(String packetID)
packetID
- the message id that requested to be notified of the event.public boolean isMessageEventRequest()
public String toXML()
Request to be notified when displayed:
<message to='romeo@montague.net/orchard' from='juliet@capulet.com/balcony' id='message22'> <x xmlns='jabber:x:event'> <displayed/> </x> </message>Notification of displayed:
<message from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony'> <x xmlns='jabber:x:event'> <displayed/> <id>message22</id> </x> </message>