public abstract class AbstractPresence extends Stanza implements Comparable<AbstractPresence>
<presence/> element.
Please also refer to 4.7. Presence Syntax.The concept of presence refers to an entity's availability for communication over a network. At the most basic level, presence is a boolean "on/off" variable that signals whether an entity is available or unavailable for communication (the terms "online" and "offline" are also used). In XMPP, an entity's availability is signaled when its client generates a
<presence/>stanza with no 'type' attribute, and an entity's lack of availability is signaled when its client generates a<presence/>stanza whose 'type' attribute has a value of "unavailable".XMPP presence typically follows a "publish-subscribe" or "observer" pattern, wherein an entity sends presence to its server, and its server then broadcasts that information to all of the entity's contacts who have a subscription to the entity's presence (in the terminology of [IMP-MODEL], an entity that generates presence is a "presentity" and the entities that receive presence are "subscribers"). A client generates presence for broadcast to all subscribed entities by sending a presence stanza to its server with no 'to' address, where the presence stanza has either no 'type' attribute or a 'type' attribute whose value is "unavailable". This kind of presence is called "broadcast presence".
After a client completes the preconditions specified in [XMPP-CORE], it can establish a "presence session" at its server by sending initial presence, where the presence session is terminated by sending unavailable presence. For the duration of its presence session, a connected resource (in the terminology of [XMPP-CORE]) is said to be an "available resource".
In XMPP, applications that combine messaging and presence functionality, the default type of communication for which presence signals availability is messaging; however, it is not necessary for XMPP applications to combine messaging and presence functionality, and they can provide standalone presence features without messaging (in addition, XMPP servers do not require information about network availability in order to successfully route message and IQ stanzas).
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractPresence.Show
Represents a
<presence/> <show/> element. |
static class |
AbstractPresence.Status
The implementation of a presence's
<status/> element. |
static class |
AbstractPresence.Type
Represents a
<presence/> 'type' attribute. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(AbstractPresence o) |
<T> T |
getExtension(Class<T> type)
Gets an extension by type.
|
List<Object> |
getExtensions()
Gets all extensions.
|
Byte |
getPriority()
Gets the priority.
|
AbstractPresence.Show |
getShow()
Gets the
<show/> element. |
String |
getStatus()
Gets the default body (which has no language attribute).
|
List<AbstractPresence.Status> |
getStatuses()
Gets the statuses.
|
AbstractPresence.Type |
getType()
Gets the type of the presence.
|
boolean |
isAvailable()
Indicates, whether an entity is available.
|
void |
setPriority(Byte priority)
Deprecated.
Use constructor.
|
void |
setShow(AbstractPresence.Show show)
Deprecated.
Use constructor.
|
void |
setStatus(String text)
Deprecated.
Use constructor.
|
void |
setType(AbstractPresence.Type type)
Deprecated.
Use constructor.
|
String |
toString() |
createError, createError, getError, getFrom, getId, getLanguage, getTo, setError, setFrom, setId, setLanguage, setTo, withFrompublic final boolean isAvailable()
In XMPP, an entity's availability is signaled when its client generates a
<presence/>stanza with no 'type' attribute, and an entity's lack of availability is signaled when its client generates a<presence/>stanza whose 'type' attribute has a value of "unavailable".
public final AbstractPresence.Show getShow()
<show/> element.<show/> element.AbstractPresence.Show,
setShow(Show)@Deprecated public final void setShow(AbstractPresence.Show show)
<show/> element.show - The <show/> element.getShow()public final Byte getPriority()
The OPTIONAL
<priority/>element contains non-human-readable XML character data that specifies the priority level of the resource. The value MUST be an integer between -128 and +127.
setPriority(Byte)@Deprecated public final void setPriority(Byte priority)
priority - The priority.getPriority()public final AbstractPresence.Type getType()
AbstractPresence.Type,
setType(Type)@Deprecated public final void setType(AbstractPresence.Type type)
type - The type.getType()public final List<AbstractPresence.Status> getStatuses()
Multiple instances of the
<status/>element MAY be included, but only if each instance possesses an 'xml:lang' attribute with a distinct language value.
getStatus()public final String getStatus()
The OPTIONAL
<status/>element contains human-readable XML character data specifying a natural-language description of an entity's availability. It is normally used in conjunction with the show element to provide a detailed description of an availability state (e.g., "In a meeting") when the presence stanza has no 'type' attribute.
If there's no default status, but only statuses with a language attribute, the first status is returned.
If there are no statuses at all, null is returned.
getStatuses(),
setStatus(String)@Deprecated public final void setStatus(String text)
text - The status text.()public final List<Object> getExtensions()
public final <T> T getExtension(Class<T> type)
StanzagetExtension in class StanzaT - The type.type - The class.public final int compareTo(AbstractPresence o)
compareTo in interface Comparable<AbstractPresence>Copyright © 2014–2015 XMPP.rocks. All rights reserved.