changeset 1437:a568fc14ab46

plugin XEP-0054: fixes bug introduced by changeset 1255 (38fb8823cee8)
author souliane <souliane@mailoo.org>
date Tue, 14 Jul 2015 12:57:07 +0200
parents e27963c9c219
children 0fb5785b4c63
files src/plugins/plugin_xep_0054.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0054.py	Mon Jul 13 13:33:54 2015 +0200
+++ b/src/plugins/plugin_xep_0054.py	Tue Jul 14 12:57:07 2015 +0200
@@ -242,10 +242,11 @@
     def _VCardEb(self, failure, profile):
         """Called when something is wrong with registration"""
         try:
+            self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile)  # FIXME: maybe an error message would be better
             log.warning(_(u"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
             self.updateCache(jid.JID(failure.value.stanza['from']), "avatar", '', profile)
-        except AttributeError:  # 'ConnectionLost' object has no attribute 'stanza'
+        except (AttributeError, KeyError):
+            # 'ConnectionLost' object has no attribute 'stanza' + sometimes 'from' key doesn't exist
             log.warning(_(u"Can't find VCard: %s") % failure.getErrorMessage())
 
     def _getCard(self, target_s, profile_key=C.PROF_KEY_NONE):