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="user@example.com"> <show>away</show> <status>Getting lunch.</status> <priority>5</priority> </presence> <presence type="unavailable" /> <presence to="user@otherhost.com" 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.
- Attributes:
types: One of: available, unavailable, error, probe, subscribe, subscribed, unsubscribe, and unsubscribed.
showtypes: One of: away, chat, dnd, and xa.
- get_type()[source]#
Return the value of the <presence> stanza’s type attribute, or the value of the <show> element if valid.
- Return type
str
- reply(clear=True)[source]#
Create a new reply <presence/> stanza from
self
.Overrides StanzaBase.reply.
- Parameters
clear (bool) – Indicates if the stanza contents should be removed before replying. Defaults to True.
- set_priority(value)[source]#
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.
- Parameters
value (int) – An integer value greater than or equal to 0.