plugin XEP-0054: added profile own jid to _fillCachedValues (needed to have its own avatar)

This commit is contained in:
Goffi 2012-12-18 00:02:28 +01:00
commit 14d53e09ac

View file

@ -85,7 +85,7 @@ class XEP_0054():
# the current naive approach keeps a map between all jids of all profiles
# in persistent cache, and check if cached jid are in roster, then put avatar
# hashs in memory.
for _jid in client.roster.getBareJids():
for _jid in client.roster.getBareJids() + [client.jid.userhost()]:
if _jid in self.avatars_cache:
self.host.memory.updateEntityData(jid.JID(_jid), "avatar", self.avatars_cache[_jid], client.profile)
@ -185,16 +185,16 @@ class XEP_0054():
error (_("Can't find VCard of %s") % failure.value.stanza['from'])
self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) #FIXME: maybe an error message would be better
def getCard(self, target, profile_key='@DEFAULT@'):
def getCard(self, target_s, profile_key='@DEFAULT@'):
"""Ask server for VCard
@param target: jid from which we want the VCard
@param target_s: jid from which we want the VCard
@result: id to retrieve the profile"""
current_jid, xmlstream = self.host.getJidNStream(profile_key)
if not xmlstream:
error (_('Asking vcard for an non-existant or not connected profile'))
return ""
profile = self.host.memory.getProfileName(profile_key)
to_jid = jid.JID(target)
to_jid = jid.JID(target_s)
debug(_("Asking for %s's VCard") % to_jid.userhost())
reg_request=IQ(xmlstream,'get')
reg_request["from"]=current_jid.full()