diff src/buddyicon.c @ 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 7a8aa87164ae
children 59bca4e8678c
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 *