--- a/ChangeLog Thu Jun 30 00:33:22 2005 -0400
+++ b/ChangeLog Thu Jun 30 00:52:16 2005 -0400
@@ -5,6 +5,7 @@
* SILC compiles with newer SILC toolkit versions (Pekka Riikonen)
* Fixed a bug where buddy icon cache files were left in the icon
cache directory after they were no longer in use.
+ * Attempt to detect the file type of a buddy icon when saving. version 1.3.1 (6/9/2005):
* The file transfer details section now also displays the full path to
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/buddyicon-signals.dox Thu Jun 30 00:52:16 2005 -0400
@@ -0,0 +1,24 @@
+/** @page buddyicon-signals Buddy Icon Signals + @signal buddy-icon-cached + @signaldef buddy-icon-cached +void (*buddy-icon-cached)(GaimBuddyIcon *icon, GaimBuddy *buddy, const char *filename, const char *old_icon); + Emitted when a buddy icon is cached. + @param icon The icon that was just cached. + @param buddy The buddy the icon belongs to. + @param filename The full filename for the newly created icon cache file. + @param old_icon The filename of the icon cache file for the buddy's previous icon, or @c NULL if the buddy + had no icon when this new icon was set. This filename is generally the full filename of the + previous icon cache file, but if the previous buddy icon was set in an old version of Gaim, + this may just be the basename of the icon cache file. The directory can be obtained with + gaim_buddy_icons_get_cache_dir(). --- a/plugins/ChangeLog.API Thu Jun 30 00:33:22 2005 -0400
+++ b/plugins/ChangeLog.API Thu Jun 30 00:52:16 2005 -0400
@@ -3,6 +3,10 @@
* Added: gaim_buddy_icon_uncache()
Deletes a cached buddy icon for a specified buddy
+ * Added: gaim_buddy_icon_get_type + Attempts to determine the type of a given buddy icon. + * Added: buddy-icon-cached signal + Emitted when a new buddy icon is cached. version 1.3.1 (6/9/2005):
--- a/plugins/signals-test.c Thu Jun 30 00:33:22 2005 -0400
+++ b/plugins/signals-test.c Thu Jun 30 00:52:16 2005 -0400
@@ -71,6 +71,17 @@
/**************************************************************************
+ * Buddy Icons signal callbacks + **************************************************************************/ +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", + buddy->name, filename, old_icon); +/************************************************************************** * Buddy List subsystem signal callbacks
**************************************************************************/
@@ -458,6 +469,7 @@
void *conn_handle = gaim_connections_get_handle();
void *conv_handle = gaim_conversations_get_handle();
void *accounts_handle = gaim_accounts_get_handle();
+ void *buddy_icons_handle = gaim_buddy_icons_get_handle(); /* Accounts subsystem signals */
gaim_signal_connect(accounts_handle, "account-connecting",
@@ -471,6 +483,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 Thu Jun 30 00:33:22 2005 -0400
+++ b/src/buddyicon.c Thu Jun 30 00:52:16 2005 -0400
@@ -257,6 +257,9 @@
+ gaim_signal_emit(gaim_buddy_icons_get_handle(), "buddy-icon-cached", + icon, buddy, filename, old_icon); @@ -360,6 +363,32 @@
+gaim_buddy_icon_get_type(const GaimBuddyIcon *icon) + g_return_val_if_fail(icon != NULL, NULL); + data = gaim_buddy_icon_get_data(icon, &len); + /* TODO: Find a way to do this with GDK */ + if (!strncmp(data, "BM", 2)) + else if (!strncmp(data, "GIF8", 4)) + else if (!strncmp(data, "\xff\xd8\xff\xe0", 4)) + else if (!strncmp(data, "\x89PNG", 4)) gaim_buddy_icons_set_for_user(GaimAccount *account, const char *username,
void *icon_data, size_t icon_len)
@@ -476,6 +505,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)); --- a/src/buddyicon.h Thu Jun 30 00:33:22 2005 -0400
+++ b/src/buddyicon.h Thu Jun 30 00:52:16 2005 -0400
@@ -164,6 +164,15 @@
const void *gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len);
+ * Returns an extension corresponding to the buddy icon's file type. + * @param icon The buddy icon. + * @return The icon's extension. +const char *gaim_buddy_icon_get_type(const GaimBuddyIcon *icon); /**************************************************************************/
--- a/src/gtkconv.c Thu Jun 30 00:33:22 2005 -0400
+++ b/src/gtkconv.c Thu Jun 30 00:52:16 2005 -0400
@@ -2662,14 +2662,15 @@
icon_menu_save_cb(GtkWidget *widget, GaimConversation *conv)
g_return_if_fail(conv != NULL);
- * XXX - The file extension needs to be set to something that doesn't suck...
- * Maybe do what gtkimhtml.c does when saving an image?
- buf = g_strdup_printf("%s.icon", gaim_normalize(conv->account, conv->name));
+ ext = gaim_buddy_icon_get_type(gaim_conv_im_get_icon(GAIM_CONV_IM(conv))); + buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); gaim_request_file(conv, _("Save Icon"), buf, TRUE,
G_CALLBACK(saveicon_writefile_cb), NULL, conv);