comparison frontends/src/quick_frontend/quick_app.py @ 737:378af36155c2

frontends: set and retrieve your own presence and status
author souliane <souliane@mailoo.org>
date Mon, 25 Nov 2013 01:56:07 +0100
parents 6246eb6d64a0
children 318acc83a392
comparison
equal deleted inserted replaced
736:6246eb6d64a0 737:378af36155c2
292 if not self.check_profile(profile): 292 if not self.check_profile(profile):
293 return 293 return
294 assert alert_type in ['INFO','ERROR'] 294 assert alert_type in ['INFO','ERROR']
295 self.showDialog(unicode(msg),unicode(title),alert_type.lower()) 295 self.showDialog(unicode(msg),unicode(title),alert_type.lower())
296 296
297 def setStatusOnline(self, online=True): 297 def setStatusOnline(self, online=True, show="", statuses={}):
298 pass 298 raise NotImplementedError
299 299
300 def presenceUpdate(self, jabber_id, show, priority, statuses, profile): 300 def presenceUpdate(self, jabber_id, show, priority, statuses, profile):
301 if not self.check_profile(profile): 301 if not self.check_profile(profile):
302 return 302 return
303
303 debug(_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") 304 debug(_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]")
304 % {'jid': jabber_id, 'show': show, 'priority': priority, 'statuses': statuses, 'profile': profile}) 305 % {'jid': jabber_id, 'show': show, 'priority': priority, 'statuses': statuses, 'profile': profile})
305 from_jid = JID(jabber_id) 306 from_jid = JID(jabber_id)
306 debug("from_jid.bare=%(from_jid)s whoami.bare=%(whoami)s" % {'from_jid': from_jid.bare, 'whoami': self.profiles[profile]['whoami'].bare}) 307 debug("from_jid.bare=%(from_jid)s whoami.bare=%(whoami)s" % {'from_jid': from_jid.bare, 'whoami': self.profiles[profile]['whoami'].bare})
307 308
308 if from_jid.bare == self.profiles[profile]['whoami'].bare: 309 if from_jid.bare == self.profiles[profile]['whoami'].bare:
309 if show == "unavailable": 310 if show == "unavailable":
310 self.setStatusOnline(False) 311 self.setStatusOnline(False)
311 else: 312 else:
312 self.setStatusOnline(True) 313 self.setStatusOnline(True, show, statuses)
313 return 314 return
314 315
315 self.contact_list.updatePresence(from_jid, show, priority, statuses) 316 self.contact_list.updatePresence(from_jid, show, priority, statuses)
316 317
317 if show != 'unavailable': 318 if show != 'unavailable':