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


Commits:
00a25888 by Philipp Hörist at 2026-05-03T16:20:40+02:00
new: Add removing backup from server

- - - - -


2 changed files:

- gajim/common/modules/openpgp.py
- gajim/gtk/preference/account.py


Changes:

=====================================
gajim/common/modules/openpgp.py
=====================================
@@ -926,6 +926,13 @@ def backup_secret_key(
         result = yield self.set_secret_key(encrypted_payload)
         raise_if_error(result)
 
+    def remove_backup_from_server(self) -> None:
+        if not app.account_is_available(self._account):
+            return
+
+        self._log.info("Remove backup from server")
+        self._client.get_module("PubSub").delete(Namespace.OPENPGP_SK, 
self._own_jid)
+
     def check_secret_key_backup(self) -> None:
         if not app.account_is_available(self._account):
             return


=====================================
gajim/gtk/preference/account.py
=====================================
@@ -436,12 +436,34 @@ def __init__(self, account: str) -> None:
                 SettingType.ACCOUNT_CONFIG,
                 "openpgp_backup_secret_key",
                 desc=_("Stores the secret key encrypted on the server"),
+                enabled_func=(lambda: app.account_is_connected(account)),
+                callback=self._on_backup,
             ),
         ]
 
         for setting in settings:
             self.add_setting(setting)
 
+    def _on_backup(self, state: bool, _data: Any) -> None:
+        if state:
+            return
+
+        def _on_response() -> None:
+            assert self.account is not None
+            client = app.get_client(self.account)
+            client.get_module("OpenPGP").remove_backup_from_server()
+
+        AlertDialog(
+            _("Remove Backup"),
+            _("Do you want to remove the backup from your server?"),
+            responses=[
+                CancelDialogResponse(label=_("Keep Backup")),
+                DialogResponse("confirm", _("Remove from Server"), 
"destructive"),
+            ],
+            emit_responses=["confirm"],
+            callback=_on_response,
+        )
+
 
 class AccountOpenPGPTrustGroup(GajimPreferencesGroup):
     def __init__(self, account: str) -> None:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/00a2588882aa7506930acb4500f89cc679b50401

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