Packageorg.igniterealtime.xiff.data
Classpublic class Presence
InheritancePresence Inheritance XMPPStanza Inheritance XMLStanza Inheritance ExtensionContainer Inheritance Object
Implements IPresence

This class provides encapsulation for manipulation of presence data for sending and receiving.

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

http://tools.ietf.org/html/rfc3921


Public Properties
 PropertyDefined By
 InheritederrorCode : int
The error code, assuming this stanza contains error information.
XMPPStanza
 InheritederrorCondition : String
The error condition, assuming this stanza contains error information.
XMPPStanza
 InheritederrorMessage : String
The error message, assuming this stanza contains error information.
XMPPStanza
 InheritederrorType : String
The error type, assuming this stanza contains error information.
XMPPStanza
 Inheritedfrom : EscapedJID
The JID of the sender.
XMPPStanza
 Inheritedid : String
The unique identifier of this stanza.
XMPPStanza
 InheritedidGenerator : 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
 Inheritedto : EscapedJID
The JID of the recipient.
XMPPStanza
 Inheritedtype : String
The stanza type.
XMPPStanza
 Inheritedxml : XML
[override] In addition to saving the XML, check for possible Extensions that are registered for listening this XML data.
XMPPStanza
Protected Properties
 PropertyDefined By
 InheriteddelayedDelivery : Date
[read-only] Time of the message/presence in case of a delay.
XMPPStanza
Public Methods
 MethodDefined 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
 Inherited
Add extension to the list of the given namespace and insert to the XML element as a child.
ExtensionContainer
 Inherited
generateID(prefix:String = null):String
[static] Generates a unique ID for the stanza.
XMPPStanza
 Inherited
ExtensionContainer
 Inherited
getAllExtensionsByNS(nameSpace:String):Array
ExtensionContainer
 Inherited
getAttribute(name:String):String
Convinience method for getting element value from the XML.
XMLStanza
 Inherited
getChildAttribute(elem:String, name:String):String
Convinience method for getting child element attribute value from the XML.
XMLStanza
 Inherited
getChildField(elem:String, name:String):String
Convinience method for getting child element value from the XML.
XMLStanza
 Inherited
getExtension(elementName:String):IExtension
Get the extension having the given element name.
ExtensionContainer
 Inherited
getField(name:String):String
Convinience method for getting element value from the XML.
XMLStanza
 Inherited
removeAllExtensions(nameSpace:String):void
ExtensionContainer
 Inherited
removeExtension(extension:IExtension):Boolean
ExtensionContainer
 Inherited
removeFields(name:String):void
Helper method for removing all child elements that have the given name.
XMLStanza
 Inherited
setAttribute(name:String, value:String):void
Convinience method for setting a value to a element in the XML.
XMLStanza
 Inherited
setChildAttribute(elem:String, name:String, value:String):void
Convinience method for setting an attribute for a child element of the XML.
XMLStanza
 Inherited
setChildField(elem:String, name:String, value:String):void
Convinience method for setting a value for a child element of the XML.
XMLStanza
 Inherited
setField(name:String, value:String):void
Convinience method for setting a value to a element in the XML.
XMLStanza
 Inherited
toString():String
Converts the base stanza XML to a string.
XMLStanza
Public Constants
 ConstantDefined By
 InheritedCLIENT_NAMESPACE : String = jabber:client
[static]
XMPPStanza
 InheritedCLIENT_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
 InheritedDEFAULT_NS : Namespace
[static] Default XML namespace.
XMLStanza
 InheritedELEMENT_IQ : String = iq
[static]
XMPPStanza
 InheritedELEMENT_MESSAGE : String = message
[static]
XMPPStanza
 InheritedELEMENT_PRESENCE : String = presence
[static]
XMPPStanza
 InheritedELEMENT_TEMP : String = temp
[static] Internal name in XIFF for incoming data.
XMPPStanza
 InheritedERROR_AUTH : String = auth
[static] Retry after providing credentials
XMPPStanza
 InheritedERROR_CANCEL : String = cancel
[static] Do not retry (the error is unrecoverable)
XMPPStanza
 InheritedERROR_CONTINUE : String = continue
[static] Proceed (the condition was only a warning)
XMPPStanza
 InheritedERROR_MODIFY : String = modify
[static] Retry after changing the data sent
XMPPStanza
 InheritedERROR_WAIT : String = wait
[static] Retry after waiting (the error is temporary)
XMPPStanza
 InheritedFLASH_NS : Namespace
[static]
XMLStanza
 InheritedNAMESPACE_BOSH : String = urn:xmpp:xbosh
[static]
XMPPStanza
 InheritedNAMESPACE_FLASH : String = http://www.jabber.com/streams/flash
[static]
XMPPStanza
 InheritedNAMESPACE_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
 InheritedSTREAM_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
 InheritedXML_LANG : String = en
[static]
XMPPStanza
Property Detail
priorityproperty
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.


Implementation
    public function get priority():int
    public function set priority(value:int):void
showproperty 
show:String

The show value; away, online, etc. There are predefined static variables in the Presence class for this:

Use null to remove.


Implementation
    public function get show():String
    public function set show(value:String):void
statusproperty 
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.


Implementation
    public function get status():String
    public function set status(value:String):void
timeproperty 
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


Implementation
    public function get time():Date

See also

Constructor Detail
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.

Parameters
recipient: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.
Constant Detail
SHOW_AWAYConstant
public static const SHOW_AWAY:String = away

The entity or resource is temporarily away.

SHOW_CHATConstant 
public static const SHOW_CHAT:String = chat

The entity or resource is actively interested in chatting.

SHOW_DNDConstant 
public static const SHOW_DND:String = dnd

The entity or resource is busy (dnd = "Do Not Disturb").

SHOW_XAConstant 
public static const SHOW_XA:String = xa

The entity or resource is away for an extended period (xa = "eXtended Away").

TYPE_ERRORConstant 
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_PROBEConstant 
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_SUBSCRIBEConstant 
public static const TYPE_SUBSCRIBE:String = subscribe

The sender wishes to subscribe to the recipient's presence.

TYPE_SUBSCRIBEDConstant 
public static const TYPE_SUBSCRIBED:String = subscribed

The sender has allowed the recipient to receive their presence.

TYPE_UNAVAILABLEConstant 
public static const TYPE_UNAVAILABLE:String = unavailable

Signals that the entity is no longer available for communication.

TYPE_UNSUBSCRIBEConstant 
public static const TYPE_UNSUBSCRIBE:String = unsubscribe

The sender is unsubscribing from the receiver's presence.

TYPE_UNSUBSCRIBEDConstant 
public static const TYPE_UNSUBSCRIBED:String = unsubscribed

The subscription request has been denied or a previously-granted subscription has been cancelled.