changeset 735:682933ca304c

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"
author souliane <souliane@mailoo.org>
date Sun, 24 Nov 2013 11:22:20 +0100
parents b26dfac8e46c
children 6246eb6d64a0
files frontends/src/quick_frontend/quick_app.py
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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):