comparison cagou/core/cagou_main.py @ 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 f555b10712d7
children 15e47bbb192c
comparison
equal deleted inserted replaced
243:50f7c000b4ae 244:5bd94bc08f5c
27 from sat.core import exceptions 27 from sat.core import exceptions
28 from sat_frontends.quick_frontend.quick_app import QuickApp 28 from sat_frontends.quick_frontend.quick_app import QuickApp
29 from sat_frontends.quick_frontend import quick_widgets 29 from sat_frontends.quick_frontend import quick_widgets
30 from sat_frontends.quick_frontend import quick_chat 30 from sat_frontends.quick_frontend import quick_chat
31 from sat_frontends.quick_frontend import quick_utils 31 from sat_frontends.quick_frontend import quick_utils
32 from sat_frontends.tools import jid
32 from sat.tools import config 33 from sat.tools import config
33 from sat.tools.common import dynamic_import 34 from sat.tools.common import dynamic_import
34 import kivy 35 import kivy
35 kivy.require('1.10.0') 36 kivy.require('1.10.0')
36 import kivy.support 37 import kivy.support
736 737
737 def otrStateHandler(self, state, dest_jid, profile): 738 def otrStateHandler(self, state, dest_jid, profile):
738 """OTR state has changed for on destinee""" 739 """OTR state has changed for on destinee"""
739 # XXX: this method could be in QuickApp but it's here as 740 # XXX: this method could be in QuickApp but it's here as
740 # it's only used by Cagou so far 741 # it's only used by Cagou so far
742 dest_jid = jid.JID(dest_jid)
743 bare_jid = dest_jid.bare
741 for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)): 744 for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
742 widget.onOTRState(state, dest_jid, profile) 745 if widget.type == C.CHAT_ONE2ONE and widget.target == bare_jid:
746 widget.onOTRState(state, dest_jid, profile)
743 747
744 ## misc ## 748 ## misc ##
745 749
746 def plugging_profiles(self): 750 def plugging_profiles(self):
747 self.app.root.changeWidget(widgets_handler.WidgetsHandler()) 751 self.app.root.changeWidget(widgets_handler.WidgetsHandler())