changeset 9305:0c201a2386c7

[gaim-migrate @ 10113] gaim_buddy_icons_set_for_user() can now clear and remove the icon from everything and update the UI when the icon data is NULL and/or the icon length is 0. This *should* work. Tim will test it for me :) committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 18 Jun 2004 05:09:01 +0000
parents 96c481da57ea
children 04a3e9e869ee
files src/buddyicon.c
diffstat 1 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddyicon.c	Fri Jun 18 04:33:28 2004 +0000
+++ b/src/buddyicon.c	Fri Jun 18 05:09:01 2004 +0000
@@ -81,6 +81,7 @@
 	GaimAccount *account;
 	GHashTable *icon_cache;
 	const char *username;
+	GSList *sl, *list;
 
 	g_return_if_fail(icon != NULL);
 
@@ -96,6 +97,16 @@
 
 	conv = gaim_find_conversation_with_account(username, account);
 
+	for (list = sl = gaim_find_buddies(account, username); sl != NULL;
+		 sl = sl->next)
+	{
+		GaimBuddy *buddy = (GaimBuddy *)sl->data;
+
+		gaim_buddy_set_icon(buddy, NULL);
+	}
+
+	g_slist_free(list);
+
 	if (conv != NULL && gaim_conversation_get_type(conv) == GAIM_CONV_IM)
 		gaim_conv_im_set_icon(GAIM_CONV_IM(conv), NULL);
 
@@ -157,8 +168,8 @@
 	account  = gaim_buddy_icon_get_account(icon);
 	username = gaim_buddy_icon_get_username(icon);
 
-	for (list =sl = gaim_find_buddies(account, username); sl != NULL;
-			sl = sl->next)
+	for (list = sl = gaim_find_buddies(account, username); sl != NULL;
+		 sl = sl->next)
 	{
 		GaimBuddy *buddy = (GaimBuddy *)sl->data;
 
@@ -302,7 +313,19 @@
 	g_return_if_fail(account  != NULL);
 	g_return_if_fail(username != NULL);
 
-	gaim_buddy_icon_new(account, username, icon_data, icon_len);
+	if (icon_data == NULL || icon_len == 0)
+	{
+		GaimBuddyIcon *buddy_icon;
+
+		buddy_icon = gaim_buddy_icons_find(account, username);
+
+		if (buddy_icon != NULL)
+			gaim_buddy_icon_destroy(buddy_icon);
+	}
+	else
+	{
+		gaim_buddy_icon_new(account, username, icon_data, icon_len);
+	}
 }
 
 GaimBuddyIcon *