From 7601311c7d67f623d177f46086cbce3f0e33966f Mon Sep 17 00:00:00 2001 From: wurstsalat Date: Thu, 6 Oct 2022 17:06:44 +0200 Subject: [PATCH] [pgp] 1.4.7 --- pgp/gtk/config.py | 12 ++++++------ pgp/gtk/key.py | 10 +++++----- pgp/modules/pgp_legacy.py | 6 +++--- pgp/plugin-manifest.json | 2 +- pgp/plugin.py | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pgp/gtk/config.py b/pgp/gtk/config.py index d806b03..2f4831d 100644 --- a/pgp/gtk/config.py +++ b/pgp/gtk/config.py @@ -48,7 +48,7 @@ class PGPConfigDialog(Gtk.ApplicationWindow): self._plugin = plugin - for account in app.connections.keys(): + for account in app.settings.get_active_accounts(): page = Page(plugin, account) self._ui.stack.add_titled(page, account, @@ -61,7 +61,7 @@ class Page(Gtk.Box): def __init__(self, plugin, account): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) - self._con = app.connections[account] + self._client = app.get_client(account) self._plugin = plugin self._label = Gtk.Label() self._button = Gtk.Button(label=_('Assign Key')) @@ -76,13 +76,13 @@ class Page(Gtk.Box): self.show_all() def _on_assign(self, _button): - backend = self._con.get_module('PGPLegacy').pgp_backend + backend = self._client.get_module('PGPLegacy').pgp_backend secret_keys = backend.get_keys(secret=True) dialog = ChooseGPGKeyDialog(secret_keys, self.get_toplevel()) dialog.connect('response', self._on_response) def _load_key(self): - key_data = self._con.get_module('PGPLegacy').get_own_key_data() + key_data = self._client.get_module('PGPLegacy').get_own_key_data() if key_data is None: self._set_key(None) else: @@ -93,10 +93,10 @@ class Page(Gtk.Box): return if dialog.selected_key is None: - self._con.get_module('PGPLegacy').set_own_key_data(None) + self._client.get_module('PGPLegacy').set_own_key_data(None) self._set_key(None) else: - self._con.get_module('PGPLegacy').set_own_key_data( + self._client.get_module('PGPLegacy').set_own_key_data( dialog.selected_key) self._set_key(dialog.selected_key) diff --git a/pgp/gtk/key.py b/pgp/gtk/key.py index 64827fb..3a48c75 100644 --- a/pgp/gtk/key.py +++ b/pgp/gtk/key.py @@ -35,7 +35,7 @@ class KeyDialog(Gtk.Dialog): self._plugin = plugin self._jid = jid - self._con = app.connections[account] + self._client = app.get_client(account) self._label = Gtk.Label() @@ -57,12 +57,12 @@ class KeyDialog(Gtk.Dialog): self.show_all() def _choose_key(self, *args): - backend = self._con.get_module('PGPLegacy').pgp_backend + backend = self._client.get_module('PGPLegacy').pgp_backend dialog = ChooseGPGKeyDialog(backend.get_keys(), self) dialog.connect('response', self._on_response) def _load_key(self): - key_data = self._con.get_module('PGPLegacy').get_contact_key_data( + key_data = self._client.get_module('PGPLegacy').get_contact_key_data( self._jid) if key_data is None: self._set_key(None) @@ -74,11 +74,11 @@ class KeyDialog(Gtk.Dialog): return if dialog.selected_key is None: - self._con.get_module('PGPLegacy').set_contact_key_data( + self._client.get_module('PGPLegacy').set_contact_key_data( self._jid, None) self._set_key(None) else: - self._con.get_module('PGPLegacy').set_contact_key_data( + self._client.get_module('PGPLegacy').set_contact_key_data( self._jid, dialog.selected_key) self._set_key(dialog.selected_key) diff --git a/pgp/modules/pgp_legacy.py b/pgp/modules/pgp_legacy.py index ba34a3c..b697a2b 100644 --- a/pgp/modules/pgp_legacy.py +++ b/pgp/modules/pgp_legacy.py @@ -60,8 +60,8 @@ ALLOWED_TAGS = [('request', Namespace.RECEIPTS), class PGPLegacy(BaseModule): - def __init__(self, con): - BaseModule.__init__(self, con, plugin=True) + def __init__(self, client): + BaseModule.__init__(self, client, plugin=True) self.handlers = [ StanzaHandler(name='message', @@ -74,7 +74,7 @@ class PGPLegacy(BaseModule): priority=48), ] - self.own_jid = self._con.get_own_jid() + self.own_jid = self._client.get_own_jid() self._pgp = PGP() self._store = KeyStore(self._account, self.own_jid, self._log, diff --git a/pgp/plugin-manifest.json b/pgp/plugin-manifest.json index 5f207d2..1e167da 100644 --- a/pgp/plugin-manifest.json +++ b/pgp/plugin-manifest.json @@ -16,5 +16,5 @@ "gajim>=1.4.0" ], "short_name": "pgp", - "version": "1.4.6" + "version": "1.4.7" } \ No newline at end of file diff --git a/pgp/plugin.py b/pgp/plugin.py index 45c169b..2d218cb 100644 --- a/pgp/plugin.py +++ b/pgp/plugin.py @@ -105,7 +105,7 @@ class PGPPlugin(GajimPlugin): @staticmethod def get_pgp_module(account): - return app.connections[account].get_module('PGPLegacy') + return app.get_client(account).get_module('PGPLegacy') def activate(self): pass @@ -153,9 +153,9 @@ class PGPPlugin(GajimPlugin): account = chat_control.account jid = chat_control.contact.jid - con = app.connections[account] + client = app.get_client(account) try: - valid = con.get_module('PGPLegacy').has_valid_key_assigned(jid) + valid = client.get_module('PGPLegacy').has_valid_key_assigned(jid) except KeyMismatch as announced_key_id: ErrorDialog( _('PGP Key mismatch'), @@ -169,7 +169,7 @@ class PGPPlugin(GajimPlugin): _('No OpenPGP key assigned'), _('No OpenPGP key is assigned to this contact.')) chat_control.sendmessage = False - elif con.get_module('PGPLegacy').get_own_key_data() is None: + elif client.get_module('PGPLegacy').get_own_key_data() is None: ErrorDialog( _('No OpenPGP key assigned'), _('No OpenPGP key is assigned to your account.'))