/pidgin/main: 5eb0ba6d126d: imgstore: unref yahoo

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Apr 11 19:22:08 EDT 2014


Changeset: 5eb0ba6d126d901f33e8272fd3bd632a2caa3422
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-12 01:21 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/5eb0ba6d126d

Description:

imgstore: unref yahoo

diffstat:

 libpurple/protocols/yahoo/libymsg.c       |   6 ++++--
 libpurple/protocols/yahoo/libymsg.h       |   2 --
 libpurple/protocols/yahoo/yahoo_picture.c |   8 ++++----
 libpurple/protocols/yahoo/yahoo_picture.h |   2 +-
 libpurple/protocols/yahoo/yahoo_profile.c |  16 ++++++++--------
 5 files changed, 17 insertions(+), 17 deletions(-)

diffs (129 lines):

diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c
--- a/libpurple/protocols/yahoo/libymsg.c
+++ b/libpurple/protocols/yahoo/libymsg.c
@@ -3635,10 +3635,12 @@ yahoo_login_page_cb(PurpleHttpConnection
 static void yahoo_picture_check(PurpleAccount *account)
 {
 	PurpleConnection *gc = purple_account_get_connection(account);
-	PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
+	PurpleImage *img = purple_buddy_icons_find_account_icon(account);
 
 	yahoo_set_buddy_icon(gc, img);
-	purple_imgstore_unref(img);
+
+	if (img)
+		g_object_unref(img);
 }
 
 static int get_yahoo_status_from_purple_status(PurpleStatus *status)
diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h
--- a/libpurple/protocols/yahoo/libymsg.h
+++ b/libpurple/protocols/yahoo/libymsg.h
@@ -31,8 +31,6 @@
 #include "prpl.h"
 #include "network.h"
 
-#include "imgstore.h" /* TODO: temp */
-
 #define YAHOO_PAGER_HOST_REQ_URL "http://vcs2.msg.yahoo.com/capacity"
 #define YAHOO_PAGER_HOST_FALLBACK "scsa.msg.yahoo.com"
 #define YAHOO_PAGER_PORT 5050
diff --git a/libpurple/protocols/yahoo/yahoo_picture.c b/libpurple/protocols/yahoo/yahoo_picture.c
--- a/libpurple/protocols/yahoo/yahoo_picture.c
+++ b/libpurple/protocols/yahoo/yahoo_picture.c
@@ -470,7 +470,7 @@ static int yahoo_buddy_icon_calculate_ch
 	return checksum;
 }
 
-void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
+void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleImage *img)
 {
 	YahooData *yd = purple_connection_get_protocol_data(gc);
 	PurpleAccount *account = purple_connection_get_account(gc);
@@ -489,8 +489,8 @@ void yahoo_set_buddy_icon(PurpleConnecti
 			yahoo_send_picture_update(gc, 0);
 
 	} else {
-		gconstpointer data = purple_imgstore_get_data(img);
-		size_t len = purple_imgstore_get_size(img);
+		gconstpointer data = purple_image_get_data(img);
+		size_t len = purple_image_get_size(img);
 		GString *s = g_string_new_len(data, len);
 		struct yahoo_buddy_icon_upload_data *d;
 		int oldcksum = purple_account_get_int(account, YAHOO_PICCKSUM_SETTING, 0);
@@ -513,7 +513,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
 		d = g_new0(struct yahoo_buddy_icon_upload_data, 1);
 		d->gc = gc;
 		d->picture_data = s;
-		d->filename = g_strdup(purple_imgstore_get_filename(img));
+		d->filename = g_strdup(purple_image_get_friendly_filename(img));
 
 		if (!yd->logged_in) {
 			yd->picture_upload_todo = d;
diff --git a/libpurple/protocols/yahoo/yahoo_picture.h b/libpurple/protocols/yahoo/yahoo_picture.h
--- a/libpurple/protocols/yahoo/yahoo_picture.h
+++ b/libpurple/protocols/yahoo/yahoo_picture.h
@@ -36,7 +36,7 @@ void yahoo_process_picture_upload(Purple
 
 void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt);
 
-void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img);
+void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleImage *img);
 void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d);
 void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d);
 
diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c
--- a/libpurple/protocols/yahoo/yahoo_profile.c
+++ b/libpurple/protocols/yahoo/yahoo_profile.c
@@ -29,7 +29,7 @@
 #include "notify.h"
 #include "util.h"
 #if PHOTO_SUPPORT
-#include "imgstore.h"
+#include "image-store.h"
 #endif /* PHOTO_SUPPORT */
 
 #include "libymsg.h"
@@ -951,7 +951,6 @@ yahoo_got_photo(PurpleHttpConnection *ht
 	YahooGetInfoStepTwoData *info2_data = _info2_data;
 	YahooData *yd;
 	gboolean found = FALSE;
-	int id = -1;
 
 	/* Temporary variables */
 	char *p = NULL;
@@ -1032,6 +1031,8 @@ yahoo_got_photo(PurpleHttpConnection *ht
 #if PHOTO_SUPPORT
 	/* Try to put the photo in there too, if there's one and is readable */
 	if (purple_http_response_is_successful(response)) {
+		PurpleImage *img;
+		guchar img_id;
 		const gchar *data;
 		size_t len;
 
@@ -1039,11 +1040,12 @@ yahoo_got_photo(PurpleHttpConnection *ht
 
 		purple_debug_info("yahoo", "%s is %" G_GSIZE_FORMAT " bytes\n",
 			photo_url_text, len);
-		id = purple_imgstore_new_with_id(g_memdup(data, len), len,
-			NULL);
+		img = purple_image_new_from_data(g_memdup(data, len), len);
+		img_id = purple_image_store_add_temporary(img);
+		g_object_unref(img);
 
-		tmp = g_strdup_printf("<img id=\"" PURPLE_STORED_IMAGE_PROTOCOL
-			"%d\"><br>", id);
+		tmp = g_strdup_printf("<img src=\"" PURPLE_IMAGE_STORE_PROTOCOL
+			"%u\"><br>", img_id);
 		purple_notify_user_info_add_pair_html(user_info, NULL, tmp);
 		g_free(tmp);
 	}
@@ -1250,8 +1252,6 @@ yahoo_got_photo(PurpleHttpConnection *ht
 #if PHOTO_SUPPORT
 	g_free(photo_url_text);
 	g_free(info2_data);
-	if (id != -1)
-		purple_imgstore_unref_by_id(id);
 #endif /* PHOTO_SUPPORT */
 }
 



More information about the Commits mailing list