comparison frontends/src/quick_frontend/quick_app.py @ 1326:88e40f31b17e frontends_multi_profiles

quick_frontend (quick_app): fixes the call to a bridge method that was done with a JID instead of unicode
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 13:58:33 +0100
parents 49f967fc87aa
children f8bd40509a2d
comparison
equal deleted inserted replaced
1325:49f967fc87aa 1326:88e40f31b17e
25 from sat_frontends.tools import jid 25 from sat_frontends.tools import jid
26 from sat_frontends.quick_frontend.quick_widgets import QuickWidgetsManager 26 from sat_frontends.quick_frontend.quick_widgets import QuickWidgetsManager
27 from sat_frontends.quick_frontend import quick_chat 27 from sat_frontends.quick_frontend import quick_chat
28 28
29 from sat_frontends.quick_frontend.constants import Const as C 29 from sat_frontends.quick_frontend.constants import Const as C
30
31
32 try:
33 # FIXME: to be removed when an acceptable solution is here
34 unicode('') # XXX: unicode doesn't exist in pyjamas
35 except (TypeError, AttributeError): # Error raised is not the same depending on pyjsbuild options
36 unicode = str
30 37
31 38
32 class ProfileManager(object): 39 class ProfileManager(object):
33 """Class managing all data relative to one profile, and plugging in mechanism""" 40 """Class managing all data relative to one profile, and plugging in mechanism"""
34 host = None 41 host = None
599 if from_jid == C.ENTITY_ALL or from_jid.bare == widget.target.bare: 606 if from_jid == C.ENTITY_ALL or from_jid.bare == widget.target.bare:
600 widget.updateChatState(from_jid, state) 607 widget.updateChatState(from_jid, state)
601 608
602 def _subscribe_cb(self, answer, data): 609 def _subscribe_cb(self, answer, data):
603 entity, profile = data 610 entity, profile = data
604 if answer: 611 type_ = "subscribed" if answer else "unsubscribed"
605 self.bridge.subscription("subscribed", entity.bare, profile_key=profile) 612 self.bridge.subscription(type_, unicode(entity.bare), profile_key=profile)
606 else:
607 self.bridge.subscription("unsubscribed", entity.bare, profile_key=profile)
608 613
609 def subscribeHandler(self, type, raw_jid, profile): 614 def subscribeHandler(self, type, raw_jid, profile):
610 """Called when a subsciption management signal is received""" 615 """Called when a subsciption management signal is received"""
611 entity = jid.JID(raw_jid) 616 entity = jid.JID(raw_jid)
612 if type == "subscribed": 617 if type == "subscribed":