Commit fcad0f08 authored by Bronko's avatar Bronko

save hash and mime_type of avatar when receiving vCard from server

in case the avatar is not changed by the user we must resend the still valid hash.
if we do not save the hash here, gajim advertises an empty photo element after publishing the vCard,
which removes the avatar for all receiving clients of the photo element update
parent 36b31259
......@@ -29,6 +29,7 @@ from gi.repository import GdkPixbuf
import base64
import time
import logging
import hashlib
from gajim import gtkgui_helpers
from gajim import dialogs
......@@ -229,6 +230,9 @@ class ProfileWindow:
self.avatar_encoded = photo_encoded
photo_decoded = base64.b64decode(photo_encoded.encode('utf-8'))
self.avatar_sha = hashlib.sha1(photo_decoded).hexdigest()
if 'TYPE' in vcard_[i]:
self.avatar_mime_type = vcard_[i]['TYPE']
pixbuf = gtkgui_helpers.get_pixbuf_from_data(photo_decoded)
if pixbuf is None:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment