summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-01-31 17:03:39 +0100
committermathieui <mathieui@mathieui.net>2021-01-31 17:15:47 +0100
commita8113dca49fe25123b256379461f46c02bbf01c8 (patch)
tree180d914903534dd3ba731e5cdb38e2e9e6f0b0f1
parenteda692d1c6093354e4fa13765329384e829ccac1 (diff)
downloadslixmpp-a8113dca49fe25123b256379461f46c02bbf01c8.tar.gz
slixmpp-a8113dca49fe25123b256379461f46c02bbf01c8.tar.bz2
slixmpp-a8113dca49fe25123b256379461f46c02bbf01c8.tar.xz
slixmpp-a8113dca49fe25123b256379461f46c02bbf01c8.zip
XEP-0045: Add a specific handler for MUC presence errors
-rw-r--r--slixmpp/plugins/xep_0045/muc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0045/muc.py b/slixmpp/plugins/xep_0045/muc.py
index ef6955bb..c2806045 100644
--- a/slixmpp/plugins/xep_0045/muc.py
+++ b/slixmpp/plugins/xep_0045/muc.py
@@ -91,6 +91,9 @@ class XEP_0045(BasePlugin):
StanzaPath("presence/muc"),
self.handle_groupchat_presence,
))
+ # <x xmlns="http://jabber.org/protocol/muc"/> is only used in
+ # presence when joining on the client side, and for errors on
+ # the server side.
if self.xmpp.is_component:
self.xmpp.register_handler(
Callback(
@@ -98,6 +101,13 @@ class XEP_0045(BasePlugin):
StanzaPath("presence/muc_join"),
self.handle_groupchat_join,
))
+ self.xmpp.register_handler(
+ Callback(
+ "MUCPresenceError",
+ StanzaPath("presence@type=error/muc_join"),
+ self._handle_presence_error,
+ )
+ )
self.xmpp.register_handler(
Callback(
@@ -192,6 +202,10 @@ class XEP_0045(BasePlugin):
if got_online:
self.xmpp.event("muc::%s::got_online" % entry['room'], pr)
+ def _handle_presence_error(self, pr: Presence):
+ """Generate MUC presence error events"""
+ self.xmpp.event("muc::%s::presence-error" % pr['from'].bare, pr)
+
def handle_groupchat_presence(self, pr: Presence):
""" Handle a presence in a muc."""
if self.xmpp.is_component: