[openpgp] 1.4.8
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
"gajim>=1.4.0"
|
||||
],
|
||||
"short_name": "pgp",
|
||||
"version": "1.4.7"
|
||||
"version": "1.4.8"
|
||||
}
|
||||
Reference in New Issue
Block a user