changeset 10934:185ca25b5c7e

[gaim-migrate @ 12717] sf patch #1197984, from Richard Laager Add a buddy icon cached signal committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 24 May 2005 04:19:19 +0000
parents f43113333717
children 61ae1ee53a94
files plugins/signals-test.c src/buddyicon.c src/value.h
diffstat 3 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/signals-test.c	Mon May 23 19:05:11 2005 +0000
+++ b/plugins/signals-test.c	Tue May 24 04:19:19 2005 +0000
@@ -72,6 +72,17 @@
 }
 
 /**************************************************************************
+ * Buddy Icons signal callbacks
+ **************************************************************************/
+static void
+buddy_icon_cached_cb(GaimBuddyIcon *icon, GaimBuddy *buddy,
+		     const char *filename, const char *old_icon)
+{
+	gaim_debug_misc("signals test", "buddy icon cached (%s, %s, %s)\n",
+					gaim_buddy_get_name(buddy), filename, old_icon);
+}
+
+/**************************************************************************
  * Buddy List subsystem signal callbacks
  **************************************************************************/
 static void
@@ -475,6 +486,7 @@
 	void *conv_handle = gaim_conversations_get_handle();
 	void *accounts_handle = gaim_accounts_get_handle();
 	void *ciphers_handle = gaim_ciphers_get_handle();
+	void *buddy_icons_handle = gaim_buddy_icons_get_handle();
 
 	/* Accounts subsystem signals */
 	gaim_signal_connect(accounts_handle, "account-connecting",
@@ -488,6 +500,10 @@
 	gaim_signal_connect(accounts_handle, "account-warned",
 						plugin, GAIM_CALLBACK(account_warned_cb), NULL);
 
+	/* Buddy Icon subsystem signals */
+	gaim_signal_connect(buddy_icons_handle, "buddy-icon-cached",
+						plugin, GAIM_CALLBACK(buddy_icon_cached_cb), NULL);
+
 	/* Buddy List subsystem signals */
 	gaim_signal_connect(blist_handle, "buddy-away",
 						plugin, GAIM_CALLBACK(buddy_away_cb), NULL);
--- a/src/buddyicon.c	Mon May 23 19:05:11 2005 +0000
+++ b/src/buddyicon.c	Tue May 24 04:19:19 2005 +0000
@@ -239,6 +239,9 @@
 		fclose(file);
 	}
 
+	gaim_signal_emit(gaim_buddy_icons_get_handle(), "buddy-icon-cached",
+					 icon, buddy, filename, old_icon);
+
 	g_free(filename);
 
 	if (old_icon != NULL)
@@ -444,6 +447,15 @@
 		NULL, (GFreeFunc)g_hash_table_destroy);
 
 	cache_dir = g_build_filename(gaim_user_dir(), "icons", NULL);
+
+	gaim_signal_register(gaim_buddy_icons_get_handle(), "buddy-icon-cached",
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER, NULL, 4,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_BUDDY_ICON),
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+						 				GAIM_SUBTYPE_BLIST_BUDDY),
+						 gaim_value_new(GAIM_TYPE_STRING),
+						 gaim_value_new(GAIM_TYPE_STRING));
 }
 
 void
--- a/src/value.h	Mon May 23 19:05:11 2005 +0000
+++ b/src/value.h	Tue May 24 04:19:19 2005 +0000
@@ -64,6 +64,7 @@
 	GAIM_SUBTYPE_BLIST_BUDDY,
 	GAIM_SUBTYPE_BLIST_GROUP,
 	GAIM_SUBTYPE_BLIST_CHAT,
+	GAIM_SUBTYPE_BUDDY_ICON,
 	GAIM_SUBTYPE_CONNECTION,
 	GAIM_SUBTYPE_CONVERSATION,
 	GAIM_SUBTYPE_CONV_WINDOW,