Skip to content
Snippets Groups Projects
Commit 185bbbb3 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Show omemo UI if encryption is active

The UI should be shown when encryption is active in any case
so that the user can disable it.
If for any reason the jid of the contact is not in device_ids
the UI was not shown before. If addtionally the last
known state of encryption was active, the user saw no UI
and couldnt disable omemo. Because for the jid are no devices known
(hence not in device_ids) and omemo = active, because of security
omemo wouldnt let any messages be sent. The user had no
chance to come out of this state
parent ce864a56
No related branches found
No related tags found
No related merge requests found
......@@ -312,13 +312,18 @@ class OmemoPlugin(GajimPlugin):
self.ui_list[account_name] = {}
state = self.get_omemo_state(account_name)
my_jid = gajim.get_jid_from_account(account_name)
omemo_enabled = state.encryption.is_active(contact_jid)
if omemo_enabled:
log.debug(account_name + " => Adding OMEMO ui for " + contact_jid)
self.ui_list[account_name][contact_jid] = Ui(self, chat_control,
omemo_enabled, state)
return
if contact_jid in state.device_ids or contact_jid == my_jid:
log.debug(account_name + " => Adding OMEMO ui for " + contact_jid)
omemo_enabled = state.encryption.is_active(contact_jid)
self.ui_list[account_name][contact_jid] = Ui(self, chat_control,
omemo_enabled, state)
else:
log.warn(account_name + " => No OMEMO dev_keys for " + contact_jid)
log.warn(account_name + " => No devices for " + contact_jid)
def are_keys_missing(self, account_name, contact_jid):
""" Used by the ui to set the state of the PreKeyButton. """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment