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. :rtype: Future

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

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

Add caps to the cache. :rtype: Future

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

default_config: ClassVar[Dict[str, Any]] = {'broadcast': True, 'cache': None, 'caps_node': None, 'hash': 'sha-1'}#

The basic, standard configuration for the plugin, which may be overridden when initializing the plugin. The configuration fields included here may be accessed directly as attributes of the plugin. For example, including the configuration field ‘foo’ would mean accessing plugin.foo returns the current value of plugin.config[‘foo’].

dependencies: ClassVar[Set[str]] = {'xep_0004', 'xep_0030', 'xep_0128'}#

Some plugins may depend on others in order to function properly. Any plugin names included in dependencies will be initialized as needed if this plugin is enabled.

description: str = 'XEP-0115: Entity Capabilities'#

A longer name for the plugin, describing its purpose. For example, a plugin for XEP-0030 would use ‘Service Discovery’ as its description value.

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. :rtype: Future

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

name: str = 'xep_0115'#

A short name for the plugin based on the implemented specification. For example, a plugin for XEP-0030 would use ‘xep_0030’.

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.

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.

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']