Skip to content
Back to top
View this page

# XEP-0030: Service Discovery

class slixmpp.plugins.xep_0030.XEP_0030(xmpp, config=None)

  XEP-0030: Service Discovery

  Service discovery in XMPP allows entities to discover information about other agents in the network, such as the feature sets supported by a client, or signposts to other, related entities.

  Also see <http://www.xmpp.org/extensions/xep-0030.html>.

  The XEP-0030 plugin works using a hierarchy of dynamic node handlers, ranging from global handlers to specific JID+node handlers. The default set of handlers operate in a static manner, storing disco information in memory. However, custom handlers may use any available backend storage mechanism desired, such as SQLite or Redis.

  Node handler hierarchy:

  JID | Node | Level
  --- | --- | ---
  None | None | Global
  Given | None | All nodes for the JID
  None | Given | Node on self.xmpp.boundjid
  Given | Given | A single node

  Adding information for a given node without specifying the JID will use the bound JID and therefore must be done after the bind happens.

  Stream Handlers:

      Disco Info  -- Any Iq stanze that includes a query with the
                     namespace http://jabber.org/protocol/disco#info.
      Disco Items -- Any Iq stanze that includes a query with the
                     namespace http://jabber.org/protocol/disco#items.

  Events:

  - disco_info – Received a disco#info Iq query result.

  - disco_items – Received a disco#items Iq query result.

  Attributes:

  Variables:

    static – Object containing the default set of static node handlers.

  add_feature(feature, node=None, jid=None)

    Add a feature to a JID/node combination.

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

    Parameters:

      - feature (`str`) – The namespace of the supported feature.

      - node (`str` | `None`) – The node to modify.

      - jid (`JID` | `None`) – The JID to modify.

    Return type:

      `Future`

  add_identity(category='', itype='', name='', node=None, jid=None, lang=None)

    Add a new identity to the given JID/node combination.

    Each identity must be unique in terms of all four identity components: category, type, name, and language.

    Multiple, identical category/type pairs are allowed only if the xml:lang values are different. Likewise, multiple category/type/xml:lang pairs are allowed so long as the names are different. A category and type is always required.

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

    Parameters:

      - category (`str`) – The identity’s category.

      - itype (`str`) – The identity’s type.

      - name (`str`) – Optional name for the identity.

      - lang (`str` | `None`) – Optional two-letter language code.

      - node (`str` | `None`) – The node to modify.

      - jid (`JID` | `None`) – The JID to modify.

    Return type:

      `Future`

  add_item(jid='', name='', node=None, subnode='', ijid=None)

    Add a new item element to the given JID/node combination.

    Each item is required to have a JID, but may also specify a node value to reference non-addressable entities.

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

    Parameters:

      - jid (`str`) – The JID for the item.

      - name (`str`) – Optional name for the item.

      - node (`str` | `None`) – The node to modify.

      - subnode (`str`) – Optional node for the item.

      - ijid (`JID` | `None`) – The JID to modify.

    Return type:

      `Future`

  default_config: ClassVar[dict[str, Any]] = {'use_cache': True, 'wrap_results': False}

    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’].

  del_feature(jid=None, node=None, **kwargs)

    Remove a feature from a given JID/node combination.

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - feature – The feature’s namespace.

    Return type:

      `Future`

  del_features(jid=None, node=None, **kwargs)

    Remove all features from a JID/node combination.

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

    Return type:

      `Future`

  del_identities(jid=None, node=None, **kwargs)

    Remove all identities for a JID/node combination.

    If a language is specified, only identities using that language will be removed.

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - lang – Optional. If given, only remove identities using this xml:lang value.

    Return type:

      `Future`

  del_identity(jid=None, node=None, **kwargs)

    Remove an identity from the given JID/node combination.

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - category – The identity’s category.

      - itype – The identity’s type value.

      - name – Optional, human readable name for the identity.

      - lang – Optional, the identity’s xml:lang value.

    Return type:

      `Future`

  del_item(jid=None, node=None, **kwargs)

    Remove a single item from the given JID/node combination.

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - ijid – The item’s JID.

      - inode – The item’s node.

    Return type:

      `Future`

  del_items(jid=None, node=None, **kwargs)

    Remove all items from the given JID/node combination.

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

    Arguments: :type jid: `JID` | `None` :param jid: The JID to modify. :type node: `str` | `None` :param node: Optional node to modify.

    Return type:

      `Future`

  del_node_handler(htype, jid, node)

    Remove a handler type for a JID and node combination.

    The next handler in the hierarchy will be used if one exists. If removing the global handler, make sure that other handlers exist to process existing nodes.

    Node handler hierarchy:

    JID | Node | Level
    --- | --- | ---
    None | None | Global
    Given | None | All nodes for the JID
    None | Given | Node on self.xmpp.boundjid
    Given | Given | A single node

    Parameters:

      - htype (`str`) – The type of handler to remove.

      - jid (`JID` | `None`) – The JID from which to remove the handler.

      - node (`str` | `None`) – The node from which to remove the handler.

  dependencies: ClassVar[set[str]] = {}

    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-0030: Service Discovery'

    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_info(jid=None, node=None, local=None, cached=None, **kwargs)

    Retrieve the disco#info results from a given JID/node combination.

    Info may be retrieved from both local resources and remote agents; the local parameter indicates if the information should be gathered by executing the local node handlers, or if a disco#info stanza must be generated and sent.

    If requesting items from a local JID/node, then only a DiscoInfo stanza will be returned. Otherwise, an Iq stanza will be returned.

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

    Parameters:

      - jid (`JID` | `None`) – Request info from this JID.

      - node (`str` | `None`) – The particular node to query.

      - local (`bool` | `None`) – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remote JID to retrieve the info.

      - cached (`bool` | `None`) – If true, then look for the disco info data from the local cache system. If no results are found, send the query as usual. The self.use_cache setting must be set to true for this option to be useful. If set to false, then the cache will be skipped, even if a result has already been cached. Defaults to false.

    Return type:

      `Iq`

  async get_info_from_domain(domain=None, timeout=None, cached=True, callback=None, **iqkwargs)

    Fetch disco#info of specified domain and one disco#items level below

  async get_items(jid=None, node=None, local=False, iterator=False, ifrom=None, **kwargs)

    Retrieve the disco#items results from a given JID/node combination.

    Items may be retrieved from both local resources and remote agents; the local parameter indicates if the items should be gathered by executing the local node handlers, or if a disco#items stanza must be generated and sent.

    If requesting items from a local JID/node, then only a DiscoItems stanza will be returned. Otherwise, an Iq stanza will be returned.

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

    Parameters:

      - jid (`JID` | `None`) – Request info from this JID.

      - node (`str` | `None`) – The particular node to query.

      - local (`bool`) – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remove JID to retrieve the items.

      - iterator (`bool`) – If True, return a result set iterator using the XEP-0059 plugin, if the plugin is loaded. Otherwise the parameter is ignored.

    Return type:

      `Iq`

  has_identity(jid=None, node=None, category=None, itype=None, lang=None, local=False, cached=True, ifrom=None)

    Check if a JID provides a given identity.

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

    Parameters:

      - jid (`JID` | `None`) – Request info from this JID.

      - node (`str` | `None`) – The particular node to query.

      - category (`str` | `None`) – The category of the identity to check.

      - itype (`str` | `None`) – The type of the identity to check.

      - lang (`str` | `None`) – The language of the identity to check.

      - local (`bool`) – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remove JID to retrieve the info.

      - cached (`bool`) – If true, then look for the disco info data from the local cache system. If no results are found, send the query as usual. The self.use_cache setting must be set to true for this option to be useful. If set to false, then the cache will be skipped, even if a result has already been cached. Defaults to false.

    Returns True:

      The identity is provided

    Returns False:

      The identity is not listed

    Returns None:

      Nothing could be found due to a timeout

    Return type:

      `Future`

  name: str = 'xep_0030'

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

  restore_defaults(jid=None, node=None, handlers=None)

    Change all or some of a node’s handlers to the default handlers. Useful for manually overriding the contents of a node that would otherwise be handled by a JID level or global level dynamic handler.

    The default is to use the built-in static handlers, but that may be changed by modifying self.default_handlers.

    Parameters:

      - jid (`JID` | `None`) – The JID owning the node to modify.

      - node (`str` | `None`) – The node to change to using static handlers.

      - handlers (`list`[`Callable`] | `None`) – Optional list of handlers to change to the default version. If provided, only these handlers will be changed. Otherwise, all handlers will use the default version.

  set_features(jid=None, node=None, **kwargs)

    Add or replace the set of supported features for a JID/node combination.

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - features – The new set of supported features.

    Return type:

      `Future`

  set_identities(jid=None, node=None, **kwargs)

    Add or replace all identities for the given JID/node combination.

    The identities must be in a set where each identity is a tuple of the form: (category, type, lang, name)

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – The node to modify.

      - identities – A set of identities in tuple form.

      - lang – Optional, xml:lang value.

    Return type:

      `Future`

  set_info(jid=None, node=None, info=None)

    Set the disco#info data for a JID/node based on an existing disco#info stanza.

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

    Return type:

      `Future`

  set_items(jid=None, node=None, **kwargs)

    Set or replace all items for the specified JID/node combination.

    The given items must be in a list or set where each item is a tuple of the form: (jid, node, name).

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

    Parameters:

      - jid (`JID` | `None`) – The JID to modify.

      - node (`str` | `None`) – Optional node to modify.

      - items – A series of items in tuple format.

    Return type:

      `Future`

  set_node_handler(htype, jid=None, node=None, handler=None)

    Add a node handler for the given hierarchy level and handler type.

    Node handlers are ordered in a hierarchy where the most specific handler is executed. Thus, a fallback, global handler can be used for the majority of cases with a few node specific handler that override the global behavior.

    Node handler hierarchy:

    JID | Node | Level
    --- | --- | ---
    None | None | Global
    Given | None | All nodes for the JID
    None | Given | Node on self.xmpp.boundjid
    Given | Given | A single node

    Handler types:

        get_info
        get_items
        set_identities
        set_features
        set_items
        del_items
        del_identities
        del_identity
        del_feature
        del_features
        del_item
        add_identity
        add_feature
        add_item

    Parameters:

      - htype (`str`) – The operation provided by the handler.

      - jid (`JID` | `None`) – The JID the handler applies to. May be narrowed further if a node is given.

      - node (`str` | `None`) – The particular node the handler is for. If no JID is given, then the self.xmpp.boundjid.full is assumed.

      - handler (`Callable` | `None`) – The handler function to use.

  supports(jid=None, node=None, feature=None, local=False, cached=True, ifrom=None)

    Check if a JID supports a given feature.

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

    Parameters:

      - jid (`JID` | `None`) – Request info from this JID.

      - node (`str` | `None`) – The particular node to query.

      - feature (`str` | `None`) – The name of the feature to check.

      - local (`bool`) – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remove JID to retrieve the info.

      - cached (`bool`) – If true, then look for the disco info data from the local cache system. If no results are found, send the query as usual. The self.use_cache setting must be set to true for this option to be useful. If set to false, then the cache will be skipped, even if a result has already been cached. Defaults to false.

    Returns True:

      The feature is supported

    Returns False:

      The feature is not listed as supported

    Returns None:

      Nothing could be found due to a timeout

    Return type:

      `Future`

