/pidgin/main: 25a255f32eee: facebook: use the icon URL as a back...

James Geboski jgeboski at gmail.com
Sat Jan 16 10:07:16 EST 2016


Changeset: 25a255f32eee7218886f930aeb3413469a8d3e0a
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2016-01-16 10:01 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/25a255f32eee

Description:

facebook: use the icon URL as a backup checksum

There is a report of the 'oh' parameter missing from some of the icon
images, which is used as the checksum. The solution is to simply use
the URL itself as the checksum in the *rare* case the 'oh' parameter
is missing.

diffstat:

 libpurple/protocols/facebook/api.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (35 lines):

diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -1995,9 +1995,14 @@ fb_api_cb_contact(PurpleHttpConnection *
 	user.icon = fb_json_values_next_str_dup(values, NULL);
 
 	prms = fb_http_params_new_parse(user.icon, TRUE);
-	user.csum = fb_http_params_dup_str(prms, "oh", &err);
+	user.csum = fb_http_params_dup_str(prms, "oh", NULL);
 	fb_http_params_free(prms);
 
+	if (G_UNLIKELY(user.csum == NULL)) {
+		/* Revert to the icon URL as the unique checksum */
+		user.csum = g_strdup(user.icon);
+	}
+
 	g_signal_emit_by_name(api, "contact", &user);
 	fb_api_user_reset(&user, TRUE);
 	g_object_unref(values);
@@ -2075,8 +2080,14 @@ fb_api_cb_contacts(PurpleHttpConnection 
 		user->icon = fb_json_values_next_str_dup(values, NULL);
 
 		prms = fb_http_params_new_parse(user->icon, TRUE);
-		user->csum = fb_http_params_dup_str(prms, "oh", &err);
+		user->csum = fb_http_params_dup_str(prms, "oh", NULL);
 		fb_http_params_free(prms);
+
+		if (G_UNLIKELY(user->csum == NULL)) {
+			/* Revert to the icon URL as the unique checksum */
+			user->csum = g_strdup(user->icon);
+		}
+
 		users = g_slist_prepend(users, user);
 	}
 



More information about the Commits mailing list