comparison src/plugins/plugin_xep_0054.py @ 939:01342bfe9f41

wix: fixed onShowProfile
author Goffi <goffi@goffi.org>
date Thu, 27 Mar 2014 10:36:20 +0100
parents 1a759096ccbd
children c6d8fc63b1db
comparison
equal deleted inserted replaced
938:fc7e0828b18e 939:01342bfe9f41
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21 from sat.core.i18n import _ 21 from sat.core.i18n import _
22 from sat.core.constants import Const as C 22 from sat.core.constants import Const as C
23 from logging import debug, info, error 23 from logging import debug, info, error
24 from twisted.internet import threads 24 from twisted.internet import threads, defer
25 from twisted.internet.defer import inlineCallbacks, returnValue
26 from twisted.words.protocols.jabber import jid 25 from twisted.words.protocols.jabber import jid
27 from twisted.words.protocols.jabber.xmlstream import IQ 26 from twisted.words.protocols.jabber.xmlstream import IQ
28 from twisted.words.xish import domish 27 from twisted.words.xish import domish
29 from twisted.python.failure import Failure 28 from twisted.python.failure import Failure
30 import os.path 29 import os.path
154 debug(_("file saved to %s") % image_hash) 153 debug(_("file saved to %s") % image_hash)
155 else: 154 else:
156 debug(_("file [%s] already in cache") % image_hash) 155 debug(_("file [%s] already in cache") % image_hash)
157 return image_hash 156 return image_hash
158 157
159 @inlineCallbacks 158 @defer.inlineCallbacks
160 def vCard2Dict(self, vcard, target, profile): 159 def vCard2Dict(self, vcard, target, profile):
161 """Convert a VCard to a dict, and save binaries""" 160 """Convert a VCard to a dict, and save binaries"""
162 debug(_("parsing vcard")) 161 debug(_("parsing vcard"))
163 dictionary = {} 162 dictionary = {}
164 163
181 else: 180 else:
182 self.update_cache(target, 'avatar', dictionary['avatar'], profile) 181 self.update_cache(target, 'avatar', dictionary['avatar'], profile)
183 else: 182 else:
184 info(_('FIXME: [%s] VCard tag is not managed yet') % elem.name) 183 info(_('FIXME: [%s] VCard tag is not managed yet') % elem.name)
185 184
186 returnValue(dictionary) 185 defer.returnValue(dictionary)
187 186
188 def vcard_ok(self, answer, profile): 187 def vcard_ok(self, answer, profile):
189 """Called after the first get IQ""" 188 """Called after the first get IQ"""
190 debug(_("VCard found")) 189 debug(_("VCard found"))
191 190