[httpupload] Use new encryption API
This commit is contained in:
@@ -155,7 +155,7 @@ class Base(object):
|
|||||||
|
|
||||||
self.controls[jid] = button
|
self.controls[jid] = button
|
||||||
id_ = button.connect(
|
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
|
chat_control.handlers[id_] = button
|
||||||
self.set_button_state(self.enabled, button)
|
self.set_button_state(self.enabled, button)
|
||||||
button.show()
|
button.show()
|
||||||
@@ -174,17 +174,12 @@ class Base(object):
|
|||||||
for jid in self.controls:
|
for jid in self.controls:
|
||||||
self.set_button_state(state, self.controls[jid])
|
self.set_button_state(state, self.controls[jid])
|
||||||
|
|
||||||
def encryption_activated(self, jid):
|
def encryption_activated(self, chat_control):
|
||||||
for plugin in gajim.plugin_manager.active_plugins:
|
encrypted = chat_control.encryption == 'OMEMO'
|
||||||
if type(plugin).__name__ == 'OmemoPlugin':
|
log.info('Encryption is: %s', encrypted)
|
||||||
state = plugin.get_omemo_state(self.account)
|
return encrypted
|
||||||
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 on_file_dialog_ok(self, widget, jid, chat_control):
|
def on_file_dialog_ok(self, widget, chat_control):
|
||||||
path = widget.get_filename()
|
path = widget.get_filename()
|
||||||
widget.destroy()
|
widget.destroy()
|
||||||
|
|
||||||
@@ -205,7 +200,7 @@ class Base(object):
|
|||||||
transient_for=chat_control.parent_win.window)
|
transient_for=chat_control.parent_win.window)
|
||||||
return
|
return
|
||||||
|
|
||||||
encrypted = self.encryption_activated(jid)
|
encrypted = self.encryption_activated(chat_control)
|
||||||
if encrypted and not ENCRYPTION_AVAILABLE:
|
if encrypted and not ENCRYPTION_AVAILABLE:
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
_('Error'),
|
_('Error'),
|
||||||
@@ -233,9 +228,9 @@ class Base(object):
|
|||||||
progress=progress, event=event)
|
progress=progress, event=event)
|
||||||
self.request_slot(file)
|
self.request_slot(file)
|
||||||
|
|
||||||
def on_file_button_clicked(self, widget, jid, chat_control):
|
def on_file_button_clicked(self, widget, chat_control):
|
||||||
FileChooserDialog(
|
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),
|
chat_control),
|
||||||
title_text=_('Choose file to send'),
|
title_text=_('Choose file to send'),
|
||||||
action=Gtk.FileChooserAction.OPEN,
|
action=Gtk.FileChooserAction.OPEN,
|
||||||
|
|||||||
Reference in New Issue
Block a user