## Internal API Methods

All `api` operations supported by the 0030 plugin are implemented as part of the `StaticDisco` class which implement an in-memory cache for disco info and items.

class slixmpp.plugins.xep_0030.static.NodeType

class slixmpp.plugins.xep_0030.static.StaticDisco(xmpp, disco)

  While components will likely require fully dynamic handling of service discovery information, most clients and simple bots only need to manage a few disco nodes that will remain mostly static.

  StaticDisco provides a set of node handlers that will store static sets of disco info and items in memory.

  Variables:

    - nodes – A dictionary mapping (JID, node) tuples to a dict containing a disco#info and a disco#items stanza.

    - xmpp – The main Slixmpp object.

    - disco – The instance of the XEP-0030 plugin.

  async supports(jid, node, ifrom, data)

    Check if a JID supports a given feature.

    The data parameter may provide:

    Parameters:

      - feature – The feature to check for support.

      - local – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remove JID to retrieve the info.

      - cached – If true, then look for the disco info data from the local cache system. If no results are found, send the query as usual. The self.use_cache setting must be set to true for this option to be useful. If set to false, then the cache will be skipped, even if a result has already been cached. Defaults to false.

    Return type:

      `bool` | `None`

  async has_identity(jid, node, ifrom, data)

    Check if a JID has a given identity.

    The data parameter may provide:

    Parameters:

      - category – The category of the identity to check.

      - itype – The type of the identity to check.

      - lang – The language of the identity to check.

      - local – If true, then the query is for a JID/node combination handled by this Slixmpp instance and no stanzas need to be sent. Otherwise, a disco stanza must be sent to the remove JID to retrieve the info.

      - cached – If true, then look for the disco info data from the local cache system. If no results are found, send the query as usual. The self.use_cache setting must be set to true for this option to be useful. If set to false, then the cache will be skipped, even if a result has already been cached. Defaults to false.

    Return type:

      `bool` | `None`

  get_info(jid, node, ifrom, data)

    Return the stored info data for the requested JID/node combination.

    The data parameter is not used.

    Return type:

      `DiscoInfo` | `None`

  set_info(jid, node, ifrom, data)

    Set the entire info stanza for a JID/node at once.

    The data parameter is a disco#info substanza.

  del_info(jid, node, ifrom, data)

    Reset the info stanza for a given JID/node combination.

    The data parameter is not used.

  get_items(jid, node, ifrom, data)

    Return the stored items data for the requested JID/node combination.

    The data parameter is not used.

    Return type:

      `DiscoItems` | `None`

  set_items(jid, node, ifrom, data)

    Replace the stored items data for a JID/node combination.

    The data parameter may provide:

      items – A set of items in tuple format.

  del_items(jid, node, ifrom, data)

    Reset the items stanza for a given JID/node combination.

    The data parameter is not used.

  add_identity(jid, node, ifrom, data)

    Add a new identity to the JID/node combination.

    The data parameter may provide:

    Parameters:

      - category – The general category to which the agent belongs.

      - itype – A more specific designation with the category.

      - name – Optional human readable name for this identity.

      - lang – Optional standard xml:lang value.

  set_identities(jid, node, ifrom, data)

    Add or replace all identities for a JID/node combination.

    The data parameter should include:

    Parameters:

      identities – A list of identities in tuple form: (category, type, name, lang)

  del_identity(jid, node, ifrom, data)

    Remove an identity from a JID/node combination.

    The data parameter may provide:

    Parameters:

      - category – The general category to which the agent belonged.

      - itype – A more specific designation with the category.

      - name – Optional human readable name for this identity.

      - lang – Optional, standard xml:lang value.

  del_identities(jid, node, ifrom, data)

    Remove all identities from a JID/node combination.

    The data parameter is not used.

  add_feature(jid, node, ifrom, data)

    Add a feature to a JID/node combination.

    The data parameter should include:

    Parameters:

      feature – The namespace of the supported feature.

  set_features(jid, node, ifrom, data)

    Add or replace all features for a JID/node combination.

    The data parameter should include:

    Parameters:

      features – The new set of supported features.

  del_feature(jid, node, ifrom, data)

    Remove a feature from a JID/node combination.

    The data parameter should include:

    Parameters:

      feature – The namespace of the removed feature.

  del_features(jid, node, ifrom, data)

    Remove all features from a JID/node combination.

    The data parameter is not used.

  add_item(jid, node, ifrom, data)

    Add an item to a JID/node combination.

    The data parameter may include:

    Parameters:

      - ijid – The JID for the item.

      - inode – Optional additional information to reference non-addressable items.

      - name – Optional human readable name for the item.

  del_item(jid, node, ifrom, data)

    Remove an item from a JID/node combination.

    The data parameter may include:

    Parameters:

      - ijid – JID of the item to remove.

      - inode – Optional extra identifying information.

  cache_info(jid, node, ifrom, data)

    Cache disco information for an external JID.

    The data parameter is the Iq result stanza containing the disco info to cache, or the disco#info substanza itself.

  get_cached_info(jid, node, ifrom, data)

    Retrieve cached disco info data.

    The data parameter is not used.

    Return type:

      `DiscoInfo` | `None`

