comparison sat_frontends/quick_frontend/quick_app.py @ 2792:441b536e28ed

quick frontend (chat): use right type in getOrCreateWidget on new message
author Goffi <goffi@goffi.org>
date Tue, 22 Jan 2019 18:52:16 +0100
parents 19ab67e28822
children 0b7ce5daee9b
comparison
equal deleted inserted replaced
2791:034c88e9cd93 2792:441b536e28ed
672 return 672 return
673 673
674 from_me = from_jid.bare == self.profiles[profile].whoami.bare 674 from_me = from_jid.bare == self.profiles[profile].whoami.bare
675 target = to_jid if from_me else from_jid 675 target = to_jid if from_me else from_jid
676 contact_list = self.contact_lists[profile] 676 contact_list = self.contact_lists[profile]
677 if target.resource and not contact_list.isRoom(target.bare): 677
678 try:
679 is_room = contact_list.isRoom(target.bare)
680 except exceptions.NotFound:
681 is_room = False
682
683 if target.resource and not is_room:
678 # we avoid resource locking, but we must keep resource for private MUC 684 # we avoid resource locking, but we must keep resource for private MUC
679 # messages 685 # messages
680 target = target.bare 686 target = target.bare
681 # we want to be sure to have at least one QuickChat instance 687 # we want to be sure to have at least one QuickChat instance
682 self.widgets.getOrCreateWidget( 688 self.widgets.getOrCreateWidget(
683 quick_chat.QuickChat, 689 quick_chat.QuickChat,
684 target, 690 target,
685 type_=C.CHAT_ONE2ONE, 691 type_ = C.CHAT_GROUP if is_room else C.CHAT_ONE2ONE,
686 on_new_widget=None, 692 on_new_widget = None,
687 profile=profile, 693 profile = profile,
688 ) 694 )
689 695
690 if ( 696 if (
691 not from_jid in contact_list 697 not from_jid in contact_list
692 and from_jid.bare != self.profiles[profile].whoami.bare 698 and from_jid.bare != self.profiles[profile].whoami.bare