Skip to content
Snippets Groups Projects
Commit c9c319a1 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

get the avatar from real jid if we have it

if we don't habe the real jid, we don't show bigger avatar cause it's not saved in HD
parent 44d152b3
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,16 @@ def on_avatar_eventbox_enter_notify_event(self, widget, event):
'''we enter the eventbox area so we under conditions add a timeout
to show a bigger avatar after 0.5 sec'''
jid = self.get_active_jid()
avatar_pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(jid)
real_jid = jid
# Is it a pm ? if it is we get the real jid
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
gcs = gajim.interface.windows[self.account]['gc']
if gcs.has_key(room_jid):
contact = gajim.gc_contacts[self.account][room_jid][nick]
real_jid = contact.jid
if not real_jid:
return
avatar_pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(real_jid)
avatar_w = avatar_pixbuf.get_width()
avatar_h = avatar_pixbuf.get_height()
......@@ -156,7 +165,16 @@ def show_bigger_avatar(self, widget):
'''resizes the avatar, if needed, so it has at max half the screen size
and shows it'''
jid = self.get_active_jid()
avatar_pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(jid)
real_jid = jid
# Is it a pm ? if it is we get the real jid
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
gcs = gajim.interface.windows[self.account]['gc']
if gcs.has_key(room_jid):
contact = gajim.gc_contacts[self.account][room_jid][nick]
real_jid = contact.jid
if not real_jid:
return
avatar_pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(real_jid)
screen_w = gtk.gdk.screen_width()
screen_h = gtk.gdk.screen_height()
avatar_w = avatar_pixbuf.get_width()
......@@ -280,7 +298,10 @@ def get_specific_unread(self, jid):
def show_avatar(self, jid, resource):
# Get the XML instance
jid_with_resource = jid + '/' + resource
jid_with_resource = jid
if resource:
jid_with_resource += '/' + resource
xml = None
if self.xmls.has_key(jid):
xml = self.xmls[jid]
......@@ -294,8 +315,19 @@ def show_avatar(self, jid, resource):
# we assume contact has no avatar
scaled_buf = None
pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(jid)
if pixbuf == 'ask': # we don't have the vcard or it's too old
real_jid = jid
# Is it a pm ? if it is we get the real jid
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
if nick:
gcs = gajim.interface.windows[self.account]['gc']
if gcs.has_key(room_jid):
contact = gajim.gc_contacts[self.account][room_jid][nick]
real_jid = contact.jid
pixbuf = None
if real_jid:
pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(real_jid)
if not real_jid or pixbuf == 'ask': # we don't have the vcard or it's too old
gajim.connections[self.account].request_vcard(jid_with_resource)
return
if pixbuf is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment