XEP 0045

1.7 Documentation

«  XEP 0033   ::   Contents   ::   XEP 0047  »

XEP 0045

class slixmpp.plugins.xep_0045.XEP_0045(xmpp, config=None)[source]

Implements XEP-0045 Multi-User Chat

async cancel_config(room, *, ifrom=None, **iqkwargs)[source]

Cancel a requested config form

Return type

Iq

client_handle_presence(pr)[source]

As a client, handle a presence stanza

decline(room, jid, reason='', *, mfrom=None)[source]

Decline a mediated invitation.

async destroy(room, reason='', altroom='', *, ifrom=None, **iqkwargs)[source]

Destroy a room.

async get_affiliation_list(room, affiliation, *, ifrom=None, **iqkwargs)[source]

“Get a list of JIDs with the specified affiliation

Return type

List[JID]

get_jid_property(room, nick, jid_property)[source]

Get the property of a nick in a room, such as its ‘jid’ or ‘affiliation’ If not found, return None.

get_our_jid_in_room(room_jid)[source]

Return the jid we’re using in a room.

Return type

str

async get_roles_list(room, role, *, ifrom=None, **iqkwargs)[source]

“Get a list of JIDs with the specified role

Return type

List[str]

async get_room_config(room, ifrom='')[source]

Get the room config form in 0004 plugin format

get_roster(room)[source]

Get the list of nicks in a room.

Return type

List[str]

handle_config_change(msg)[source]

Handle a MUC configuration change (with status code).

handle_groupchat_decline(decl)[source]

Handle an invitation decline.

handle_groupchat_error_message(msg)[source]

Handle a message error event in a muc.

handle_groupchat_invite(inv)[source]

Handle an invite into a muc.

handle_groupchat_join(pr)[source]

Received a join presence (as a component)

handle_groupchat_message(msg)[source]

Handle a message event in a muc.

Return type

None

handle_groupchat_presence(pr)[source]

Handle a presence in a muc.

handle_groupchat_subject(msg)[source]

Handle a message coming from a muc indicating a change of subject (or announcing it when joining the room)

Return type

None

invite(room, jid, reason='', *, mfrom=None)[source]

Invite a jid to a room.

join_muc(room, nick, maxhistory='0', password='', pstatus='', pshow='', pfrom='')[source]

Join the specified room, requesting ‘maxhistory’ lines of history.

leave_muc(room, nick, msg='', pfrom=None)[source]

Leave the specified room.

async send_affiliation_list(room, affiliations, *, ifrom=None, **iqkwargs)[source]

Send an affiliation delta list

Return type

Iq

async send_role_list(room, roles, *, ifrom=None, **iqkwargs)[source]

Send a role delta list

Return type

Iq

async set_affiliation(room, affiliation, *, jid=None, nick=None, reason='', ifrom=None, **iqkwargs)[source]

Change room affiliation.

async set_role(room, nick, role, *, reason='', ifrom=None, **iqkwargs)[source]

Change role property of a nick in a room. Typically, roles are temporary (they last only as long as you are in the room), whereas affiliations are permanent (they last across groupchat sessions).

async set_room_config(room, config, *, ifrom=None, **iqkwargs)[source]

Send a room config form

Return type

Iq

set_subject(room, subject, *, mfrom=None)[source]

Set a room’s subject.

stanza = <module 'slixmpp.plugins.xep_0045.stanza' from '/home/docs/checkouts/readthedocs.org/user_builds/slixmpp/checkouts/slix-1.7.1/slixmpp/plugins/xep_0045/stanza.py'>

Stanza elements

Slixmpp: The Slick XMPP Library Copyright (C) 2010 Nathanael C. Fritz Copyright (C) 2020 “Maxime “pep” Buquet <pep@bouah.net>” This file is part of Slixmpp.

See the file LICENSE for copying permission.

class slixmpp.plugins.xep_0045.stanza.MUCActor(xml=None, parent=None)[source]
get_jid()[source]
Return type

Optional[JID]

