Package | org.igniterealtime.xiff.data |
Class | public class Presence |
Inheritance | Presence ![]() ![]() ![]() ![]() |
Implements | IPresence |
2.2.1. Types of Presence
The 'type' attribute of a presence stanza is OPTIONAL. A presence stanza that does not possess a 'type' attribute is used to signal to the server that the sender is online and available for communication. If included, the 'type' attribute specifies a lack of availability, a request to manage a subscription to another entity's presence, a request for another entity's current presence, or an error related to a previously-sent presence stanza. If included, the 'type' attribute MUST have one of the following values:
o unavailable -- Signals that the entity is no longer available for communication. o subscribe -- The sender wishes to subscribe to the recipient's presence. o subscribed -- The sender has allowed the recipient to receive their presence. o unsubscribe -- The sender is unsubscribing from another entity's presence. o unsubscribed -- The subscription request has been denied or a previously-granted subscription has been cancelled. o probe -- A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user. o error -- An error has occurred regarding processing or delivery of a previously-sent presence stanza.
For detailed information regarding presence semantics and the subscription model used in the context of XMPP-based instant messaging and presence applications, refer to Exchanging Presence Information (Section 5) and Managing Subscriptions (Section 6).
See also
Property | Defined By | ||
---|---|---|---|
![]() | errorCode : int
The error code, assuming this stanza contains error information. | XMPPStanza | |
![]() | errorCondition : String
The error condition, assuming this stanza contains error information. | XMPPStanza | |
![]() | errorMessage : String
The error message, assuming this stanza contains error information. | XMPPStanza | |
![]() | errorType : String
The error type, assuming this stanza contains error information. | XMPPStanza | |
![]() | from : EscapedJID
The JID of the sender. | XMPPStanza | |
![]() | id : String
The unique identifier of this stanza. | XMPPStanza | |
![]() | idGenerator : IIDGenerator [static]
The ID generator for this stanza type. | XMPPStanza | |
priority : int
The priority of the presence, usually on a scale of 1-5. | Presence | ||
show : String
The show value; away, online, etc. | Presence | ||
status : String
The status; usually used for "away messages."
The OPTIONAL status element contains XML character data specifying
a natural-language description of availability status. | Presence | ||
time : Date [read-only]
Time of the presence in case of a delay. | Presence | ||
![]() | to : EscapedJID
The JID of the recipient. | XMPPStanza | |
![]() | type : String
The stanza type. | XMPPStanza | |
![]() | xml : XML [override]
In addition to saving the XML, check for possible Extensions that are registered for listening this XML data. | XMPPStanza |
Method | Defined By | ||
---|---|---|---|
Presence(recipient:EscapedJID = null, sender:EscapedJID = null, presenceType:String = null, showVal:String = null, statusVal:String = null, priorityVal:int = 0)
According to Google Talk developers via their presentation [somewhere few years ago],
most of the XMPP related traffic in their service is made by Presence. | Presence | ||
![]() |
Add extension to the list of the given namespace and insert to the XML element as a child. | ExtensionContainer | |
![]() | generateID(prefix:String = null):String [static]
Generates a unique ID for the stanza. | XMPPStanza | |
![]() | getAllExtensions():Array | ExtensionContainer | |
![]() | getAllExtensionsByNS(nameSpace:String):Array | ExtensionContainer | |
![]() | getAttribute(name:String):String
Convinience method for getting element value from the XML. | XMLStanza | |
![]() | getChildAttribute(elem:String, name:String):String
Convinience method for getting child element attribute value from the XML. | XMLStanza | |
![]() | getChildField(elem:String, name:String):String
Convinience method for getting child element value from the XML. | XMLStanza | |
![]() | getExtension(elementName:String):IExtension
Get the extension having the given element name. | ExtensionContainer | |
![]() | getField(name:String):String
Convinience method for getting element value from the XML. | XMLStanza | |
![]() | removeAllExtensions(nameSpace:String):void | ExtensionContainer | |
![]() | removeExtension(extension:IExtension):Boolean | ExtensionContainer | |
![]() | removeFields(name:String):void
Helper method for removing all child elements that have the given name. | XMLStanza | |
![]() | setAttribute(name:String, value:String):void
Convinience method for setting a value to a element in the XML. | XMLStanza | |
![]() | setChildAttribute(elem:String, name:String, value:String):void
Convinience method for setting an attribute for a child element of the XML. | XMLStanza | |
![]() | setChildField(elem:String, name:String, value:String):void
Convinience method for setting a value for a child element of the XML. | XMLStanza | |
![]() | setField(name:String, value:String):void
Convinience method for setting a value to a element in the XML. | XMLStanza | |
![]() | toString():String
Converts the base stanza XML to a string. | XMLStanza |
Constant | Defined By | ||
---|---|---|---|
![]() | CLIENT_NAMESPACE : String = jabber:client [static] | XMPPStanza | |
![]() | CLIENT_VERSION : String = 1.0 [static]
The version of XMPP specified in RFC 3920 is "1.0"; in particular, this
encapsulates the stream-related protocols (Use of TLS (Section 5),
Use of SASL (Section 6), and Stream Errors (Section 4.7)), as well as
the semantics of the three defined XML stanza types (message,
presence, and iq). | XMPPStanza | |
![]() | DEFAULT_NS : Namespace [static]
Default XML namespace. | XMLStanza | |
![]() | ELEMENT_IQ : String = iq [static] | XMPPStanza | |
![]() | ELEMENT_MESSAGE : String = message [static] | XMPPStanza | |
![]() | ELEMENT_PRESENCE : String = presence [static] | XMPPStanza | |
![]() | ELEMENT_TEMP : String = temp [static]
Internal name in XIFF for incoming data. | XMPPStanza | |
![]() | ERROR_AUTH : String = auth [static]
Retry after providing credentials
| XMPPStanza | |
![]() | ERROR_CANCEL : String = cancel [static]
Do not retry (the error is unrecoverable)
| XMPPStanza | |
![]() | ERROR_CONTINUE : String = continue [static]
Proceed (the condition was only a warning)
| XMPPStanza | |
![]() | ERROR_MODIFY : String = modify [static]
Retry after changing the data sent
| XMPPStanza | |
![]() | ERROR_WAIT : String = wait [static]
Retry after waiting (the error is temporary)
| XMPPStanza | |
![]() | FLASH_NS : Namespace [static]
| XMLStanza | |
![]() | NAMESPACE_BOSH : String = urn:xmpp:xbosh [static] | XMPPStanza | |
![]() | NAMESPACE_FLASH : String = http://www.jabber.com/streams/flash [static] | XMPPStanza | |
![]() | NAMESPACE_STREAM : String = http://etherx.jabber.org/streams [static] | XMPPStanza | |
SHOW_AWAY : String = away [static]
The entity or resource is temporarily away. | Presence | ||
SHOW_CHAT : String = chat [static]
The entity or resource is actively interested in chatting. | Presence | ||
SHOW_DND : String = dnd [static]
The entity or resource is busy (dnd = "Do Not Disturb"). | Presence | ||
SHOW_XA : String = xa [static]
The entity or resource is away for an extended period (xa = "eXtended Away"). | Presence | ||
![]() | STREAM_NS : Namespace [static]
| XMLStanza | |
TYPE_ERROR : String = error [static]
An error has occurred regarding processing of a
previously-sent presence stanza; if the presence stanza is of type
"error", it MUST include an error child element. | Presence | ||
TYPE_PROBE : String = probe [static]
A request for an entity's current presence; SHOULD be
generated only by a server on behalf of a user. | Presence | ||
TYPE_SUBSCRIBE : String = subscribe [static]
The sender wishes to subscribe to the recipient's
presence. | Presence | ||
TYPE_SUBSCRIBED : String = subscribed [static]
The sender has allowed the recipient to receive their presence. | Presence | ||
TYPE_UNAVAILABLE : String = unavailable [static]
Signals that the entity is no longer available for communication. | Presence | ||
TYPE_UNSUBSCRIBE : String = unsubscribe [static]
The sender is unsubscribing from the receiver's presence. | Presence | ||
TYPE_UNSUBSCRIBED : String = unsubscribed [static]
The subscription request has been denied or a
previously-granted subscription has been cancelled. | Presence | ||
![]() | XML_LANG : String = en [static] | XMPPStanza |
priority | property |
priority:int
The priority of the presence, usually on a scale of 1-5.
RFC: "The value MUST be an integer between -128 and +127".
If no priority is provided, a server SHOULD consider the priority to be zero.
Use NaN
or 0
to remove.
public function get priority():int
public function set priority(value:int):void
show | property |
show:String
The show value; away, online, etc. There are predefined static variables in the Presence class for this:
Use null
to remove.
public function get show():String
public function set show(value:String):void
status | property |
status:String
The status; usually used for "away messages."
The OPTIONAL status element contains XML character data specifying a natural-language description of availability status. It is normally used in conjunction with the show element to provide a detailed description of an availability state (e.g., "In a meeting"). The status element MUST NOT possess any attributes, with the exception of the 'xml:lang' attribute. Multiple instances of the status element MAY be included but only if each instance possesses an 'xml:lang' attribute with a distinct language value.
Use null
to remove.
public function get status():String
public function set status(value:String):void
time | property |
time:Date
[read-only] Time of the presence in case of a delay. Used only for messages which were sent while user was offline.
Can be set only via XML as the value should come from the server.
There are two ways that might be possible coming from the server, XEP-0203 or XEP-0091, of which the latter is legacy.
XEP-0203: CCYY-MM-DDThh:mm:ss[.sss]TZD
XEP-0091: CCYYMMDDThh:mm:ss
public function get time():Date
See also
Presence | () | Constructor |
public function Presence(recipient:EscapedJID = null, sender:EscapedJID = null, presenceType:String = null, showVal:String = null, statusVal:String = null, priorityVal:int = 0)
According to Google Talk developers via their presentation [somewhere few years ago], most of the XMPP related traffic in their service is made by Presence.
The presence element can be seen as a basic broadcast or "publish-subscribe" mechanism, whereby multiple entities receive information about an entity to which they have subscribed (in this case, network availability information). In general, a publishing entity SHOULD send a presence stanza with no 'to' attribute, in which case the server to which the entity is connected SHOULD broadcast or multiplex that stanza to all subscribing entities. However, a publishing entity MAY also send a presence stanza with a 'to' attribute, in which case the server SHOULD route or deliver that stanza to the intended recipient. See Server Rules for Handling XML Stanzas (Section 10) for general routing and delivery rules related to XML stanzas, and [XMPP-IM] for presence-specific rules in the context of an instant messaging and presence application.
Parametersrecipient:EscapedJID (default = null ) — The recipient of the presence, usually in the form of a JID.
| |
sender:EscapedJID (default = null ) — The sender of the presence, usually in the form of a JID.
| |
presenceType:String (default = null ) — The type of presence as a string. There are predefined static variables for
| |
showVal:String (default = null ) — What to show for this presence (away, online, etc.) There are predefined static variables for
| |
statusVal:String (default = null ) — The status; usually used for the "away message."
| |
priorityVal:int (default = 0 ) — The priority of this presence; usually on a scale of 1-5.
|
SHOW_AWAY | Constant |
public static const SHOW_AWAY:String = away
The entity or resource is temporarily away.
SHOW_CHAT | Constant |
public static const SHOW_CHAT:String = chat
The entity or resource is actively interested in chatting.
SHOW_DND | Constant |
public static const SHOW_DND:String = dnd
The entity or resource is busy (dnd = "Do Not Disturb").
SHOW_XA | Constant |
public static const SHOW_XA:String = xa
The entity or resource is away for an extended period (xa = "eXtended Away").
TYPE_ERROR | Constant |
public static const TYPE_ERROR:String = error
An error has occurred regarding processing of a previously-sent presence stanza; if the presence stanza is of type "error", it MUST include an error child element.
TYPE_PROBE | Constant |
public static const TYPE_PROBE:String = probe
A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user.
TYPE_SUBSCRIBE | Constant |
public static const TYPE_SUBSCRIBE:String = subscribe
The sender wishes to subscribe to the recipient's presence.
TYPE_SUBSCRIBED | Constant |
public static const TYPE_SUBSCRIBED:String = subscribed
The sender has allowed the recipient to receive their presence.
TYPE_UNAVAILABLE | Constant |
public static const TYPE_UNAVAILABLE:String = unavailable
Signals that the entity is no longer available for communication.
TYPE_UNSUBSCRIBE | Constant |
public static const TYPE_UNSUBSCRIBE:String = unsubscribe
The sender is unsubscribing from the receiver's presence.
TYPE_UNSUBSCRIBED | Constant |
public static const TYPE_UNSUBSCRIBED:String = unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.