Presence Stanza#

class slixmpp.stanza.Presence(*args, recv=False, **kwargs)[source]#

XMPP’s <presence> stanza allows entities to know the status of other clients and components. Since it is currently the only multi-cast stanza in XMPP, many extensions add more information to <presence> stanzas to broadcast to every entry in the roster, such as capabilities, music choices, or locations (XEP-0115: Entity Capabilities and XEP-0163: Personal Eventing Protocol).

Since <presence> stanzas are broadcast when an XMPP entity changes its status, the bulk of the traffic in an XMPP network will be from <presence> stanzas. Therefore, do not include more information than necessary in a status message or within a <presence> stanza in order to help keep the network running smoothly.

Example <presence> stanzas:

<presence />

<presence from="">
  <status>Getting lunch.</status>

<presence type="unavailable" />

<presence to="" type="subscribe" />
Stanza Interface:
  • priority: A value used by servers to determine message routing.

  • show: The type of status, such as away or available for chat.

  • status: Custom, human readable status message.

  • types: One of: available, unavailable, error, probe, subscribe, subscribed, unsubscribe, and unsubscribed.

  • showtypes: One of: away, chat, dnd, and xa.


Remove both the type attribute and the <show> element.


Return the value of the <presence> element as an integer.

Return type:



Return the value of the <presence> stanza’s type attribute, or the value of the <show> element if valid.

Return type:


interfaces: ClassVar[Set[str]] = {'from', 'id', 'priority', 'show', 'status', 'to', 'type'}#

The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the plugin_attrib value of any registered stanza plugins.

lang_interfaces: ClassVar[Set[str]] = {'status'}#

New in version 1.1.2.

name: ClassVar[str] = 'presence'#

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace: str = 'jabber:client'#

The default XMPP client namespace

plugin_attrib: ClassVar[str] = 'presence'#

For ElementBase subclasses which are intended to be used as plugins, the plugin_attrib value defines the plugin name. Plugins may be accessed by using the plugin_attrib value as the interface. An example using plugin_attrib = 'foo':

register_stanza_plugin(Message, FooPlugin)
msg = Message()

Create a new reply <presence/> stanza from self.

Overrides StanzaBase.reply.


clear (bool) – Indicates if the stanza contents should be removed before replying. Defaults to True.


Set the entity’s priority value. Some server use priority to determine message routing behavior.

Bot clients should typically use a priority of 0 if the same JID is used elsewhere by a human-interacting client.


value (int) – An integer value greater than or equal to 0.


Set the value of the <show> element.


show (str) – Must be one of: away, chat, dnd, or xa.


Set the type attribute’s value, and the <show> element if applicable.


value (str) – Must be in either self.types or self.showtypes.

sub_interfaces: ClassVar[Set[str]] = {'priority', 'show', 'status'}#

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.