comparison frontends/src/quick_frontend/quick_app.py @ 2040:f607349a01a4

quick frontend (chat): fixed messageNew signal dispatching when several widgets are handling the target
author Goffi <goffi@goffi.org>
date Sun, 21 Aug 2016 17:04:33 +0200
parents db3bbbd745e4
children 2e948c228643
comparison
equal deleted inserted replaced
2039:6353deb1bd73 2040:f607349a01a4
477 return 477 return
478 478
479 from_me = from_jid.bare == self.profiles[profile].whoami.bare 479 from_me = from_jid.bare == self.profiles[profile].whoami.bare
480 target = to_jid if from_me else from_jid 480 target = to_jid if from_me else from_jid
481 contact_list = self.contact_lists[profile] 481 contact_list = self.contact_lists[profile]
482 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, target, type_=C.CHAT_ONE2ONE, on_new_widget=None, profile=profile) 482 # we want to be sure to have at least one QuickChat instance
483 self.widgets.getOrCreateWidget(quick_chat.QuickChat, target, type_=C.CHAT_ONE2ONE, on_new_widget=None, profile=profile)
483 484
484 self.current_action_ids = set() # FIXME: to be removed 485 self.current_action_ids = set() # FIXME: to be removed
485 self.current_action_ids_cb = {} # FIXME: to be removed 486 self.current_action_ids_cb = {} # FIXME: to be removed
486 487
487 if not from_jid in contact_list and from_jid.bare != self.profiles[profile].whoami.bare: 488 if not from_jid in contact_list and from_jid.bare != self.profiles[profile].whoami.bare:
488 #XXX: needed to show entities which haven't sent any 489 #XXX: needed to show entities which haven't sent any
489 # presence information and which are not in roster 490 # presence information and which are not in roster
490 contact_list.setContact(from_jid) 491 contact_list.setContact(from_jid)
491 492
492 # we display the message in the widget 493 # we dispatch the message in the widgets
493 494 for widget in self.widgets.getWidgets(quick_chat.QuickChat, target=target, profiles=(profile,)):
494 chat_widget.messageNew(uid, timestamp, from_jid, target, msg, subject, type_, extra, profile) 495 widget.messageNew(uid, timestamp, from_jid, target, msg, subject, type_, extra, profile)
495 496
496 def messageStateHandler(self, uid, status, profile): 497 def messageStateHandler(self, uid, status, profile):
497 for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)): 498 for widget in self.widgets.getWidgets(quick_chat.QuickChat, profiles=(profile,)):
498 widget.onMessageState(uid, status, profile) 499 widget.onMessageState(uid, status, profile)
499 500