Class jabberwerx.Presence (MINIMAL)
Extends
jabberwerx.Stanza.
Represents a <presence/> stanza.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
jabberwerx.Presence(packet)
Creates a new Presence object. |
| Field Attributes | Field Name and Description |
|---|---|
| <static> <constant> |
jabberwerx.Presence.SHOW_AWAY
The "away" status. |
| <static> <constant> |
jabberwerx.Presence.SHOW_CHAT
The "chat" status. |
| <static> <constant> |
jabberwerx.Presence.SHOW_DND
The "dnd" status. |
| <static> <constant> |
jabberwerx.Presence.SHOW_NORMAL
The "normal" status. |
| <static> <constant> |
jabberwerx.Presence.SHOW_XA
The "xa" status. |
- Fields borrowed from class jabberwerx.Stanza:
- ERR_BAD_REQUEST, ERR_CONFLICT, ERR_FEATURE_NOT_IMPLEMENTED, ERR_FORBIDDEN, ERR_INTERNAL_SERVER_ERROR, ERR_ITEM_NOT_FOUND, ERR_JID_MALFORMED, ERR_NOT_ACCEPTABLE, ERR_NOT_ALLOWED, ERR_NOT_AUTHORIZED, ERR_REMOTE_SERVER_TIMEOUT, ERR_SERVICE_UNAVAILABLE, timestamp
| Method Attributes | Method Name and Description |
|---|---|
|
compareTo(presence)
Compares this Presence to the given presence object for natural ordering. |
|
|
Retrieves the priority for this Presence. |
|
|
getShow()
Retrieves the show value for this Presence. |
|
|
Retrieves the status value for this Presence. |
|
|
setPresence(show, status, priority)
Sets show, status and priority via a single method call |
|
|
setPriority(pri)
Changes or removes the priority for this Presence. |
|
|
setShow(show)
Changes or removes the show value for this Presence. |
|
|
setStatus(status)
Changes or removes the status value for this Presence. |
- Methods borrowed from class jabberwerx.Stanza:
- clone, createWithNode, errorReply, getDoc, getErrorInfo, getFrom, getFromJID, getID, getNode, getTo, getToJID, getType, isError, pType, setFrom, setID, setTo, setType, swap, wasUnserialized, willBeSerialized, xml
Creates a new Presence object.
- Parameters:
- {Element} packet Optional
- The <presence/> element, or null for an empty Presence
- Throws:
- {TypeError}
- If {packet} is not an <presence/> element
The "away" status.
The "chat" status.
The "dnd" status.
The "normal" status.
The "xa" status.
Compares this Presence to the given presence object for natural ordering. The order is determined via:
- The <priority/> values
- The <show/> values
- The timestamps
A missing <priority/> value is equal to "0".
A missing <show/> value is equal to "" (normal).
- Parameters:
- {jabberwerx.Presence} presence
- Object to compare against
- Returns:
- {Integer} -1, 1, or 0 if this Presence is before, after, or in the same position as {presence}
Retrieves the priority for this Presence. This method returns the integer value for the <priority/> child element's text content, or 0 if none is available.
- Returns:
- {Number} The priority
Retrieves the show value for this Presence. This method returns the text content of the <show/> child eleemnt, or #.SHOW_NORMAL if none is available.
- Returns:
- {String} The show value
Retrieves the status value for this Presence. This method returns the text content of the <status/> child element, or null if none is available.
- Returns:
- {String} The show value
Sets show, status and priority via a single method call
- Parameters:
- {String} show Optional
- A status message
- {String} status Optional
- A status indicator
- {Integer} priority Optional
- A priority for this resource
- Returns:
- {jabberwerx.Presence} This updated presence stanza
Changes or removes the priority for this Presence.
- Parameters:
- {Number} pri Optional
- The new priority
- Throws:
- {TypeError}
- If {pri} is defined and not a number.
Changes or removes the show value for this Presence.
- Parameters:
- {String} show Optional
- The new show value
- Throws:
- {TypeError}
- If {show} is defined and not one of "away", "chat", "dnd", or "xa".
Changes or removes the status value for this Presence.
- Parameters:
- {String} status Optional
- The new status value