comparison src/plugins/plugin_xep_0054.py @ 941:c6d8fc63b1db

core, plugins: host.getClient now raise an exception instead of returning None when no profile is found, plugins have been adapted consequently and a bit cleaned
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:02 +0100
parents 01342bfe9f41
children 301b342c697a
comparison
equal deleted inserted replaced
940:92e41e7c7e00 941:c6d8fc63b1db
257 """Set avatar of the profile 257 """Set avatar of the profile
258 @param filepath: path of the image of the avatar""" 258 @param filepath: path of the image of the avatar"""
259 #TODO: This is a temporary way of setting avatar, as other VCard informations are not managed. 259 #TODO: This is a temporary way of setting avatar, as other VCard informations are not managed.
260 # A proper full VCard management should be done (and more generaly a public/private profile) 260 # A proper full VCard management should be done (and more generaly a public/private profile)
261 client = self.host.getClient(profile_key) 261 client = self.host.getClient(profile_key)
262 if not client:
263 raise exceptions.NotConnectedProfileError(_('Trying to set avatar for a non-existant or not connected profile'))
264 262
265 vcard_set = IQ(client.xmlstream, 'set') 263 vcard_set = IQ(client.xmlstream, 'set')
266 d = threads.deferToThread(self._buildSetAvatar, vcard_set, filepath) 264 d = threads.deferToThread(self._buildSetAvatar, vcard_set, filepath)
267 265
268 def elementBuilt(result): 266 def elementBuilt(result):