comparison frontends/src/quick_frontend/quick_app.py @ 1409:3265a2639182

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:57 +0200
parents 96dd0ae1a850
children 176de79c8c39
comparison
equal deleted inserted replaced
1408:8a7145138330 1409:3265a2639182
79 # Profile can be connected or not 79 # Profile can be connected or not
80 # we get cached data 80 # we get cached data
81 self.host.bridge.getEntitiesData([], ProfileManager.cache_keys_to_get, profile=self.profile, callback=self._plug_profile_gotCachedValues, errback=self._plug_profile_failedCachedValues) 81 self.host.bridge.getEntitiesData([], ProfileManager.cache_keys_to_get, profile=self.profile, callback=self._plug_profile_gotCachedValues, errback=self._plug_profile_failedCachedValues)
82 82
83 def _plug_profile_failedCachedValues(self, failure): 83 def _plug_profile_failedCachedValues(self, failure):
84 log.error("Couldn't get cached values: {}".format(failure)) 84 log.error(u"Couldn't get cached values: {}".format(failure))
85 self._plug_profile_gotCachedValues({}) 85 self._plug_profile_gotCachedValues({})
86 86
87 def _plug_profile_gotCachedValues(self, cached_values): 87 def _plug_profile_gotCachedValues(self, cached_values):
88 # TODO: watched plugin 88 # TODO: watched plugin
89 89
137 jabber_id = ('%s/%s' % (jid.JID(contact).bare, res)) if res else contact 137 jabber_id = ('%s/%s' % (jid.JID(contact).bare, res)) if res else contact
138 show = presences[contact][res][0] 138 show = presences[contact][res][0]
139 priority = presences[contact][res][1] 139 priority = presences[contact][res][1]
140 statuses = presences[contact][res][2] 140 statuses = presences[contact][res][2]
141 self.host.presenceUpdateHandler(jabber_id, show, priority, statuses, self.profile) 141 self.host.presenceUpdateHandler(jabber_id, show, priority, statuses, self.profile)
142 self.host.bridge.getEntityData(contact, ['avatar', 'nick'], self.profile, callback=lambda data, contact=contact: gotEntityData(data, contact), errback=lambda failure, contact=contact: log.debug("No cache data for {}".format(contact))) 142 self.host.bridge.getEntityData(contact, ['avatar', 'nick'], self.profile, callback=lambda data, contact=contact: gotEntityData(data, contact), errback=lambda failure, contact=contact: log.debug(u"No cache data for {}".format(contact)))
143 143
144 #Finaly, we get the waiting confirmation requests 144 #Finaly, we get the waiting confirmation requests
145 self.bridge.getWaitingConf(self.profile, callback=self._plug_profile_gotWaitingConf) 145 self.bridge.getWaitingConf(self.profile, callback=self._plug_profile_gotWaitingConf)
146 146
147 def _plug_profile_gotWaitingConf(self, waiting_confs): 147 def _plug_profile_gotWaitingConf(self, waiting_confs):
508 def setStatusOnline(self, online=True, show="", statuses={}, profile=C.PROF_KEY_NONE): 508 def setStatusOnline(self, online=True, show="", statuses={}, profile=C.PROF_KEY_NONE):
509 raise NotImplementedError 509 raise NotImplementedError
510 510
511 def presenceUpdateHandler(self, entity_s, show, priority, statuses, profile): 511 def presenceUpdateHandler(self, entity_s, show, priority, statuses, profile):
512 512
513 log.debug(_("presence update for %(entity)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") 513 log.debug(_(u"presence update for %(entity)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]")
514 % {'entity': entity_s, C.PRESENCE_SHOW: show, C.PRESENCE_PRIORITY: priority, C.PRESENCE_STATUSES: statuses, 'profile': profile}) 514 % {'entity': entity_s, C.PRESENCE_SHOW: show, C.PRESENCE_PRIORITY: priority, C.PRESENCE_STATUSES: statuses, 'profile': profile})
515 entity = jid.JID(entity_s) 515 entity = jid.JID(entity_s)
516 516
517 if entity == self.profiles[profile].whoami: 517 if entity == self.profiles[profile].whoami:
518 if show == "unavailable": 518 if show == "unavailable":
527 527
528 self.callListeners('presence', entity, show, priority, statuses, profile=profile) 528 self.callListeners('presence', entity, show, priority, statuses, profile=profile)
529 529
530 def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile): 530 def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile):
531 """Called when a MUC room is joined""" 531 """Called when a MUC room is joined"""
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(u"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(unicode(user_nick)) 535 chat_widget.setUserNick(unicode(user_nick))
536 self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP) 536 self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP)
537 chat_widget.update() 537 chat_widget.update()
538 538
539 def roomLeftHandler(self, room_jid_s, profile): 539 def roomLeftHandler(self, room_jid_s, profile):
540 """Called when a MUC room is left""" 540 """Called when a MUC room is left"""
541 log.debug("Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile}) 541 log.debug(u"Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile})
542 room_jid = jid.JID(room_jid_s) 542 room_jid = jid.JID(room_jid_s)
543 chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile) 543 chat_widget = self.widgets.getWidget(quick_chat.QuickChat, room_jid, profile)
544 if chat_widget: 544 if chat_widget:
545 self.widgets.deleteWidget(chat_widget) 545 self.widgets.deleteWidget(chat_widget)
546 self.contact_lists[profile].removeContact(room_jid) 546 self.contact_lists[profile].removeContact(room_jid)
548 def roomUserJoinedHandler(self, room_jid_s, user_nick, user_data, profile): 548 def roomUserJoinedHandler(self, room_jid_s, user_nick, user_data, profile):
549 """Called when an user joined a MUC room""" 549 """Called when an user joined a MUC room"""
550 room_jid = jid.JID(room_jid_s) 550 room_jid = jid.JID(room_jid_s)
551 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)
552 chat_widget.addUser(user_nick) 552 chat_widget.addUser(user_nick)
553 log.debug("user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) 553 log.debug(u"user [%(user_nick)s] joined room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid})
554 554
555 def roomUserLeftHandler(self, room_jid_s, user_nick, user_data, profile): 555 def roomUserLeftHandler(self, room_jid_s, user_nick, user_data, profile):
556 """Called when an user joined a MUC room""" 556 """Called when an user joined a MUC room"""
557 room_jid = jid.JID(room_jid_s) 557 room_jid = jid.JID(room_jid_s)
558 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) 558 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
559 chat_widget.removeUser(user_nick) 559 chat_widget.removeUser(user_nick)
560 log.debug("user [%(user_nick)s] left room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid}) 560 log.debug(u"user [%(user_nick)s] left room [%(room_jid)s]" % {'user_nick': user_nick, 'room_jid': room_jid})
561 561
562 def roomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile): 562 def roomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
563 """Called when an user joined a MUC room""" 563 """Called when an user joined a MUC room"""
564 room_jid = jid.JID(room_jid_s) 564 room_jid = jid.JID(room_jid_s)
565 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) 565 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
566 chat_widget.changeUserNick(old_nick, new_nick) 566 chat_widget.changeUserNick(old_nick, new_nick)
567 log.debug("user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]" % {'old_nick': old_nick, 'new_nick': new_nick, 'room_jid': room_jid}) 567 log.debug(u"user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]" % {'old_nick': old_nick, 'new_nick': new_nick, 'room_jid': room_jid})
568 568
569 def roomNewSubjectHandler(self, room_jid_s, subject, profile): 569 def roomNewSubjectHandler(self, room_jid_s, subject, profile):
570 """Called when subject of MUC room change""" 570 """Called when subject of MUC room change"""
571 room_jid = jid.JID(room_jid_s) 571 room_jid = jid.JID(room_jid_s)
572 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile) 572 chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
573 chat_widget.setSubject(subject) 573 chat_widget.setSubject(subject)
574 log.debug("new subject for room [%(room_jid)s]: %(subject)s" % {'room_jid': room_jid, "subject": subject}) 574 log.debug(u"new subject for room [%(room_jid)s]: %(subject)s" % {'room_jid': room_jid, "subject": subject})
575 575
576 def chatStateReceivedHandler(self, from_jid_s, state, profile): 576 def chatStateReceivedHandler(self, from_jid_s, state, profile):
577 """Called when a new chat state (XEP-0085) is received. 577 """Called when a new chat state (XEP-0085) is received.
578 578
579 @param from_jid_s (unicode): JID of a contact or C.ENTITY_ALL 579 @param from_jid_s (unicode): JID of a contact or C.ENTITY_ALL
628 628
629 def showAlert(self, message): 629 def showAlert(self, message):
630 pass #FIXME 630 pass #FIXME
631 631
632 def paramUpdateHandler(self, name, value, namespace, profile): 632 def paramUpdateHandler(self, name, value, namespace, profile):
633 log.debug(_("param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value}) 633 log.debug(_(u"param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace': namespace, 'name': name, 'value': value})
634 if (namespace, name) == ("Connection", "JabberID"): 634 if (namespace, name) == ("Connection", "JabberID"):
635 log.debug(_("Changing JID to %s") % value) 635 log.debug(_(u"Changing JID to %s") % value)
636 self.profiles[profile].whoami = jid.JID(value) 636 self.profiles[profile].whoami = jid.JID(value)
637 elif (namespace, name) == ("Misc", "Watched"): 637 elif (namespace, name) == ("Misc", "Watched"):
638 self.profiles[profile]['watched'] = value.split() 638 self.profiles[profile]['watched'] = value.split()
639 elif (namespace, name) == ('General', C.SHOW_OFFLINE_CONTACTS): 639 elif (namespace, name) == ('General', C.SHOW_OFFLINE_CONTACTS):
640 self.contact_lists[profile].showOfflineContacts(C.bool(value)) 640 self.contact_lists[profile].showOfflineContacts(C.bool(value))