# HG changeset patch # User souliane # Date 1385288540 -3600 # Node ID 682933ca304c0e8144066d915912810a572e26eb # Parent b26dfac8e46c6411114ec012a3c015b8889bbd1c frontends: presence update in quick app: - bug fix "s/type/show/g" - better PEP8 compliance - all "show" value different then "unavailable" mean (more or less) "online" diff -r b26dfac8e46c -r 682933ca304c frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Sun Nov 24 11:15:54 2013 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Sun Nov 24 11:22:20 2013 +0100 @@ -294,22 +294,22 @@ assert alert_type in ['INFO','ERROR'] self.showDialog(unicode(msg),unicode(title),alert_type.lower()) - def setStatusOnline(self, online=True): pass def presenceUpdate(self, jabber_id, show, priority, statuses, profile): if not self.check_profile(profile): return - debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile}) - from_jid=JID(jabber_id) - debug ("from_jid.bare=%(from_jid)s whoami.bare=%(whoami)s" % {'from_jid':from_jid.bare, 'whoami':self.profiles[profile]['whoami'].bare}) + debug(_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") + % {'jid': jabber_id, 'show': show, 'priority': priority, 'statuses': statuses, 'profile': profile}) + from_jid = JID(jabber_id) + debug("from_jid.bare=%(from_jid)s whoami.bare=%(whoami)s" % {'from_jid': from_jid.bare, 'whoami': self.profiles[profile]['whoami'].bare}) - if from_jid.bare==self.profiles[profile]['whoami'].bare: - if not type: + if from_jid.bare == self.profiles[profile]['whoami'].bare: + if show == "unavailable": + self.setStatusOnline(False) + else: self.setStatusOnline(True) - elif type=="unavailable": - self.setStatusOnline(False) return self.contact_list.updatePresence(from_jid, show, priority, statuses) @@ -320,11 +320,11 @@ if from_jid.bare in self.profiles[profile]['watched'] and not from_jid.bare in self.profiles[profile]['onlineContact']: self.showAlert(_("Watched jid [%s] is connected !") % from_jid.bare) - self.profiles[profile]['onlineContact'].add(from_jid) #FIXME onlineContact is useless with CM, must be removed + self.profiles[profile]['onlineContact'].add(from_jid) # FIXME onlineContact is useless with CM, must be removed #TODO: vcard data (avatar) - if show=="unavailable" and from_jid in self.profiles[profile]['onlineContact']: + if show == "unavailable" and from_jid in self.profiles[profile]['onlineContact']: self.profiles[profile]['onlineContact'].remove(from_jid) def roomJoined(self, room_jid, room_nicks, user_nick, profile):