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


Commits:
0f7b9747 by Nicoco at 2024-05-25T19:51:46+00:00
new: Support for the legacy prosody hats namespace

- - - - -


2 changed files:

- nbxmpp/modules/muc/hats.py
- nbxmpp/namespaces.py


Changes:

=====================================
nbxmpp/modules/muc/hats.py
=====================================
@@ -23,7 +23,13 @@ class Hats(BaseModule):
                 callback=self._process_hats,
                 ns=Namespace.HATS,
                 priority=15,
-            )
+            ),
+            StanzaHandler(
+                name="presence",
+                callback=self._process_hats,
+                ns=Namespace.HATS_LEGACY,
+                priority=15,
+            ),
         ]
 
     def _process_hats(
@@ -34,7 +40,9 @@ class Hats(BaseModule):
     ):
         hats = stanza.getTag("hats", namespace=Namespace.HATS)
         if hats is None:
-            return
+            hats = stanza.getTag("hats", namespace=Namespace.HATS_LEGACY)
+            if hats is None:
+                return
 
         hat_data = HatData()
         for hat in hats.getTags("hat"):


=====================================
nbxmpp/namespaces.py
=====================================
@@ -79,6 +79,7 @@ class _Namespaces:
     HASHES_SHA3_256: str = 'urn:xmpp:hash-function-text-names:sha3-256'
     HASHES_SHA3_512: str = 'urn:xmpp:hash-function-text-names:sha3-512'
     HATS: str = 'urn:xmpp:hats:0'
+    HATS_LEGACY: str = 'xmpp:prosody.im/protocol/hats:1'
     HINTS: str = 'urn:xmpp:hints'
     HTTPUPLOAD_0: str = 'urn:xmpp:http:upload:0'
     HTTP_AUTH: str = 'http://jabber.org/protocol/http-auth'



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/0f7b97476b4c0b46cf4eb669cf505dfd7e648240

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/0f7b97476b4c0b46cf4eb669cf505dfd7e648240
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