[pgp] 1.4.7

This commit is contained in:
wurstsalat
2022-10-06 17:06:44 +02:00
parent f6ce830faf
commit 7601311c7d
5 changed files with 19 additions and 19 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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,

View File

@@ -16,5 +16,5 @@
"gajim>=1.4.0"
],
"short_name": "pgp",
"version": "1.4.6"
"version": "1.4.7"
}

View File

@@ -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.'))