diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-05-07 21:02:37 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-05-07 21:02:37 +0300 |
commit | a10ffe4bb6c3fb21086fc0cac1267be21bb902c5 (patch) | |
tree | 42e3c1f1881d09908fb220b9c4da1098ae6f84f6 | |
parent | de369fc6a0b33943cdf23f759844bfa6132094ed (diff) |
[httpupload] Use new encryption API
-rw-r--r-- | httpupload/httpupload.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/httpupload/httpupload.py b/httpupload/httpupload.py index fef54c3..b9a94ff 100644 --- a/httpupload/httpupload.py +++ b/httpupload/httpupload.py @@ -155,7 +155,7 @@ class Base(object): self.controls[jid] = button id_ = button.connect( - 'clicked', self.on_file_button_clicked, jid, chat_control) + 'clicked', self.on_file_button_clicked, chat_control) chat_control.handlers[id_] = button self.set_button_state(self.enabled, button) button.show() @@ -174,17 +174,12 @@ class Base(object): for jid in self.controls: self.set_button_state(state, self.controls[jid]) - def encryption_activated(self, jid): - for plugin in gajim.plugin_manager.active_plugins: - if type(plugin).__name__ == 'OmemoPlugin': - state = plugin.get_omemo_state(self.account) - encryption = state.encryption.is_active(jid) - log.info('Encryption is: %s', bool(encryption)) - return bool(encryption) - log.info('OMEMO not found, encryption disabled') - return False + def encryption_activated(self, chat_control): + encrypted = chat_control.encryption == 'OMEMO' + log.info('Encryption is: %s', encrypted) + return encrypted - def on_file_dialog_ok(self, widget, jid, chat_control): + def on_file_dialog_ok(self, widget, chat_control): path = widget.get_filename() widget.destroy() @@ -205,7 +200,7 @@ class Base(object): transient_for=chat_control.parent_win.window) return - encrypted = self.encryption_activated(jid) + encrypted = self.encryption_activated(chat_control) if encrypted and not ENCRYPTION_AVAILABLE: ErrorDialog( _('Error'), @@ -233,9 +228,9 @@ class Base(object): progress=progress, event=event) self.request_slot(file) - def on_file_button_clicked(self, widget, jid, chat_control): + def on_file_button_clicked(self, widget, chat_control): FileChooserDialog( - on_response_ok=lambda widget: self.on_file_dialog_ok(widget, jid, + on_response_ok=lambda widget: self.on_file_dialog_ok(widget, chat_control), title_text=_('Choose file to send'), action=Gtk.FileChooserAction.OPEN, |