diff frontends/src/quick_frontend/quick_app.py @ 955:cad958239b5c

quick frontends: first connection fixes
author Goffi <goffi@goffi.org>
date Mon, 31 Mar 2014 15:22:35 +0200
parents 71926ec2114d
children d1084f7e56a5
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Mon Mar 31 12:35:59 2014 +0200
+++ b/frontends/src/quick_frontend/quick_app.py	Mon Mar 31 15:22:35 2014 +0200
@@ -318,15 +318,15 @@
         if show != 'unavailable':
 
             #FIXME: must be moved in a plugin
-            if from_jid.bare in self.profiles[profile]['watched'] and not from_jid.bare in self.profiles[profile]['onlineContact']:
+            if from_jid.bare in self.profiles[profile].get('watched',[]) and not from_jid.bare in self.profiles[profile]['onlineContact']:
                 self.showAlert(_("Watched jid [%s] is connected !") % from_jid.bare)
 
             presences[jabber_id] = {'show': show, 'priority': priority, 'statuses': statuses}
-            self.profiles[profile]['onlineContact'].add(from_jid)  # FIXME onlineContact is useless with CM, must be removed
+            self.profiles[profile].setdefault('onlineContact',set()).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].get('onlineContact',set()):
             try:
                 del presences[jabber_id]
             except KeyError: