changeset 8b9d0e1e3033 in /home/hg/repos/gajim-plugins
author: lovetox forenjunkie@chello.at branches: details:gajim-plugins?cmd=changeset;node=8b9d0e1e3033 description: Refactor auth icon and remove status message
diffstat:
omemo/__init__.py | 2 -- omemo/omemo/liteaxolotlstore.py | 3 +++ omemo/omemo/state.py | 15 +++++++-------- omemo/ui.py | 28 +++++++++------------------- 4 files changed, 19 insertions(+), 29 deletions(-)
diffs (143 lines):
diff -r 667c956dea9a -r 8b9d0e1e3033 omemo/__init__.py --- a/omemo/__init__.py Fri Aug 05 17:55:21 2016 +0200 +++ b/omemo/__init__.py Fri Aug 05 18:50:24 2016 +0200 @@ -517,8 +517,6 @@ if account_name in self.ui_list and \ recipient_id in self.ui_list[account_name]: self.ui_list[account_name][recipient_id]. \ - WarnIfUndecidedFingerprints() - self.ui_list[account_name][recipient_id]. \ new_fingerprints_available()
@log_calls('OmemoPlugin') diff -r 667c956dea9a -r 8b9d0e1e3033 omemo/omemo/liteaxolotlstore.py --- a/omemo/omemo/liteaxolotlstore.py Fri Aug 05 17:55:21 2016 +0200 +++ b/omemo/omemo/liteaxolotlstore.py Fri Aug 05 18:50:24 2016 +0200 @@ -90,6 +90,9 @@ def getTrustedFingerprints(self, jid): return self.identityKeyStore.getTrustedFingerprints(jid)
+ def getUndecidedFingerprints(self, jid): + return self.identityKeyStore.getUndecidedFingerprints(jid) + def setShownFingerprints(self, jid): return self.identityKeyStore.setShownFingerprints(jid)
diff -r 667c956dea9a -r 8b9d0e1e3033 omemo/omemo/state.py --- a/omemo/omemo/state.py Fri Aug 05 17:55:21 2016 +0200 +++ b/omemo/omemo/state.py Fri Aug 05 18:50:24 2016 +0200 @@ -284,19 +284,18 @@ isTrustedIdentity(self.cipher.recipientId, self.key)
def getTrustedFingerprints(self, recipient_id): - log.debug('Inactive fingerprints') - log.debug(self.store.getInactiveSessionsKeys(recipient_id)) - log.debug('trusted fingerprints') - log.debug(self.store.getTrustedFingerprints(recipient_id)) - inactive = self.store.getInactiveSessionsKeys(recipient_id) trusted = self.store.getTrustedFingerprints(recipient_id) trusted = set(trusted) - set(inactive)
- log.debug('trusted active fingerprints') - log.debug(trusted) + return trusted
- return trusted + def getUndecidedFingerprints(self, recipient_id): + inactive = self.store.getInactiveSessionsKeys(recipient_id) + undecided = self.store.getUndecidedFingerprints(recipient_id) + undecided = set(undecided) - set(inactive) + + return undecided
def device_list_for(self, jid): """ Return a list of known device ids for the specified jid. diff -r 667c956dea9a -r 8b9d0e1e3033 omemo/ui.py --- a/omemo/ui.py Fri Aug 05 17:55:21 2016 +0200 +++ b/omemo/ui.py Fri Aug 05 18:50:24 2016 +0200 @@ -107,7 +107,7 @@ self.windowinstances = {}
self.display_omemo_state() - self.refreshAuthLockSymbol() + self.refresh_auth_lock_icon()
self.omemobutton = OmemoButton(plugin, chat_control, self, enabled)
@@ -172,12 +172,12 @@ self.contact.jid) self.plugin.omemo_enable_for(self.contact.jid, self.contact.account.name) - self.WarnIfUndecidedFingerprints() # calls refreshAuthLockSymbol() + self.refresh_auth_lock_icon() else: log.debug(self.contact.account.name + ' => Disable OMEMO for ' + self.contact.jid) self.plugin.omemo_disable_for(self.contact) - self.refreshAuthLockSymbol() + self.refresh_auth_lock_icon()
self.omemobutton.set_omemo_state(enabled) self.display_omemo_state() @@ -223,24 +223,14 @@ msg = u'OMEMO encryption disabled' self.chat_control.print_conversation_line(msg, 'status', '', None)
- def WarnIfUndecidedFingerprints(self): - if self.state.store.identityKeyStore. \ - getUndecidedFingerprints(self.contact.jid): - msg = "You received a new Fingerprint. " \ - "Until you make a trust decision you can only " \ - "receive encrypted Messages from that Device." - self.chat_control.print_conversation_line(msg, 'status', '', None) - self.refreshAuthLockSymbol() - def no_trusted_fingerprints_warning(self): msg = "To send an encrypted message, you have to " \ "first trust the fingerprint of your contact!" self.chat_control.print_conversation_line(msg, 'status', '', None)
- def refreshAuthLockSymbol(self): + def refresh_auth_lock_icon(self): if self.encryption_active(): - if self.state.store.identityKeyStore. \ - getUndecidedFingerprints(self.contact.jid): + if self.state.getUndecidedFingerprints(self.contact.jid): self.chat_control._show_lock_image(True, 'OMEMO', True, True, False) else: @@ -329,7 +319,7 @@ state.store.identityKeyStore.setTrust(_id, TRUSTED) try: if self.plugin.ui_list[account]: - self.plugin.ui_list[account][user].refreshAuthLockSymbol() + self.plugin.ui_list[account][user].refresh_auth_lock_icon() except: dlg.destroy() else: @@ -337,7 +327,7 @@ state.store.identityKeyStore.setTrust(_id, UNTRUSTED) try: if user in self.plugin.ui_list[account]: - self.plugin.ui_list[account][user].refreshAuthLockSymbol() + self.plugin.ui_list[account][user].refresh_auth_lock_icon() except: dlg.destroy()
@@ -523,13 +513,13 @@ if response == gtk.RESPONSE_YES: self.omemostate.store.identityKeyStore.setTrust(_id, TRUSTED) self.plugin.ui_list[self.account][self.contact.jid]. \ - refreshAuthLockSymbol() + refresh_auth_lock_icon() dlg.destroy() else: if response == gtk.RESPONSE_NO: self.omemostate.store.identityKeyStore.setTrust(_id, UNTRUSTED) self.plugin.ui_list[self.account][self.contact.jid]. \ - refreshAuthLockSymbol() + refresh_auth_lock_icon() dlg.destroy()
self.update_context_list()