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


Commits:
a5bc3367 by nicoco at 2025-10-21T07:13:34+02:00
imprv: Support for hats "hue" attribute

- - - - -


3 changed files:

- nbxmpp/modules/muc/hats.py
- nbxmpp/structs.py
- python-nbxmpp.doap


Changes:

=====================================
nbxmpp/modules/muc/hats.py
=====================================
@@ -54,8 +54,17 @@ class Hats(BaseModule):
                 self._log.warning("Invalid hat received")
                 self._log.warning(stanza)
                 raise NodeProcessed
+            hue_str = hat.getAttr("hue")
+            if hue_str is None:
+                hue: float | None = None
+            else:
+                try:
+                    hue = float(hue_str)
+                except ValueError:
+                    self._log.warning("Invalid hue value: %s", hue_str)
+                    hue = None
 
             lang = hat.getAttr("xml:lang")
-            hat_data.add_hat(Hat(uri, title), lang)
+            hat_data.add_hat(Hat(uri, title, hue), lang)
 
         properties.hats = hat_data


=====================================
nbxmpp/structs.py
=====================================
@@ -1031,6 +1031,7 @@ class ReceiptData(NamedTuple):
 class Hat:
     uri: str
     title: str
+    hue: float | None
 
 
 class HatData:


=====================================
python-nbxmpp.doap
=====================================
@@ -325,8 +325,9 @@
     <implements>
       <xmpp:SupportedXep>
         <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0317.html"/>
-        <xmpp:status>complete</xmpp:status>
-        <xmpp:version>0.2.0</xmpp:version>
+        <xmpp:status>partial</xmpp:status>
+        <xmpp:note>Supports reading hats, but not setting hats</xmpp:note>
+        <xmpp:version>0.3.1</xmpp:version>
       </xmpp:SupportedXep>
     </implements>
     <implements>



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

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