changeset 16505:1d1ddf972ac8

Ref the filenames for account buddy icons on load.
author Richard Laager <rlaager@wiktel.com>
date Fri, 27 Apr 2007 04:28:41 +0000
parents 3ef6a81a9fba
children d6b81413ef79
files libpurple/account.c libpurple/buddyicon.c libpurple/internal.h
diffstat 3 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Fri Apr 27 04:18:02 2007 +0000
+++ b/libpurple/account.c	Fri Apr 27 04:28:41 2007 +0000
@@ -792,6 +792,8 @@
 	}
 
 	xmlnode_free(node);
+
+	purple_buddy_icons_account_loaded_cb();
 }
 
 
--- a/libpurple/buddyicon.c	Fri Apr 27 04:18:02 2007 +0000
+++ b/libpurple/buddyicon.c	Fri Apr 27 04:28:41 2007 +0000
@@ -960,6 +960,30 @@
 }
 
 void
+purple_buddy_icons_account_loaded_cb()
+{
+	GList *cur;
+
+	for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
+	{
+		PurpleAccount *account = cur->data;
+		const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL);
+
+		if (account_icon_file != NULL)
+		{
+			char *path = g_build_filename(dirname, filename, NULL);
+			if (!g_file_test(filename, G_FILE_TEST_EXISTS))
+			{
+				purple_account_set_string(account, "buddy_icon", NULL);
+			} else {
+				ref_filename(account_icon_file);
+			}
+			g_free(path);
+		}
+	}
+}
+
+void
 purple_buddy_icons_blist_loaded_cb()
 {
 	PurpleBlistNode *node = purple_blist_get_root();
--- a/libpurple/internal.h	Fri Apr 27 04:18:02 2007 +0000
+++ b/libpurple/internal.h	Fri Apr 27 04:28:41 2007 +0000
@@ -184,6 +184,11 @@
 
 #define PURPLE_WEBSITE "http://pidgin.im/"
 
+/* This is for the accounts code to notify the buddy icon code that
+ * it's done loading.  We may want to replace this with a signal. */
+void
+purple_buddy_icons_account_loaded_cb(void);
+
 /* This is for the buddy list to notify the buddy icon code that
  * it's done loading.  We may want to replace this with a signal. */
 void