comparison frontends/src/quick_frontend/quick_app.py @ 504:65ecbb473cbb

core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard: - bridge: new bridge method getEntityData and signal entityDataUpdated - core: entityDataUpdated signal sent on new string data - quick frontend: fixed avatars/vcard infos, fixed _replace in quick_contact_list - plugin xep-0054: dropped updatedValue signal, use entities data instead
author Goffi <goffi@goffi.org>
date Wed, 26 Sep 2012 01:23:56 +0200
parents 10119c2a9d33
children f98bef71a918
comparison
equal deleted inserted replaced
503:10119c2a9d33 504:65ecbb473cbb
50 self.bridge.register("newAlert", self.newAlert) 50 self.bridge.register("newAlert", self.newAlert)
51 self.bridge.register("presenceUpdate", self.presenceUpdate) 51 self.bridge.register("presenceUpdate", self.presenceUpdate)
52 self.bridge.register("subscribe", self.subscribe) 52 self.bridge.register("subscribe", self.subscribe)
53 self.bridge.register("paramUpdate", self.paramUpdate) 53 self.bridge.register("paramUpdate", self.paramUpdate)
54 self.bridge.register("contactDeleted", self.contactDeleted) 54 self.bridge.register("contactDeleted", self.contactDeleted)
55 self.bridge.register("updatedValue", self.updatedValue) 55 self.bridge.register("entityDataUpdated", self.entityDataUpdated)
56 self.bridge.register("askConfirmation", self.askConfirmation) 56 self.bridge.register("askConfirmation", self.askConfirmation)
57 self.bridge.register("actionResult", self.actionResult) 57 self.bridge.register("actionResult", self.actionResult)
58 self.bridge.register("actionResultExt", self.actionResult) 58 self.bridge.register("actionResultExt", self.actionResult)
59 self.bridge.register("roomJoined", self.roomJoined, "plugin") 59 self.bridge.register("roomJoined", self.roomJoined, "plugin")
60 self.bridge.register("roomUserJoined", self.roomUserJoined, "plugin") 60 self.bridge.register("roomUserJoined", self.roomUserJoined, "plugin")
163 jabber_id = contact+('/'+res if res else '') 163 jabber_id = contact+('/'+res if res else '')
164 show = presences[contact][res][0] 164 show = presences[contact][res][0]
165 priority = presences[contact][res][1] 165 priority = presences[contact][res][1]
166 statuses = presences[contact][res][2] 166 statuses = presences[contact][res][2]
167 self.presenceUpdate(jabber_id, show, priority, statuses, profile) 167 self.presenceUpdate(jabber_id, show, priority, statuses, profile)
168 data = self.bridge.getEntityData(contact, ['avatar','nick'], profile)
169 for key in ('avatar', 'nick'):
170 if key in data:
171 self.entityDataUpdated(contact, key, data[key], profile)
168 172
169 #The waiting subscription requests 173 #The waiting subscription requests
170 waitingSub = self.bridge.getWaitingSub(profile) 174 waitingSub = self.bridge.getWaitingSub(profile)
171 for sub in waitingSub: 175 for sub in waitingSub:
172 self.subscribe(waitingSub[sub], sub, profile) 176 self.subscribe(waitingSub[sub], sub, profile)
474 try: 478 try:
475 self.profiles[profile]['onlineContact'].remove(target.short) 479 self.profiles[profile]['onlineContact'].remove(target.short)
476 except KeyError: 480 except KeyError:
477 pass 481 pass
478 482
479 def updatedValue(self, name, data, profile): 483 def entityDataUpdated(self, jid_str, key, value, profile):
480 #FIXME: to be removed 484 if not self.check_profile(profile):
481 if not self.check_profile(profile): 485 return
482 return 486 jid = JID(jid_str)
483 if name == "card_nick": 487 if key == "nick":
484 target = JID(data['jid']) 488 if jid in self.contact_list:
485 if target in self.contact_list: 489 self.contact_list.setCache(jid, 'nick', value)
486 #self.CM.update(target, 'nick', unicode(data['nick'])) 490 self.contact_list._replace(jid)
487 self.contact_list._replace(target) 491 elif key == "avatar":
488 elif name == "card_avatar": 492 if jid in self.contact_list:
489 target = JID(data['jid']) 493 filename = self.bridge.getAvatarFile(value)
490 if target in self.contact_list: 494 self.contact_list.setCache(jid, 'avatar', filename)
491 filename = self.bridge.getAvatarFile(data['avatar']) 495 self.contact_list._replace(jid)
492 #self.CM.update(target, 'avatar', filename)
493 self.contact_list._replace(target)
494 496
495 def askConfirmation(self, type, id, data): 497 def askConfirmation(self, type, id, data):
496 raise NotImplementedError 498 raise NotImplementedError
497 499
498 def actionResult(self, type, id, data): 500 def actionResult(self, type, id, data):