XEP-0421: Anonymous unique occupant identifiers for MUCs#

class slixmpp.plugins.xep_0421.XEP_0421(xmpp, config=None)[source]#

XEP-0421: Anonymous unique occupant identifiers for MUCs

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

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-0421: Anonymous unique occupant identifiers for MUCs'#

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

name: str = 'xep_0421'#

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

Stanza elements#

class slixmpp.plugins.xep_0421.stanza.OccupantId(xml=None, parent=None)[source]#

An Occupant-id tag.

An <occupant-id/> tag is set by the MUC.

This is useful in semi-anon MUCs (and MUC-PMs) as a stable identifier to prevent the usual races with nicknames.

Without occupant-id, getting the following messages from MUC history would prevent a client from asserting senders are the same entity:

<message type='groupchat' from='foo@muc/nick1' id='message1'>
    <body>Some message</body>
    <occupant-id xmlns='urn:xmpp:occupant-id:0' id='unique-opaque-id1'/>
</message>
<message type='groupchat' from='foo@muc/nick2' id='message2'>
    <body>Some correction</body>
    <occupant-id xmlns='urn:xmpp:occupant-id:0' id='unique-opaque-id1'/>
    <replace xmlns='urn:xmpp:message-correct:0' id='message1'/>
</message>
interface = {'id'}#
name: ClassVar[str] = 'occupant-id'#

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:occupant-id: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] = 'occupant-id'#

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