summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0153/vcard_avatar.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-01-16 22:33:05 -0800
committerLance Stout <lancestout@gmail.com>2013-01-16 22:33:05 -0800
commit01da222d67858ac82951a0a3b01670ea201abd9c (patch)
tree384c743f69b711c192b2f435be4f2dbe7cb116a8 /sleekxmpp/plugins/xep_0153/vcard_avatar.py
parent1dbfa29a1ebb9becb93911b33f026cc1a7a7faee (diff)
parent518eee05c224b00cf4622038290f5fb0c0d4e95b (diff)
downloadslixmpp-01da222d67858ac82951a0a3b01670ea201abd9c.tar.gz
slixmpp-01da222d67858ac82951a0a3b01670ea201abd9c.tar.bz2
slixmpp-01da222d67858ac82951a0a3b01670ea201abd9c.tar.xz
slixmpp-01da222d67858ac82951a0a3b01670ea201abd9c.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0153/vcard_avatar.py')
-rw-r--r--sleekxmpp/plugins/xep_0153/vcard_avatar.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0153/vcard_avatar.py b/sleekxmpp/plugins/xep_0153/vcard_avatar.py
index c74713e5..03106247 100644
--- a/sleekxmpp/plugins/xep_0153/vcard_avatar.py
+++ b/sleekxmpp/plugins/xep_0153/vcard_avatar.py
@@ -78,7 +78,17 @@ class XEP_0153(BasePlugin):
self.xmpp.roster[jid].send_last_presence()
def _start(self, event):
- vcard = self.xmpp['xep_0054'].get_vcard()
+ try:
+ vcard = self.xmpp['xep_0054'].get_vcard()
+ data = vcard['vcard_temp']['PHOTO']['BINVAL']
+ if not data:
+ new_hash = ''
+ else:
+ new_hash = hashlib.sha1(data).hexdigest()
+ self.api['set_hash'](self.xmpp.boundjid, args=new_hash)
+ except XMPPError:
+ log.debug('Could not retrieve vCard for %s' % jid)
+
self._allow_advertising.set()
def _end(self, event):