Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
9ddf7966 by Nicoco at 2024-04-17T13:05:20+00:00
feat: MUC: Process muc user data for all message types

- - - - -


1 changed file:

- nbxmpp/modules/muc/muc.py


Changes:

=====================================
nbxmpp/modules/muc/muc.py
=====================================
@@ -79,6 +79,10 @@ class MUC(BaseModule):
                           callback=self._process_muc_user_presence,
                           ns=Namespace.MUC_USER,
                           priority=11),
+            StanzaHandler(name='message',
+                          callback=self._process_message_base,
+                          ns=Namespace.MUC_USER,
+                          priority=5),
             StanzaHandler(name='message',
                           callback=self._process_message_before_decryption,
                           typ='groupchat',
@@ -211,16 +215,6 @@ class MUC(BaseModule):
 
         properties.occupant_id = occupant_id
 
-        muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
-        if muc_user is not None:
-            try:
-                properties.muc_user = parse_muc_user(muc_user,
-                                                     is_presence=False)
-            except StanzaMalformed as error:
-                self._log.warning(error)
-                self._log.warning(stanza)
-                raise NodeProcessed
-
         addresses = stanza.getTag('addresses', namespace=Namespace.ADDRESS)
         if addresses is not None:
             address = addresses.getTag('address', attrs={'type': 'ofrom'})
@@ -240,6 +234,19 @@ class MUC(BaseModule):
             author=properties.muc_nickname,
             timestamp=properties.user_timestamp)
 
+    def _process_message_base(self, _client, stanza, properties):
+        muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
+        if muc_user is None:
+            return
+
+        try:
+            properties.muc_user = parse_muc_user(muc_user,
+                                                 is_presence=False)
+        except StanzaMalformed as error:
+            self._log.warning(error)
+            self._log.warning(stanza)
+            raise NodeProcessed
+
     def _process_message(self, _client, stanza, properties):
         muc_user = stanza.getTag('x', namespace=Namespace.MUC_USER)
         if muc_user is None:



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/9ddf7966267b79e55fbfd608cfb2e854917502c0

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/9ddf7966267b79e55fbfd608cfb2e854917502c0
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to