comparison frontends/src/quick_frontend/quick_app.py @ 1377:017270e6eea4

quick_frontends, primitivus: know who are the MUC occupants from the presence informations: - QuickChat.occupants is now a property using cached information - some MUC handlers are no more needed, the presence handler is enough
author souliane <souliane@mailoo.org>
date Fri, 20 Mar 2015 16:25:38 +0100
parents 0befb14ecf62
children 3dae6964c071
comparison
equal deleted inserted replaced
1376:28fd9e838f8f 1377:017270e6eea4
532 log.debug("Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s" % {'room_jid': room_jid_s, 'profile': profile, 'users': room_nicks}) 532 log.debug("Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s" % {'room_jid': room_jid_s, 'profile': profile, 'users': room_nicks})
533 room_jid = jid.JID(room_jid_s) 533 room_jid = jid.JID(room_jid_s)
534 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) 534 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
535 chat_widget.setUserNick(user_nick) 535 chat_widget.setUserNick(user_nick)
536 chat_widget.id = room_jid # FIXME: to be removed 536 chat_widget.id = room_jid # FIXME: to be removed
537 room_nicks = [unicode(nick) for nick in room_nicks] # FIXME: should be done in DBus bridge / is that still needed?!
538 nicks = list(set([user_nick] + room_nicks))
539 nicks.sort()
540 chat_widget.setPresents(nicks)
541 self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP) 537 self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP)
542 538
543 def roomLeftHandler(self, room_jid_s, profile): 539 def roomLeftHandler(self, room_jid_s, profile):
544 """Called when a MUC room is left""" 540 """Called when a MUC room is left"""
545 log.debug("Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile}) 541 log.debug("Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile})
551 547
552 def roomUserJoinedHandler(self, room_jid_s, user_nick, user_data, profile): 548 def roomUserJoinedHandler(self, room_jid_s, user_nick, user_data, profile):
553 """Called when an user joined a MUC room""" 549 """Called when an user joined a MUC room"""
554 room_jid = jid.JID(room_jid_s) 550 room_jid = jid.JID(room_jid_s)
555 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) 551 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
556 chat_widget.replaceUser(user_nick) 552 chat_widget.addUser(user_nick)
557 log.debug("user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) 553 log.debug("user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid})
558 554
559 def roomUserLeftHandler(self, room_jid_s, user_nick, user_data, profile): 555 def roomUserLeftHandler(self, room_jid_s, user_nick, user_data, profile):
560 """Called when an user joined a MUC room""" 556 """Called when an user joined a MUC room"""
561 room_jid = jid.JID(room_jid_s) 557 room_jid = jid.JID(room_jid_s)