comparison 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
comparison
equal deleted inserted replaced
121:c498178d8122 122:dcd6fbb3f010
304 for w_list in self._visible_widgets.itervalues(): 304 for w_list in self._visible_widgets.itervalues():
305 for w in w_list: 305 for w in w_list:
306 yield w 306 yield w
307 307
308 def onBridgeConnected(self): 308 def onBridgeConnected(self):
309 self.registerSignal("otrState", iface="plugin")
309 self.bridge.getReady(self.onBackendReady) 310 self.bridge.getReady(self.onBackendReady)
310 311
311 def _bridgeEb(self, failure): 312 def _bridgeEb(self, failure):
312 if bridge_name == "pb" and sys.platform == "android": 313 if bridge_name == "pb" and sys.platform == "android":
313 try: 314 try:
612 main_menu = self.app.root.root_menus 613 main_menu = self.app.root.root_menus
613 self.menus.addMenus(backend_menus) 614 self.menus.addMenus(backend_menus)
614 self.menus.addMenu(C.MENU_GLOBAL, (_(u"Help"), _(u"About")), callback=main_menu.onAbout) 615 self.menus.addMenu(C.MENU_GLOBAL, (_(u"Help"), _(u"About")), callback=main_menu.onAbout)
615 main_menu.update(C.MENU_GLOBAL) 616 main_menu.update(C.MENU_GLOBAL)
616 617
618 ## bridge handlers ##
619
620 def otrStateHandler(self, state, dest_jid, profile):
621 """OTR state has changed for on destinee"""
622 # XXX: this method could be in QuickApp but it's here as
623 # it's only used by Cagou so far
624 for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
625 widget.onOTRState(state, dest_jid, profile)
626
617 ## misc ## 627 ## misc ##
618 628
619 def plugging_profiles(self): 629 def plugging_profiles(self):
620 self.app.root.changeWidget(WidgetsHandler()) 630 self.app.root.changeWidget(WidgetsHandler())
621 self.bridge.menusGet("", C.NO_SECURITY_LIMIT, callback=self._menusGetCb) 631 self.bridge.menusGet("", C.NO_SECURITY_LIMIT, callback=self._menusGetCb)