Mercurial > pidgin
changeset 8374:e7463be62fb1
[gaim-migrate @ 9101]
A patch from nosnilmot to make right-clicking and saving on a buddy icon
in a conversation window work if the icon was received before the
conv window was open.
Looks good to me. Icon code is confoosing.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 01 Mar 2004 02:51:13 +0000 |
parents | 7a58f6f9fc3e |
children | 1556970088d4 |
files | src/gtkconv.c |
diffstat | 1 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Mon Mar 01 01:00:08 2004 +0000 +++ b/src/gtkconv.c Mon Mar 01 02:51:13 2004 +0000 @@ -4999,9 +4999,24 @@ if((buddy = gaim_find_buddy(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv))) != NULL) { - const char *file; - if((file = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) - gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(file, &err); + const char *iconfile; + if((iconfile = gaim_blist_node_get_string((GaimBlistNode*)buddy, "buddy_icon"))) { + GaimBuddyIcon *icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); + struct stat st; + if ((icon == NULL) && (!stat(iconfile, &st))) { + FILE *file = fopen(iconfile, "rb"); + if (file) { + char *data = g_malloc(st.st_size); + fread(data, 1, st.st_size, file); + fclose(file); + gaim_buddy_icons_set_for_user(gaim_conversation_get_account(conv), gaim_conversation_get_name(conv), data, st.st_size); + g_free(data); + } + return; + } + else + gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(iconfile, &err); + } } else {