summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0425/moderation.py11
-rw-r--r--slixmpp/plugins/xep_0425/stanza.py1
2 files changed, 12 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0425/moderation.py b/slixmpp/plugins/xep_0425/moderation.py
index e840d80d..6f67806b 100644
--- a/slixmpp/plugins/xep_0425/moderation.py
+++ b/slixmpp/plugins/xep_0425/moderation.py
@@ -9,6 +9,8 @@ from typing import Optional
from slixmpp import JID, Message
from slixmpp.exceptions import IqError, IqTimeout
+from slixmpp.xmlstream.handler import Callback
+from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.plugins import BasePlugin
from slixmpp.plugins.xep_0425 import stanza
@@ -24,10 +26,19 @@ class XEP_0425(BasePlugin):
def plugin_init(self) -> None:
stanza.register_plugins()
+ self.xmpp.register_handler(Callback(
+ 'Moderated Message',
+ StanzaPath('message/apply_to/moderated/retract'),
+ self._handle_moderated,
+ ))
def session_bind(self, jid):
self.xmpp.plugin['xep_0030'].add_feature(feature=stanza.NS)
+ def _handle_moderated(self, message: Message):
+ if message['type'] == 'groupchat':
+ self.xmpp.event('moderated_message', message)
+
def plugin_end(self):
self.xmpp.plugin['xep_0030'].del_feature(feature=stanza.NS)
diff --git a/slixmpp/plugins/xep_0425/stanza.py b/slixmpp/plugins/xep_0425/stanza.py
index 9b756953..566b1d09 100644
--- a/slixmpp/plugins/xep_0425/stanza.py
+++ b/slixmpp/plugins/xep_0425/stanza.py
@@ -42,5 +42,6 @@ def register_plugins():
register_stanza_plugin(Message, Moderated)
register_stanza_plugin(ApplyTo, Moderated)
+ register_stanza_plugin(Moderated, Retract)
register_stanza_plugin(Moderated, Retracted)
register_stanza_plugin(Moderated, OccupantId)