remove the image in tc window when we get the vcard and there is no image in it

This commit is contained in:
Yann Leboulanger 2005-10-12 20:17:58 +00:00
parent cbebcfc29e
commit 19d99e0a89

View file

@ -237,27 +237,30 @@ class TabbedChatWindow(chat.Chat):
return 0 # FIXME: always zero why?? return 0 # FIXME: always zero why??
def show_avatar(self, jid, resource): def show_avatar(self, jid, resource):
if self.plugin.avatar_pixbufs[jid] is None: # Get the XML instance
return # contact has no avatar xml = None
pixbuf = self.plugin.avatar_pixbufs[jid]
w = gajim.config.get('avatar_width')
h = gajim.config.get('avatar_height')
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
x = None
if self.xmls.has_key(jid): if self.xmls.has_key(jid):
x = self.xmls[jid] xml = self.xmls[jid]
else: else:
# it can be xmls[jid/resource] if it's a vcard from pm # it can be xmls[jid/resource] if it's a vcard from pm
jid_with_resource = jid + '/' + resource jid_with_resource = jid + '/' + resource
if self.xmls.has_key(jid_with_resource): if self.xmls.has_key(jid_with_resource):
x = self.xmls[jid_with_resource] xml = self.xmls[jid_with_resource]
if not xml:
return
if x is not None: if self.plugin.avatar_pixbufs[jid] is None:
image = x.get_widget('avatar_image') # contact has no avatar
image.set_from_pixbuf(scaled_buf) scaled_buf = None
image.show_all() else:
pixbuf = self.plugin.avatar_pixbufs[jid]
w = gajim.config.get('avatar_width')
h = gajim.config.get('avatar_height')
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
image = xml.get_widget('avatar_image')
image.set_from_pixbuf(scaled_buf)
image.show_all()
def set_state_image(self, jid): def set_state_image(self, jid):
prio = 0 prio = 0