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"
This commit is contained in:
souliane 2013-11-24 11:22:20 +01:00
commit b824f9c2ce

View file

@ -294,22 +294,22 @@ class QuickApp(object):
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:
self.setStatusOnline(True)
elif type=="unavailable":
if from_jid.bare == self.profiles[profile]['whoami'].bare:
if show == "unavailable":
self.setStatusOnline(False)
else:
self.setStatusOnline(True)
return
self.contact_list.updatePresence(from_jid, show, priority, statuses)
@ -320,11 +320,11 @@ class QuickApp(object):
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):