changeset fa3f711c4847 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=fa3f711c4847 description: fix set avatar
diffstat:
src/common/connection_handlers.py | 5 ++--- src/profile_window.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r b829075ef5d4 -r fa3f711c4847 src/common/connection_handlers.py --- a/src/common/connection_handlers.py Thu Jan 03 14:58:01 2013 +0400 +++ b/src/common/connection_handlers.py Thu Jan 03 17:02:14 2013 +0400 @@ -431,8 +431,7 @@ if 'PHOTO' in vcard and isinstance(vcard['PHOTO'], dict) and \ 'BINVAL' in vcard['PHOTO']: photo = vcard['PHOTO']['BINVAL'] - photo_decoded = base64.b64decode(photo.encode('utf-8')).decode( - 'utf-8') + photo_decoded = base64.b64decode(photo.encode('utf-8')) gajim.interface.save_avatar_files(our_jid, photo_decoded) avatar_sha = hashlib.sha1(photo_decoded).hexdigest() iq2.getTag('PHOTO').setTagData('SHA', avatar_sha) @@ -685,7 +684,7 @@ 'BINVAL' in vcard['PHOTO']: photo = vcard['PHOTO']['BINVAL'] try: - photo_decoded = base64.b64decode(photo.encode('utf-8')).decode('utf-8') + photo_decoded = base64.b64decode(photo.encode('utf-8')) avatar_sha = hashlib.sha1(photo_decoded).hexdigest() except Exception: avatar_sha = '' diff -r b829075ef5d4 -r fa3f711c4847 src/profile_window.py --- a/src/profile_window.py Thu Jan 03 14:58:01 2013 +0400 +++ b/src/profile_window.py Thu Jan 03 17:02:14 2013 +0400 @@ -171,8 +171,7 @@ button.show() text_button = self.xml.get_object('NOPHOTO_button') text_button.hide() - self.avatar_encoded = base64.b64encode(data.encode('utf-8')).decode( - 'utf-8') + self.avatar_encoded = base64.b64encode(data).decode('utf-8') # returns None if unknown type self.avatar_mime_type = mimetypes.guess_type(path_to_file)[0] if must_delete: