comparison src/plugins/plugin_xep_0054.py @ 1248:77a4592816f6

plugin XEP-0054: fixes error message when we get a ConnectionLost failure
author souliane <souliane@mailoo.org>
date Sun, 19 Oct 2014 15:25:04 +0200
parents 8b891f9be183
children 38fb8823cee8
comparison
equal deleted inserted replaced
1247:c6cf44e6330b 1248:77a4592816f6
202 log.error(_("FIXME: vCard not found as first child element")) 202 log.error(_("FIXME: vCard not found as first child element"))
203 self.host.bridge.actionResult("SUPPRESS", answer['id'], {}, profile) # FIXME: maybe an error message would be better 203 self.host.bridge.actionResult("SUPPRESS", answer['id'], {}, profile) # FIXME: maybe an error message would be better
204 204
205 def vcard_err(self, failure, profile): 205 def vcard_err(self, failure, profile):
206 """Called when something is wrong with registration""" 206 """Called when something is wrong with registration"""
207 if failure.value.stanza.hasAttribute("from"): 207 try:
208 log.error(_("Can't find VCard of %s") % failure.value.stanza['from']) 208 if failure.value.stanza.hasAttribute("from"):
209 log.error(_("Can't find VCard of %s") % failure.value.stanza['from'])
210 except AttributeError:
211 log.error(_("Can't find VCard: %s") % failure.getErrorMessage())
209 self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) # FIXME: maybe an error message would be better 212 self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) # FIXME: maybe an error message would be better
210 213
211 def getCard(self, target_s, profile_key=C.PROF_KEY_NONE): 214 def getCard(self, target_s, profile_key=C.PROF_KEY_NONE):
212 """Ask server for VCard 215 """Ask server for VCard
213 @param target_s: jid from which we want the VCard 216 @param target_s: jid from which we want the VCard