## Stanza elements

class slixmpp.plugins.xep_0030.stanza.info.DiscoInfo(xml=None, parent=None)

  XMPP allows for users and agents to find the identities and features supported by other entities in the XMPP network through service discovery, or “disco”. In particular, the “disco#info” query type for <iq> stanzas is used to request the list of identities and features offered by a JID.

  An identity is a combination of a category and type, such as the ‘client’ category with a type of ‘pc’ to indicate the agent is a human operated client with a GUI, or a category of ‘gateway’ with a type of ‘aim’ to identify the agent as a gateway for the legacy AIM protocol. See XMPP Registrar Disco Categories for a full list of accepted category and type combinations.

  Features are simply a set of the namespaces that identify the supported features. For example, a client that supports service discovery will include the feature `http://jabber.org/protocol/disco#info`.

  Since clients and components may operate in several roles at once, identity and feature information may be grouped into “nodes”. If one were to write all of the identities and features used by a client, then node names would be like section headings.

  Example disco#info stanza:

      <iq type="get">
        <query xmlns="http://jabber.org/protocol/disco#info" />
      </iq>

      <iq type="result">
        <query xmlns="http://jabber.org/protocol/disco#info">
          <identity category="client" type="bot" name="Slixmpp Bot" />
          <feature var="http://jabber.org/protocol/disco#info" />
          <feature var="jabber:x:data" />
          <feature var="urn:xmpp:ping" />
        </query>
      </iq>

  name: ClassVar[str] = 'query'

    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/disco#info'

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

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

  interfaces: ClassVar[set[str]] = {'features', 'identities', 'node'}

    Stanza interfaces:

    - `node`: The name of the node to either query or return the info from

    - `identities`: A set of 4-tuples, where each tuple contains the category, type, xml:lang and name of an identity

    - `features`: A set of namespaces for features

  lang_interfaces: ClassVar[set[str]] = {'identities'}

    Added in version 1.1.2.

  setup(xml=None)

    Populate the stanza object using an optional XML object.

    Overrides ElementBase.setup

    Caches identity and feature information.

    Parameters:

      xml (`ElementTree` | `None`) – Use an existing XML object for the stanza’s values.

  add_identity(category, itype, name=None, lang=None)

    Add a new identity element. Each identity must be unique in terms of all four identity components.

    Multiple, identical category/type pairs are allowed only if the xml:lang values are different. Likewise, multiple category/type/xml:lang pairs are allowed so long as the names are different. In any case, a category and type are required.

    Parameters:

      - category (`str`) – The general category to which the agent belongs.

      - itype (`str`) – A more specific designation with the category.

      - name (`str` | `None`) – Optional human readable name for this identity.

      - lang (`str` | `None`) – Optional standard xml:lang value.

    Return type:

      `bool`

  del_identity(category, itype, name=None, lang=None)

    Remove a given identity.

    Parameters:

      - category (`str`) – The general category to which the agent belonged.

      - itype (`str`) – A more specific designation with the category.

      - name – Optional human readable name for this identity.

      - lang (`str` | `None`) – Optional, standard xml:lang value.

    Return type:

      `bool`

  dict_identities(lang=None)

    Return the list of all identities, each one as a dict with category, type, xml_lang, and name keys.

    Parameters:

      lang (`str` | `None`) – If there is a need to filter identities by lang.

    Return type:

      `list`[`dict`[`str`, `str`]]

  get_identities(lang=None, dedupe=True)

    Return a set of all identities in tuple form as so:

    > (category, type, lang, name)

    If a language was specified, only return identities using that language.

    Parameters:

      - lang (`str` | `None`) – Optional, standard xml:lang value.

      - dedupe (`bool`) – If True, de-duplicate identities, otherwise return a list of all identities.

    Return type:

      `Iterable`[`tuple`[`str`, `str`, `str` | `None`, `str` | `None`]]

  set_identities(identities, lang=None)

    Add or replace all identities. The identities must be a in set where each identity is a tuple of the form:

    > (category, type, lang, name)

    If a language is specified, any identities using that language will be removed to be replaced with the given identities.

    Note

    An identity’s language will not be changed regardless of the value of lang.

    Parameters:

      - identities (`Iterable`[`tuple`[`str`, `str`, `str` | `None`, `str` | `None`]]) – A set of identities in tuple form.

      - lang (`str` | `None`) – Optional, standard xml:lang value.

  del_identities(lang=None)

    Remove all identities. If a language was specified, only remove identities using that language.

    Parameters:

      lang (`str` | `None`) – Optional, standard xml:lang value.

  add_feature(feature)

    Add a single, new feature.

    Parameters:

      feature (`str`) – The namespace of the supported feature.

    Return type:

      `bool`

  del_feature(feature)

    Remove a single feature.

    Parameters:

      feature (`str`) – The namespace of the removed feature.

    Return type:

      `bool`

  get_features(dedupe=True)

    Return the set of all supported features.

    Return type:

      `Iterable`[`str`]

  set_features(features)

    Add or replace the set of supported features.

    Parameters:

      features (`Iterable`[`str`]) – The new set of supported features.

  del_features()

    Remove all features.

