show avatars in roster, if there is no 'TYPE'

attribute in vcard
This commit is contained in:
Dimitur Kirov 2006-06-09 13:41:31 +00:00
parent 18f2175f11
commit bfe397a27d

View file

@ -42,16 +42,20 @@ def get_avatar_pixbuf_encoded_mime(photo):
img_decoded = None img_decoded = None
avatar_encoded = None avatar_encoded = None
avatar_mime_type = None avatar_mime_type = None
if photo.has_key('BINVAL') and photo.has_key('TYPE'): if photo.has_key('BINVAL'):
img_encoded = photo['BINVAL'] img_encoded = photo['BINVAL']
avatar_encoded = img_encoded avatar_encoded = img_encoded
avatar_mime_type = photo['TYPE']
try: try:
img_decoded = base64.decodestring(img_encoded) img_decoded = base64.decodestring(img_encoded)
except: except:
pass pass
if img_decoded: if img_decoded:
if photo.has_key('TYPE'):
avatar_mime_type = photo['TYPE']
pixbuf = gtkgui_helpers.get_pixbuf_from_data(img_decoded) pixbuf = gtkgui_helpers.get_pixbuf_from_data(img_decoded)
else:
pixbuf, avatar_mime_type = gtkgui_helpers.get_pixbuf_from_data(
img_decoded, want_type=True)
else: else:
pixbuf = None pixbuf = None
return pixbuf, avatar_encoded, avatar_mime_type return pixbuf, avatar_encoded, avatar_mime_type