Skip to content
Back to top
View this page

# XEP-0115: Entity Capabilities

class slixmpp.plugins.xep_0115.XEP_0115(xmpp, config=None)

  XEP-0115: Entity Capabilities

  assign_verstring(jid=None, verstring=None)

    Assign a verification 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)

    Add caps to the cache.

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

    Return type:

      `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)

    Get caps for a JID.

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

  get_verstring(jid=None)

    Get the stored verstring for a JID.

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

    Return type:

      `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)

    Update caps for a local JID based on current data.

    Parameters:

      - jid (`str` | `JID` | `None`) – JID whose info to update

      - node (`str` | `None`) – 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': str | None, 'info': DiscoInfo | None}`)

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