XEP-0045: Multi-User Chat#
- class slixmpp.plugins.xep_0045.XEP_0045(xmpp, config=None)[source]#
XEP-0045 Multi-User Chat
- name: str = 'xep_0045'#
A short name for the plugin based on the implemented specification. For example, a plugin for XEP-0030 would use ‘xep_0030’.
- description: str = 'XEP-0045: Multi-User Chat'#
A longer name for the plugin, describing its purpose. For example, a plugin for XEP-0030 would use ‘Service Discovery’ as its description value.
- dependencies: ClassVar[Set[str]] = {'xep_0004', 'xep_0030', 'xep_0203'}#
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.
- async join_muc_wait(room, nick, *, password=None, maxchars=None, maxstanzas=None, seconds=None, since=None, presence_options=None, timeout=None)[source]#
Try to join a MUC and block until we are joined or get an error.
Only one of {maxchars, maxstanzas, seconds, since} will be used, in that order.
New in version 1.8.0.
- Parameters:
password (
Optional
[str
]) – The optional room password.maxchars (
Optional
[int
]) – Max number of characters to return from history.maxstanzas (
Optional
[int
]) – Max number of stanzas to return from history.seconds (
Optional
[int
]) – Fetch history until that many seconds in the past.since (
Optional
[datetime
]) – Fetch history since that timestamp.timeout (
Optional
[int
]) – Timeout after which a TimeoutError is raised. None means no timeout.
- Raises:
A slixmpp.exceptions.PresenceError if the MUC returns a presence error.
- Raises:
An asyncio.TimeoutError if there is neither success nor presence error when the timeout is reached.
- Return type:
- Returns:
A tuple containing our own presence, the subject, a list of occupants and a list of history messages.
- join_muc(room, nick, maxhistory='0', password='', pstatus='', pshow='', pfrom='')[source]#
Join the specified room, requesting ‘maxhistory’ lines of history. :rtype:
Future
Deprecated since version 1.8.0:
join_muc_wait()
will replace this old API starting from version 1.9.0.
- leave_muc(room, nick, msg='', pfrom=None)[source]#
Leave the specified room.
- Parameters:
room (
JID
) – Room to leave.nick (
str
) – Your nickname.msg (
str
) – Presence status to use.
- set_subject(room, subject, *, mfrom=None)[source]#
Set a room’s subject.
- Parameters:
room (
JID
) – JID of the room.subject (
str
) – Room subject to set.
- async get_room_config(room, ifrom=None, **iqkwargs)[source]#
Get the room config form in 0004 plugin format.
- Parameters:
room (
JID
) – Room to get the config form from.- Raises:
ValueError – When the form is not found.
- Return type:
- Returns:
A form object.
- async cancel_config(room, *, ifrom=None, **iqkwargs)[source]#
Cancel a requested config form.
- Parameters:
room (
JID
) – Room to cancel the form for.
- async set_affiliation(room, affiliation, *, jid=None, nick=None, reason='', ifrom=None, **iqkwargs)[source]#
Change room affiliation for a JID or nickname.
- async get_affiliation_list(room, affiliation, *, ifrom=None, **iqkwargs)[source]#
Get a list of JIDs with the specified affiliation
- async send_affiliation_list(room, affiliations, *, ifrom=None, **iqkwargs)[source]#
Send an affiliation delta list.
- 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).
- Parameters:
room (
JID
) – Room to modify.nick (
str
) – User nickname to use in the set operation.role (
Literal
['moderator'
,'participant'
,'visitor'
,'none'
]) – Role to set.reason (
str
) – Reason for the role change.
- async get_roles_list(room, role, *, ifrom=None, **iqkwargs)[source]#
“Get a list of JIDs with the specified role
- Parameters:
room (
JID
) – Room to get roles from.role (
Literal
['moderator'
,'participant'
,'visitor'
,'none'
]) – The role to list.
- Return type:
List
[str
]
- async send_role_list(room, roles, *, ifrom=None, **iqkwargs)[source]#
Send a role delta list.
- Parameters:
room (
JID
) – Room to send the roles to.roles (
List
[Tuple
[str
,Literal
['moderator'
,'participant'
,'visitor'
,'none'
]]]) – List of couples (nick, role) to set.
- invite_server(room, jid, invite_from, reason='')[source]#
Send a mediated invite to a user, as a MUC service.
New in version 1.8.0.
- request_voice(room, role, *, mfrom=None)[source]#
Request voice in a moderated room.
- Parameters:
room (
JID
) – Room to request voice from.
- get_joined_rooms()[source]#
Get the list of rooms we sent a join presence to and did not explicitly leave.
- 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.
- Parameters:
room (
JID
) – Get the property for this room.nick (
str
) – Which nickname information to get.jid_property (
Literal
['jid'
,'role'
,'affiliation'
,'show'
,'status'
,'alt_nick'
]) – Property to fetch.
- Return type:
Any
Stanza elements#
- class slixmpp.plugins.xep_0045.stanza.MUCActor(xml=None, parent=None)[source]#
-
- interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'actor'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'actor'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'item'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#admin'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber: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, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'query'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#admin'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'mucadmin_query'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_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]#
-
- interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'x'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'muc'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- class slixmpp.plugins.xep_0045.stanza.MUCDecline(xml=None, parent=None)[source]#
-
- interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'decline'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'decline'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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.MUCDestroy(xml=None, parent=None)[source]#
- interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'destroy'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'destroy'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'history'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'history'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'invite'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'invite'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'x'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'muc_join'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'destroy'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#owner'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'destroy'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'query'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#owner'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'mucowner_query'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_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: ClassVar[Set[str]] = {'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: ClassVar[str] = 'status'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib: ClassVar[str] = 'status'#
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- class slixmpp.plugins.xep_0045.stanza.MUCUserItem(xml=None, parent=None)[source]#
-
- interfaces: ClassVar[Set[str]] = {'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: ClassVar[str] = 'item'#
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace: str = 'http://jabber.org/protocol/muc#user'#
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber: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, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- sub_interfaces: ClassVar[Set[str]] = {'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.