Philipp Hörist pushed to branch invite at gajim / gajim


Commits:
95e6fcaa by Philipp Hörist at 2026-03-05T21:49:28+01:00
other: Update gajim.doap

- - - - -
79921020 by Philipp Hörist at 2026-03-05T22:28:03+01:00
IBR start

- - - - -


4 changed files:

- data/gajim.doap
- gajim/gtk/account_wizard.py
- gajim/gtk/main.py
- gajim/gtk/structs.py


Changes:

=====================================
data/gajim.doap
=====================================
@@ -631,6 +631,14 @@
         <xmpp:note>Basic Spam/Abuse reporting via XEP-0191</xmpp:note>
       </xmpp:SupportedXep>
     </implements>
+    <implements>
+      <xmpp:SupportedXep>
+        <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0379.html"/>
+        <xmpp:status>partial</xmpp:status>
+        <xmpp:version>0.3.3</xmpp:version>
+        <xmpp:note>Handle uri and send subscription request with preauth 
token</xmpp:note>
+      </xmpp:SupportedXep>
+    </implements>
     <implements>
       <xmpp:SupportedXep>
         <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0380.html"/>


=====================================
gajim/gtk/account_wizard.py
=====================================
@@ -51,6 +51,7 @@
 from gajim.gtk.assistant import AssistantSuccessPage
 from gajim.gtk.dataform import DataFormWidget
 from gajim.gtk.dropdown import GajimDropDown
+from gajim.gtk.structs import AccountInviteData
 from gajim.gtk.util.classes import SignalManager
 from gajim.gtk.util.misc import clear_listbox
 from gajim.gtk.util.misc import container_remove_all
@@ -66,11 +67,12 @@
 
 
 class AccountWizard(Assistant):
-    def __init__(self) -> None:
+    def __init__(self, invite: AccountInviteData | None = None) -> None:
         Assistant.__init__(self, name="AccountWizard", height=500)
         self._client: NBXMPPClient | None = None
         self._method: Literal["login"] | Literal["signup"] = "login"
         self._destroyed: bool = False
+        self._invite = invite
 
         self.add_button("back", _("Back"))
         self.add_button(


=====================================
gajim/gtk/main.py
=====================================
@@ -53,6 +53,7 @@
 from gajim.gtk.main_stack import MainStack
 from gajim.gtk.preview.preview import PreviewWidget
 from gajim.gtk.start_chat import parse_uri
+from gajim.gtk.structs import AccountInviteData
 from gajim.gtk.structs import AccountJidParam
 from gajim.gtk.structs import actionmethod
 from gajim.gtk.structs import AddChatActionParams
@@ -738,7 +739,34 @@ def _on_handle_uri(self, _action: Gio.SimpleAction, param: 
GLib.Variant) -> None
     def open_xmpp_iri(self, xmpp_iri: XmppIri) -> None:
         accounts = app.settings.get_active_accounts()
         if not accounts:
-            log.warning("No accounts active, unable to handle uri")
+            preauth = xmpp_iri.params.get("preauth")
+            if not preauth:
+                log.warning("Unable to handle uri without preauth parameter")
+                return
+
+            match xmpp_iri.action:
+                case "roster":
+                    if xmpp_iri.params.get("ibr") != "y":
+                        log.warning("Unable to handle roster action, ibr != y")
+                        return
+
+                    invite = AccountInviteData(
+                        domain=xmpp_iri.jid.domain,
+                        username=None,
+                        token=preauth,
+                    )
+                    open_window("AccountWizard", inivte=invite)
+
+                case "register":
+                    invite = AccountInviteData(
+                        domain=xmpp_iri.jid.domain,
+                        username=xmpp_iri.jid.localpart,
+                        token=preauth,
+                    )
+                    open_window("AccountWizard", inivte=invite)
+
+                case _:
+                    log.warning("No accounts active, unable to handle uri")
             return
 
         jid_str = str(xmpp_iri.jid)


=====================================
gajim/gtk/structs.py
=====================================
@@ -21,6 +21,13 @@
 from gajim.common.structs import VariantMixin
 
 
+@dataclass
+class AccountInviteData:
+    domain: str
+    username: str | None
+    token: str
+
+
 @dataclass
 class OpenEventActionParams(VariantMixin):
     # Event which is used for Notifications and gets sent over DBus



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/76bb9aef8f49cfb079410ab7a5b58eb43f729132...799210200485f779d23cc81bdee1928a59e373ca

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/76bb9aef8f49cfb079410ab7a5b58eb43f729132...799210200485f779d23cc81bdee1928a59e373ca
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