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


Commits:
8ec6c9d0 by Philipp Hörist at 2026-03-02T21:34:25+01:00
imprv: Presence: Add preauth attribute

- - - - -


2 changed files:

- nbxmpp/modules/presence.py
- nbxmpp/namespaces.py


Changes:

=====================================
nbxmpp/modules/presence.py
=====================================
@@ -109,9 +109,13 @@ class BasePresence(BaseModule):
 
     @log_calls
     def subscribe(
-        self, jid: JID, status: str | None = None, nick: str | None = None
+        self,
+        jid: JID,
+        status: str | None = None,
+        nick: str | None = None,
+        preauth: str | None = None,
     ) -> None:
-        self.send(jid=jid, typ="subscribe", status=status, nick=nick)
+        self.send(jid=jid, typ="subscribe", status=status, nick=nick, 
preauth=preauth)
 
     def send(
         self,
@@ -127,6 +131,7 @@ class BasePresence(BaseModule):
         muc: bool = False,
         muc_history=None,
         muc_password: str | None = None,
+        preauth: str | None = None,
         extend=None,
     ) -> None:
 
@@ -156,6 +161,9 @@ class BasePresence(BaseModule):
             if muc_password is not None:
                 muc_x.setTagData("password", muc_password)
 
+        if preauth is not None:
+            presence.setTag(Namespace.PARS + " preauth", attrs={"token": 
preauth})
+
         if extend is not None:
             for node in extend:
                 presence.addChild(node=node)


=====================================
nbxmpp/namespaces.py
=====================================
@@ -119,6 +119,7 @@ class _Namespaces:
     OPENPGP: str = "urn:xmpp:openpgp:0"
     OPENPGP_PK: str = "urn:xmpp:openpgp:0:public-keys"
     OPENPGP_SK: str = "urn:xmpp:openpgp:0:secret-key"
+    PARS: str = "urn:xmpp:pars:0"
     PING: str = "urn:xmpp:ping"
     PRE_APPROVAL: str = "urn:xmpp:features:pre-approval"
     PRIVACY: str = "jabber:iq:privacy"



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

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