XEP-0513: Intentional Mention Markup

XEP-0513 on xmpp.org

class slixmpp.plugins.xep_0513.XEP_0513(xmpp, config=None)[source]

This plugin adds support for XEP-0513: Intentional Mention Markup.

Mentions are carried in XEP-0394 markup spans. A mention event is emitted for each incoming message containing at least one mention.

stanza = <module 'slixmpp.plugins.xep_0513.stanza' from '/build/reproducible-path/slixmpp-1.18.0/slixmpp/plugins/xep_0513/stanza.py'>

Stanza elements

Stanza interfaces for XEP-0513: Intentional Mention Markup (v0.1.1)

Basic usage:

>>> register_plugin()  # automatically done if you use this plugin
>>> msg = Message()
>>> msg["body"] = "Hello, Alice!"
>>> msg["markup"]["span"]["start"] = 7
>>> msg["markup"]["span"]["end"] = 12
>>> msg["markup"]["span"]["mention"]["type"] = "occupant"
>>> msg["markup"]["span"]["mention"]["target"] = "alice@occupant-id"
>>> msg.pretty_print()
<message xmlns="jabber:client">
  <body>Hello, Alice!</body>
  <markup xmlns="urn:xmpp:markup:0">
    <span start="7" end="12">
      <mention xmlns="urn:xmpp:mentions:0" type="urn:xmpp:mentions:0#occupant" target="alice@occupant-id" />
    </span>
  </markup>
</message>
class slixmpp.plugins.xep_0513.stanza.Mention(xml=None, parent=None)[source]
get_active()[source]
Return type:

bool

get_target()[source]
Return type:

str | None

get_type()[source]
Return type:

str | None

interfaces: ClassVar[set[str]] = {'active', 'target', 'type'}

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

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 = 'urn:xmpp:mentions:0'

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

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']
plugin_multi_attrib: ClassVar[str] = 'mentions'

For ElementBase subclasses that are intended to be an iterable group of items, the plugin_multi_attrib value defines an interface for the parent stanza which returns the entire group of matching substanzas. So the following are equivalent:

# Given stanza class Foo, with plugin_multi_attrib = 'foos'
parent['foos']
filter(isinstance(item, Foo), parent['substanzas'])
set_active(active)[source]
Return type:

None

set_target(target)[source]
Return type:

None

set_type(value)[source]

Short names (“occupant”) expand to the full type URI.

Parameters:

value (Literal['occupant', 'channel', 'moderators', 'participants', 'visitors', 'owners', 'admins', 'members', 'none', 'hats'] | str)

Return type:

None

slixmpp.plugins.xep_0513.stanza.register_plugin()[source]
Return type:

None