changeset b274b558d29a in /home/hg/repos/gajim-plugins

author: lovetox <[email protected]>
branches: 
details:gajim-plugins?cmd=changeset;node=b274b558d29a
description: 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

diffstat:

 omemo/__init__.py |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 4d60646803e4 -r b274b558d29a omemo/__init__.py
--- a/omemo/__init__.py Wed Jun 15 20:12:33 2016 +0200
+++ b/omemo/__init__.py Wed Jun 15 21:00:38 2016 +0200
@@ -312,13 +312,18 @@
             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. """
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to