changeset 244:5bd94bc08f5c

plugin chat: fixed OTR State filtering + removed some legacy code
author Goffi <goffi@goffi.org>
date Thu, 03 Jan 2019 20:38:46 +0100
parents 50f7c000b4ae
children d535446fdf45
files cagou/core/cagou_main.py cagou/plugins/plugin_wid_chat.kv cagou/plugins/plugin_wid_chat.py
diffstat 3 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Thu Jan 03 20:37:55 2019 +0100
+++ b/cagou/core/cagou_main.py	Thu Jan 03 20:38:46 2019 +0100
@@ -29,6 +29,7 @@
 from sat_frontends.quick_frontend import quick_widgets
 from sat_frontends.quick_frontend import quick_chat
 from sat_frontends.quick_frontend import quick_utils
+from sat_frontends.tools import jid
 from sat.tools import config
 from sat.tools.common import dynamic_import
 import kivy
@@ -738,8 +739,11 @@
         """OTR state has changed for on destinee"""
         # XXX: this method could be in QuickApp but it's here as
         #      it's only used by Cagou so far
+        dest_jid = jid.JID(dest_jid)
+        bare_jid = dest_jid.bare
         for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
-            widget.onOTRState(state, dest_jid, profile)
+            if widget.type == C.CHAT_ONE2ONE and widget.target == bare_jid:
+                widget.onOTRState(state, dest_jid, profile)
 
     ## misc ##
 
--- a/cagou/plugins/plugin_wid_chat.kv	Thu Jan 03 20:37:55 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Thu Jan 03 20:38:46 2019 +0100
@@ -168,16 +168,3 @@
         Rectangle:
             pos: self.pos
             size: self.size
-    # EncryptionButton:
-    #     size_hint: 1, None
-    #     id: start_btn
-    #     text: _(u"Start/Refresh encrypted session")
-    #     on_release: root.otr_start()
-    # EncryptionButton:
-    #     size_hint: 1, None
-    #     text: _(u"Finish encrypted session")
-    #     on_release: root.otr_end()
-    # EncryptionButton:
-    #     size_hint: 1, None
-    #     text: _(u"Authenticate destinee")
-    #     on_release: root.otr_authenticate()
--- a/cagou/plugins/plugin_wid_chat.py	Thu Jan 03 20:37:55 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Thu Jan 03 20:38:46 2019 +0100
@@ -48,7 +48,8 @@
     "icon_symbol": u"chat",
 }
 
-# following const are here temporary, they should move to quick frontend
+# FIXME: OTR specific code is legacy, and only used nowadays for lock color
+# we can probably get rid of them.
 OTR_STATE_UNTRUSTED = 'untrusted'
 OTR_STATE_TRUSTED = 'trusted'
 OTR_STATE_TRUST = (OTR_STATE_UNTRUSTED, OTR_STATE_TRUSTED)