diff options
author | Lance Stout <lancestout@gmail.com> | 2012-08-13 11:12:41 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-08-13 11:12:41 -0700 |
commit | 04dc68f5f63508a512e7fbebc873a85961fdb005 (patch) | |
tree | c9f90aa9c0cccdac7d2370e156c1cc2a9d702718 /sleekxmpp/plugins/xep_0153/vcard_avatar.py | |
parent | 5c25208fb53e5fd08be032ce96307302d18ab27b (diff) | |
parent | 92be0514504747811af0b4f160fe8f2b63bf454d (diff) | |
download | slixmpp-04dc68f5f63508a512e7fbebc873a85961fdb005.tar.gz slixmpp-04dc68f5f63508a512e7fbebc873a85961fdb005.tar.bz2 slixmpp-04dc68f5f63508a512e7fbebc873a85961fdb005.tar.xz slixmpp-04dc68f5f63508a512e7fbebc873a85961fdb005.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.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0153/vcard_avatar.py b/sleekxmpp/plugins/xep_0153/vcard_avatar.py index d940ead1..c74713e5 100644 --- a/sleekxmpp/plugins/xep_0153/vcard_avatar.py +++ b/sleekxmpp/plugins/xep_0153/vcard_avatar.py @@ -12,6 +12,7 @@ import threading from sleekxmpp import JID from sleekxmpp.stanza import Presence +from sleekxmpp.exceptions import XMPPError from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.xmlstream.matcher import StanzaPath from sleekxmpp.xmlstream.handler import Callback @@ -103,15 +104,18 @@ class XEP_0153(BasePlugin): if own_jid: self.xmpp.roster[jid].send_last_presence() - iq = self.xmpp['xep_0054'].get_vcard(jid=jid.bare, ifrom=ifrom) + try: + iq = self.xmpp['xep_0054'].get_vcard(jid=jid.bare, ifrom=ifrom) - data = iq['vcard_temp']['PHOTO']['BINVAL'] - if not data: - new_hash = '' - else: - new_hash = hashlib.sha1(data).hexdigest() + data = iq['vcard_temp']['PHOTO']['BINVAL'] + if not data: + new_hash = '' + else: + new_hash = hashlib.sha1(data).hexdigest() - self.api['set_hash'](jid, args=new_hash) + self.api['set_hash'](jid, args=new_hash) + except XMPPError: + log.debug('Could not retrieve vCard for %s' % jid) def _recv_presence(self, pres): if not pres.match('presence/vcard_temp_update'): |