diff src/cagou/core/cagou_main.py @ 122:dcd6fbb3f010

chat: handle new OTR state signal and change encryption icon consequently
author Goffi <goffi@goffi.org>
date Wed, 01 Feb 2017 21:47:16 +0100
parents 1bbbe26846f4
children
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Tue Jan 31 23:11:49 2017 +0100
+++ b/src/cagou/core/cagou_main.py	Wed Feb 01 21:47:16 2017 +0100
@@ -306,6 +306,7 @@
                 yield w
 
     def onBridgeConnected(self):
+        self.registerSignal("otrState", iface="plugin")
         self.bridge.getReady(self.onBackendReady)
 
     def _bridgeEb(self, failure):
@@ -614,6 +615,15 @@
         self.menus.addMenu(C.MENU_GLOBAL, (_(u"Help"), _(u"About")), callback=main_menu.onAbout)
         main_menu.update(C.MENU_GLOBAL)
 
+    ## bridge handlers ##
+
+    def otrStateHandler(self, state, dest_jid, profile):
+        """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
+        for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
+            widget.onOTRState(state, dest_jid, profile)
+
     ## misc ##
 
     def plugging_profiles(self):