XEP-0115: Entity Capabilities#

class slixmpp.plugins.xep_0115.XEP_0115(xmpp, config=None)[source]#

XEP-0115: Entity Capabilities

assign_verstring(jid=None, verstring=None)[source]#

Assign a vertification string to a jid.

Changed in version 1.8.0: This function now returns a Future.

Return type

Future

cache_caps(verstring=None, info=None)[source]#

Add caps to the cache.

Changed in version 1.8.0: This function now returns a Future.

Return type

Future

async get_caps(jid=None, verstring=None)[source]#

Get caps for a JID.

Changed in version 1.8.0: This function is now a coroutine.

get_verstring(jid=None)[source]#

Get the stored verstring for a JID.

Changed in version 1.8.0: This function now returns a Future.

Return type

Future

async update_caps(jid=None, node=None, preserve=False, broadcast=True)[source]#

Update caps for a local JID based on current data.

Parameters
  • jid (Union[str, JID, None]) – JID whose info to update

  • node (Optional[str]) – Node to fetch info from

  • broadcast (bool) – Send a presence after updating.

  • preserve (bool) – Send presence only to contacts found in the roster.

Internal API methods#

This internal API extends the Disco internal API, and also manages an in-memory cache of verstring→disco info, and fulljid→verstring.

cache_caps#
  • jid: unused

  • node: unused

  • ifrom: unused

  • args: a dict containing the verstring and DiscoInfo payload ( {'verstring': Optional[str], 'info': Optional[DiscoInfo]})

Cache a verification string with its payload.

get_caps#
  • jid: JID to retrieve the verstring for (unused with the default handler)

  • node: unused

  • ifrom: unused

  • args: a dict containing the verstring {'verstring': str}

  • returns: The DiscoInfo payload for that verstring.

Get a disco payload from a verstring.

assign_verstring#
  • jid: JID (full) to assign the verstring to

  • node: unused

  • ifrom: unused

  • args: a dict containing the verstring {'verstring': str}

Cache JID→verstring information.

get_verstring#
  • jid: JID to use for fetching the verstring

  • node: unused

  • ifrom: unused

  • args: unused

  • returns: str, the verstring

Retrieve a verstring for a JID.

Stanza elements#

class slixmpp.plugins.xep_0115.stanza.Capabilities(xml=None, parent=None)[source]#
interfaces: ClassVar[Set[str]] = {'ext', 'hash', 'node', 'ver'}#

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.

iterables: List[ElementBase]#

A list of child stanzas whose class is included in plugin_iterables.

loaded_plugins: Set[str]#
name: ClassVar[str] = 'c'#

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 = 'http://jabber.org/protocol/caps'#

The XML namespace for the element. Given <foo xmlns="bar" />, then namespace = "bar" should be used. The default namespace is jabber:client since this is being used in an XMPP library.

parent: Optional[ReferenceType[ElementBase]]#

A weakref.weakref to the parent stanza, if there is one. If not, then parent is None.

plugin_attrib: ClassVar[str] = 'caps'#

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()
msg['foo']['an_interface_from_the_foo_plugin']
plugins: Dict[Tuple[str, Optional[str]], ElementBase]#

An ordered dictionary of plugin stanzas, mapped by their plugin_attrib value.

tag: str#

The name of the tag for the stanza’s root element. It is the same as calling tag_name() and is formatted as '{namespace}elementname'.

xml: ET.Element#

The underlying XML object for the stanza. It is a standard xml.etree.ElementTree object.