class slixmpp.plugins.xep_0030.stanza.items.DiscoItem(xml=None, parent=None)
  name: ClassVar[str] = 'item'

    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/disco#items'

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

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

  interfaces: ClassVar[set[str]] = {'jid', 'name', 'node'}

    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.

  get_node()

    Return the item’s node name or `None`.

    Return type:

      `str` | `None`

  get_name()

    Return the item’s human readable name, or `None`.

    Return type:

      `str` | `None`

class slixmpp.plugins.xep_0030.stanza.items.DiscoItems(xml=None, parent=None)

  Example disco#items stanzas:

      <iq type="get">
        <query xmlns="http://jabber.org/protocol/disco#items" />
      </iq>

      <iq type="result">
        <query xmlns="http://jabber.org/protocol/disco#items">
          <item jid="chat.example.com"
                node="xmppdev"
                name="XMPP Dev" />
          <item jid="chat.example.com"
                node="slixdev"
                name="Slixmpp Dev" />
        </query>
      </iq>

  name: ClassVar[str] = 'query'

    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/disco#items'

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

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

  interfaces: ClassVar[set[str]] = {'items', 'node'}

    Stanza Interface:

    - `node`: The name of the node to either query or return info from.

    - `items`: A list of 3-tuples, where each tuple contains the JID, node, and name of an item.

  setup(xml=None)

    Populate the stanza object using an optional XML object.

    Overrides ElementBase.setup

    Caches item information.

    Parameters:

      xml (`ElementTree` | `None`) – Use an existing XML object for the stanza’s values.

  add_item(jid, node=None, name=None)

    Add a new item element. Each item is required to have a JID, but may also specify a node value to reference non-addressable entities.

    Parameters:

      - jid (`JID`) – The JID for the item.

      - node (`str` | `None`) – Optional additional information to reference non-addressable items.

      - name (`str` | `None`) – Optional human readable name for the item.

  del_item(jid, node=None)

    Remove a single item.

    Parameters:

      - jid (`JID`) – JID of the item to remove.

      - node (`str` | `None`) – Optional extra identifying information.

    Return type:

      `bool`

  get_items()

    Return all items.

    Return type:

      `set`[`DiscoItem`]

  set_items(items)

    Set or replace all items. The given items must be in a list or set where each item is a tuple of the form:

    > (jid, node, name)

    Parameters:

      items (`Iterable`[`DiscoItem`]) – A series of items in tuple format.

  del_items()

    Remove all items.

  plugin_attrib_map: ClassVar[dict[str, type[ElementBase]]] = {'item': <class 'slixmpp.plugins.xep_0030.stanza.items.DiscoItem'>}

    A mapping of the `plugin_attrib` values of registered plugins to their respective classes.

  plugin_iterables: ClassVar[set[type[ElementBase]]] = {<class 'slixmpp.plugins.xep_0030.stanza.items.DiscoItem'>}

    The set of stanza classes that can be iterated over using the ‘substanzas’ interface. Classes are added to this set when registering a plugin with `iterable=True`:

        register_stanza_plugin(DiscoInfo, DiscoItem, iterable=True)

    Added in version 1.0-Beta5.

  plugin_overrides: ClassVar[dict[str, str]] = {}

    A map of interface operations to the overriding functions. For example, after overriding the `set` operation for the interface `body`, `plugin_overrides` would be:

        {'set_body': <some function>}

  plugin_tag_map: ClassVar[dict[str, type[ElementBase]]] = {'{http://jabber.org/protocol/disco#items}item': <class 'slixmpp.plugins.xep_0030.stanza.items.DiscoItem'>}

    A mapping of root element tag names (in `'{namespace}elementname'` format) to the plugin classes responsible for them.