at startup use our cached vcard to get the sha

then ask the vcard, and resend a new presence only if avatar has changed
This commit is contained in:
Yann Leboulanger 2005-10-31 20:51:45 +00:00
parent 878b274481
commit 9ea8a2d8e8
1 changed files with 8 additions and 3 deletions

View File

@ -271,9 +271,12 @@ class Connection:
vcard['jid'] = frm
vcard['resource'] = resource
if frm == our_jid:
self.vcard_sha = avatar_sha
self.dispatch('MYVCARD', vcard)
#we re-send our presence with sha if we are not invisible
# we re-send our presence with sha if has changed and if we are
# not invisible
if self.vcard_sha == avatar_sha:
return
self.vcard_sha = avatar_sha
if STATUS_LIST[self.connected] == 'invisible':
return
sshow = helpers.get_xmpp_show(STATUS_LIST[self.connected])
@ -1268,6 +1271,9 @@ class Connection:
return
prio = unicode(gajim.config.get_per('accounts', self.name,
'priority'))
vcard = self.get_cached_vcard(jid)
if vcard.has_key('PHOTO') and vcard['PHOTO'].has_key('SHA'):
self.vcard_sha = vcard['PHOTO']['SHA']
p = common.xmpp.Presence(typ = None, priority = prio, show = sshow)
p = self.add_sha(p)
if msg:
@ -1907,7 +1913,6 @@ class Connection:
vcard = self.node_to_dict(card)
if vcard.has_key('PHOTO') and vcard['PHOTO'].has_key('SHA'):
cached_sha = vcard['PHOTO']['SHA']
del vcard['PHOTO']['SHA']
if self.vcard_shas.has_key(jid) and self.vcard_shas[jid] != \
cached_sha:
# we had an old cached vcard