interfaces = {'jid', 'nick'}

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 = 'actor'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc#user'

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 = 'actor'

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']
class slixmpp.plugins.xep_0045.stanza.MUCAdminItem(xml=None, parent=None)[source]
interfaces = {'affiliation', 'jid', 'nick', 'reason', 'role'}

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 = '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 = 'http://jabber.org/protocol/muc#admin'

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 = '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']
sub_interfaces = {'reason'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

class slixmpp.plugins.xep_0045.stanza.MUCAdminQuery(xml=None, parent=None)[source]
name = '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 = 'http://jabber.org/protocol/muc#admin'

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 = 'mucadmin_query'

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']
class slixmpp.plugins.xep_0045.stanza.MUCBase(xml=None, parent=None)[source]
del_affiliation()[source]
del_item_attr(attr)[source]
del_jid()[source]
del_nick()[source]
del_role()[source]
del_room()[source]
del_status_codes()[source]
get_affiliation()[source]
get_item_attr(attr, default)[source]
get_jid()[source]
Return type

JID

get_nick()[source]
Return type

str

get_role()[source]
Return type

str

get_room()[source]
Return type

str

get_status_codes()[source]
Return type

Set[str]

interfaces = {'affiliation', 'jid', 'nick', 'role', 'room', 'status_codes'}

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 = 'x'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc#user'

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 = 'muc'

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']
set_affiliation(value)[source]
set_item_attr(attr, value)[source]
set_jid(value)[source]
set_nick(value)[source]
set_role(value)[source]
set_room(value)[source]
set_status_codes(codes)[source]
class slixmpp.plugins.xep_0045.stanza.MUCDecline(xml=None, parent=None)[source]
interfaces = {'from', 'reason', 'to'}

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 = 'decline'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc#user'

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 = 'decline'

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']
sub_interfaces = {'reason'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

class slixmpp.plugins.xep_0045.stanza.MUCHistory(xml=None, parent=None)[source]
interfaces = {'maxchars', 'maxstanzas', 'seconds', 'since'}

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 = 'history'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc'

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 = 'history'

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']
class slixmpp.plugins.xep_0045.stanza.MUCInvite(xml=None, parent=None)[source]
interfaces = {'from', 'reason', 'to'}

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 = 'invite'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc#user'

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 = 'invite'

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']
sub_interfaces = {'reason'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

class slixmpp.plugins.xep_0045.stanza.MUCJoin(xml=None, parent=None)[source]
interfaces = {'password'}

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 = 'x'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc'

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 = 'muc_join'

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']
sub_interfaces = {'password'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

class slixmpp.plugins.xep_0045.stanza.MUCMessage(xml=None, parent=None)[source]

A MUC Message

<message from='foo@muc/user1' type='groupchat' id='someid'>
    <body>Foo</body>
    <x xmlns='http://jabber.org/protocol/muc#user'>
        <item affiliation='none'
              role='none'
              nick='newnick2'
              jid='some@jid'/>
    </x>
</message>
class slixmpp.plugins.xep_0045.stanza.MUCOwnerDestroy(xml=None, parent=None)[source]
interfaces = {'jid', 'reason'}

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 = 'destroy'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

plugin_attrib = 'destroy'

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']
sub_interfaces = {'reason'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

class slixmpp.plugins.xep_0045.stanza.MUCOwnerQuery(xml=None, parent=None)[source]
name = '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 = 'http://jabber.org/protocol/muc#owner'

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 = 'mucowner_query'

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']
class slixmpp.plugins.xep_0045.stanza.MUCPresence(xml=None, parent=None)[source]

A MUC Presence

<presence from='foo@muc/user1' type='unavailable'>
    <x xmlns='http://jabber.org/protocol/muc#user'>
        <item affiliation='none'
              role='none'
              nick='newnick2'
              jid='some@jid'/>
        <status code='303'/>
    </x>
</presence>
class slixmpp.plugins.xep_0045.stanza.MUCStatus(xml=None, parent=None)[source]
interfaces = {'code'}

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 = 'status'

The XML tag name of the element, not including any namespace prefixes. For example, an ElementBase object for <message /> would use name = 'message'.

namespace = 'http://jabber.org/protocol/muc#user'

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 = 'status'

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']
set_code(code)[source]
class slixmpp.plugins.xep_0045.stanza.MUCUserItem(xml=None, parent=None)[source]
get_jid()[source]
Return type

Optional[JID]

interfaces = {'affiliation', 'jid', 'nick', 'reason', 'role'}

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 = '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 = 'http://jabber.org/protocol/muc#user'

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 = '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']
sub_interfaces = {'reason'}

A subset of interfaces which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.

«  XEP 0033   ::   Contents   ::   XEP 0047  »