Class Presence

  • All Implemented Interfaces:
    Element, FullyQualifiedElement, NamedElement, PresenceView, StanzaView, TopLevelStreamElement, XmlLangElement

    public final class Presence
    extends MessageOrPresence<PresenceBuilder>
    implements PresenceView
    Represents XMPP presence stanzas. Every presence stanza has a type, which is one of the following values:
    • available -- (Default) indicates the user is available to receive messages.
    • unavailable -- the user is unavailable to receive messages.
    • subscribe -- request subscription to recipient's presence.
    • subscribed -- grant subscription to sender's presence.
    • unsubscribe -- request removal of subscription to sender's presence.
    • unsubscribed -- grant removal of subscription to sender's presence.
    • error -- the presence stanza contains an error message.

    A number of attributes are optional:

    • Status -- free-form text describing a user's presence (i.e., gone to lunch).
    • Priority -- non-negative numerical priority of a sender's resource. The highest resource priority is the default recipient of packets not addressed to a particular resource.
    • Mode -- one of five presence modes: available (the default), chat, away, xa (extended away), and dnd (do not disturb).

    Presence stanzas are used for two purposes. First, to notify the server of the user's current presence status. Second, they are used to subscribe and unsubscribe users from the roster.