changeset 16474:3be560001d26

Kill some compiler warnings and TODOs of mine.
author Richard Laager <rlaager@wiktel.com>
date Wed, 25 Apr 2007 23:29:46 +0000
parents 6f197c81d478
children 5e47b3427b28
files libpurple/account.c libpurple/buddyicon.c libpurple/protocols/msn/slp.c pidgin/gtkaccount.c
diffstat 4 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Wed Apr 25 22:24:15 2007 +0000
+++ b/libpurple/account.c	Wed Apr 25 23:29:46 2007 +0000
@@ -740,7 +740,17 @@
 	child = xmlnode_get_child(node, "buddyicon");
 	if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
 	{
-		// TODO: Read the file and cache it using the new system
+		const char *dirname = purple_buddy_icons_get_cache_dir();
+		char *filename = g_build_filename(dirname, data, NULL);
+		gchar *contents;
+		gsize len;
+
+		if (g_file_get_contents(filename, &contents, &len, NULL))
+		{
+			purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len);
+		}
+
+		g_free(filename);
 		g_free(data);
 	}
 
--- a/libpurple/buddyicon.c	Wed Apr 25 22:24:15 2007 +0000
+++ b/libpurple/buddyicon.c	Wed Apr 25 23:29:46 2007 +0000
@@ -443,10 +443,12 @@
 	icon->img = NULL;
 
 	if (data != NULL)
+	{
 		if (len > 0)
 			icon->img = purple_buddy_icon_data_new(data, len, NULL);
 		else
 			g_free(data);
+	}
 
 	icon->checksum = g_strdup(checksum);
 
@@ -696,8 +698,7 @@
 	}
 	else
 	{
-		// TODO
-		// purple_account_remove_setting(account, "buddy_icon");
+		purple_account_set_string(account, "buddy_icon", NULL);
 	}
 	unref_filename(old_icon);
 
@@ -964,9 +965,6 @@
 	PurpleBlistNode *node = purple_blist_get_root();
 	const char *dirname = purple_buddy_icons_get_cache_dir();
 
-	// TODO: TEMP
-	//old_icons_dir = g_strdup("/home/rlaager/.gaim/icons");
-
 	/* Doing this once here saves having to check it inside a loop. */
 	if (old_icons_dir != NULL)
 	{
--- a/libpurple/protocols/msn/slp.c	Wed Apr 25 22:24:15 2007 +0000
+++ b/libpurple/protocols/msn/slp.c	Wed Apr 25 23:29:46 2007 +0000
@@ -1090,7 +1090,7 @@
 			len = purple_imgstore_get_size(img);
 		}
 
-		purple_buddy_icons_set_for_user(account, user->passport, data, len, info);
+		purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info);
 
 		/* Free one window slot */
 		session->userlist->buddy_icon_window++;
--- a/pidgin/gtkaccount.c	Wed Apr 25 22:24:15 2007 +0000
+++ b/pidgin/gtkaccount.c	Wed Apr 25 23:29:46 2007 +0000
@@ -200,10 +200,12 @@
 
 	purple_imgstore_unref(dialog->icon_img);
 	if (data != NULL)
+	{
 		if (len > 0)
 			dialog->icon_img = purple_imgstore_add(data, len, new_icon_path);
 		else
 			g_free(data);
+	}
 
 	if (dialog->icon_img != NULL) {
 		GdkPixbufLoader *loader = gdk_pixbuf_loader_new();