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
This commit is contained in:
Goffi 2012-09-26 01:23:56 +02:00
commit 0f6de78a3b

View file

@ -52,7 +52,7 @@ class QuickApp():
self.bridge.register("subscribe", self.subscribe)
self.bridge.register("paramUpdate", self.paramUpdate)
self.bridge.register("contactDeleted", self.contactDeleted)
self.bridge.register("updatedValue", self.updatedValue)
self.bridge.register("entityDataUpdated", self.entityDataUpdated)
self.bridge.register("askConfirmation", self.askConfirmation)
self.bridge.register("actionResult", self.actionResult)
self.bridge.register("actionResultExt", self.actionResult)
@ -165,6 +165,10 @@ class QuickApp():
priority = presences[contact][res][1]
statuses = presences[contact][res][2]
self.presenceUpdate(jabber_id, show, priority, statuses, profile)
data = self.bridge.getEntityData(contact, ['avatar','nick'], profile)
for key in ('avatar', 'nick'):
if key in data:
self.entityDataUpdated(contact, key, data[key], profile)
#The waiting subscription requests
waitingSub = self.bridge.getWaitingSub(profile)
@ -476,21 +480,19 @@ class QuickApp():
except KeyError:
pass
def updatedValue(self, name, data, profile):
#FIXME: to be removed
def entityDataUpdated(self, jid_str, key, value, profile):
if not self.check_profile(profile):
return
if name == "card_nick":
target = JID(data['jid'])
if target in self.contact_list:
#self.CM.update(target, 'nick', unicode(data['nick']))
self.contact_list._replace(target)
elif name == "card_avatar":
target = JID(data['jid'])
if target in self.contact_list:
filename = self.bridge.getAvatarFile(data['avatar'])
#self.CM.update(target, 'avatar', filename)
self.contact_list._replace(target)
jid = JID(jid_str)
if key == "nick":
if jid in self.contact_list:
self.contact_list.setCache(jid, 'nick', value)
self.contact_list._replace(jid)
elif key == "avatar":
if jid in self.contact_list:
filename = self.bridge.getAvatarFile(value)
self.contact_list.setCache(jid, 'avatar', filename)
self.contact_list._replace(jid)
def askConfirmation(self, type, id, data):
raise NotImplementedError