diff options
author | wurstsalat <mailtrash@posteo.de> | 2022-10-06 18:15:49 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2022-10-06 18:15:49 +0300 |
commit | 29260fcc6f6eddc17efa3f24f376e5130b9f96c2 (patch) | |
tree | 22cc82a9f32116f95a2b9f4106f90add9f7b66a7 | |
parent | 7601311c7d67f623d177f46086cbce3f0e33966f (diff) |
[openpgp] 1.4.8
-rw-r--r-- | openpgp/gtk/key.py | 5 | ||||
-rw-r--r-- | openpgp/gtk/wizard.py | 18 | ||||
-rw-r--r-- | openpgp/modules/openpgp.py | 8 | ||||
-rw-r--r-- | openpgp/pgpplugin.py | 43 | ||||
-rw-r--r-- | pgp/plugin-manifest.json | 2 |
5 files changed, 38 insertions, 38 deletions
diff --git a/openpgp/gtk/key.py b/openpgp/gtk/key.py index e1d736f..8f7ece3 100644 --- a/openpgp/gtk/key.py +++ b/openpgp/gtk/key.py @@ -56,7 +56,7 @@ class KeyDialog(Gtk.Dialog): self.get_style_context().add_class('openpgp-key-dialog') - self.con = app.connections[account] + self._client = app.get_client(account) self._listbox = Gtk.ListBox() self._listbox.set_selection_mode(Gtk.SelectionMode.NONE) @@ -69,7 +69,8 @@ class KeyDialog(Gtk.Dialog): box = self.get_content_area() box.pack_start(self._scrolled, True, True, 0) - keys = self.con.get_module('OpenPGP').get_keys(jid, only_trusted=False) + keys = self._client.get_module('OpenPGP').get_keys( + jid, only_trusted=False) for key in keys: log.info('Load: %s', key.fingerprint) self._listbox.add(KeyRow(key)) diff --git a/openpgp/gtk/wizard.py b/openpgp/gtk/wizard.py index 5b6e76c..7d46e37 100644 --- a/openpgp/gtk/wizard.py +++ b/openpgp/gtk/wizard.py @@ -38,7 +38,7 @@ class KeyWizard(Gtk.Assistant): def __init__(self, plugin, account, chat_control): Gtk.Assistant.__init__(self) - self._con = app.connections[account] + self._client = app.get_client(account) self._plugin = plugin self._account = account self._data_form_widget = None @@ -55,7 +55,7 @@ class KeyWizard(Gtk.Assistant): self._add_page(WelcomePage()) # self._add_page(BackupKeyPage()) - self._add_page(NewKeyPage(self, self._con)) + self._add_page(NewKeyPage(self, self._client)) # self._add_page(SaveBackupCodePage()) self._add_page(SuccessfulPage()) self._add_page(ErrorPage()) @@ -85,7 +85,7 @@ class KeyWizard(Gtk.Assistant): def _on_page_change(self, assistant, page): if self.get_current_page() == Page.NEWKEY: - if self._con.get_module('OpenPGP').secret_key_available: + if self._client.get_module('OpenPGP').secret_key_available: self.set_current_page(Page.SUCCESS) else: page.generate() @@ -150,10 +150,10 @@ class NewKeyPage(RequestPage): title = _('Generating new Key') complete = False - def __init__(self, assistant, con): + def __init__(self, assistant, client): super().__init__() self._assistant = assistant - self._con = con + self._client = client def generate(self): log.info('Creating Key') @@ -163,7 +163,7 @@ class NewKeyPage(RequestPage): def worker(self): text = None try: - self._con.get_module('OpenPGP').generate_key() + self._client.get_module('OpenPGP').generate_key() except Exception as error: text = str(error) @@ -171,9 +171,9 @@ class NewKeyPage(RequestPage): def finished(self, error): if error is None: - self._con.get_module('OpenPGP').get_own_key_details() - self._con.get_module('OpenPGP').set_public_key() - self._con.get_module('OpenPGP').request_keylist() + self._client.get_module('OpenPGP').get_own_key_details() + self._client.get_module('OpenPGP').set_public_key() + self._client.get_module('OpenPGP').request_keylist() self._assistant.set_current_page(Page.SUCCESS) else: error_page = self._assistant.get_nth_page(Page.ERROR) diff --git a/openpgp/modules/openpgp.py b/openpgp/modules/openpgp.py index 3d05bb4..04aeaf7 100644 --- a/openpgp/modules/openpgp.py +++ b/openpgp/modules/openpgp.py @@ -73,8 +73,8 @@ class OpenPGP(BaseModule): 'request_secret_key', ] - def __init__(self, con): - BaseModule.__init__(self, con) + def __init__(self, client): + BaseModule.__init__(self, client) self.handlers = [ StanzaHandler(name='message', @@ -85,7 +85,7 @@ class OpenPGP(BaseModule): self._register_pubsub_handler(self._keylist_notification_received) - self.own_jid = self._con.get_own_jid() + self.own_jid = self._client.get_own_jid() own_bare_jid = self.own_jid.bare path = Path(configpaths.get('MY_DATA')) / 'openpgp' / own_bare_jid @@ -265,7 +265,7 @@ class OpenPGP(BaseModule): if error: log.error('Error: %s', error) app.ged.raise_event( - MessageNotSent(client=self._con, + MessageNotSent(client=self._client, jid=obj.jid, message=obj.message, error=error, diff --git a/openpgp/pgpplugin.py b/openpgp/pgpplugin.py index 0673d65..b47f12f 100644 --- a/openpgp/pgpplugin.py +++ b/openpgp/pgpplugin.py @@ -104,24 +104,23 @@ class OpenPGPPlugin(GajimPlugin): keyring_path.mkdir() def signed_in(self, event): - account = event.conn.name - con = app.connections[account] - if con.get_module('OpenPGP').secret_key_available: + client = app.get_client(event.account) + if client.get_module('OpenPGP').secret_key_available: log.info('%s => Publish keylist and public key after sign in', - account) - con.get_module('OpenPGP').request_keylist() - con.get_module('OpenPGP').set_public_key() + event.account) + client.get_module('OpenPGP').request_keylist() + client.get_module('OpenPGP').set_public_key() def activate(self): - for account in app.connections: - con = app.connections[account] - con.get_module('Caps').update_caps() + for account in app.settings.get_active_accounts(): + client = app.get_client(account) + client.get_module('Caps').update_caps() if app.account_is_connected(account): - if con.get_module('OpenPGP').secret_key_available: + if client.get_module('OpenPGP').secret_key_available: log.info('%s => Publish keylist and public key ' 'after plugin activation', account) - con.get_module('OpenPGP').request_keylist() - con.get_module('OpenPGP').set_public_key() + client.get_module('OpenPGP').request_keylist() + client.get_module('OpenPGP').set_public_key() def deactivate(self): pass @@ -133,12 +132,12 @@ class OpenPGPPlugin(GajimPlugin): def activate_encryption(self, chat_control): account = chat_control.account jid = chat_control.contact.jid - con = app.connections[account] - if con.get_module('OpenPGP').secret_key_available: - keys = app.connections[account].get_module('OpenPGP').get_keys( + client = app.get_client(account) + if client.get_module('OpenPGP').secret_key_available: + keys = client.get_module('OpenPGP').get_keys( jid, only_trusted=False) if not keys: - con.get_module('OpenPGP').request_keylist(JID.from_string(jid)) + client.get_module('OpenPGP').request_keylist(JID.from_string(jid)) return True from openpgp.gtk.wizard import KeyWizard @@ -161,14 +160,14 @@ class OpenPGPPlugin(GajimPlugin): def _before_sendmessage(self, chat_control): account = chat_control.account jid = chat_control.contact.jid - con = app.connections[account] + client = app.get_client(account) - if not con.get_module('OpenPGP').secret_key_available: + if not client.get_module('OpenPGP').secret_key_available: from openpgp.gtk.wizard import KeyWizard KeyWizard(self, account, chat_control) return - keys = con.get_module('OpenPGP').get_keys(jid) + keys = client.get_module('OpenPGP').get_keys(jid) if not keys: ErrorDialog( _('Not Trusted'), @@ -176,7 +175,7 @@ class OpenPGPPlugin(GajimPlugin): chat_control.sendmessage = False @staticmethod - def _encrypt_message(con, obj, callback): - if not con.get_module('OpenPGP').secret_key_available: + def _encrypt_message(client, obj, callback): + if not client.get_module('OpenPGP').secret_key_available: return - con.get_module('OpenPGP').encrypt_message(obj, callback) + client.get_module('OpenPGP').encrypt_message(obj, callback) diff --git a/pgp/plugin-manifest.json b/pgp/plugin-manifest.json index 1e167da..78d1a9c 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.7" + "version": "1.4.8" }
\ No newline at end of file |