changeset 16590:66f0cda796e1

Part of the patch in ticket #383 To make sure that account-icons are kept after migration, I look into the old icons location, and if possible, the icon is set to the account, which causes the icon to be stored in the new cache location. committer: Richard Laager <rlaager@wiktel.com>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 28 Apr 2007 18:08:31 +0000
parents bc03699814a1
children 976a9b4c336a
files libpurple/account.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Sat Apr 28 18:02:26 2007 +0000
+++ b/libpurple/account.c	Sat Apr 28 18:08:31 2007 +0000
@@ -749,6 +749,15 @@
 		{
 			purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len);
 		}
+		else
+		{
+			/* Try to see if the icon got left behind in the old cache. */
+			g_free(filename);
+			filename = g_build_filename(g_get_home_dir(), ".gaim", "icons", data, NULL);
+			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);