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
This commit is contained in:
parent
36b31259e7
commit
fcad0f088a
|
@ -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:
|
|||
continue
|
||||
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:
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue