/pidgin/main: c7a1976029ea: facebook: fixed the self contact bei...

James Geboski jgeboski at gmail.com
Mon Dec 28 16:03:09 EST 2015


Changeset: c7a1976029eaebc2544096f4b205fef2c7bf18a5
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-12-28 16:02 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/c7a1976029ea

Description:

facebook: fixed the self contact being ignored

This is a regression introduced by 25bab54.

diffstat:

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

diffs (54 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
@@ -1941,8 +1941,10 @@ fb_api_cb_contacts(PurpleHttpConnection 
 {
 	const gchar *str;
 	FbApi *api = data;
+	FbApiPrivate *priv = api->priv;
 	FbApiUser *user;
 	FbHttpParams *prms;
+	FbId uid;
 	FbJsonValues *values;
 	gboolean complete;
 	gchar *writeid = NULL;
@@ -1959,10 +1961,10 @@ fb_api_cb_contacts(PurpleHttpConnection 
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.graph_api_write_id");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+	                   "$.represented_profile.id");
+	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.represented_profile.friendship_status");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
-	                   "$.represented_profile.id");
-	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.structured_name.text");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.hugePictureUrl.uri");
@@ -1972,17 +1974,20 @@ fb_api_cb_contacts(PurpleHttpConnection 
 	while (fb_json_values_update(values, &err)) {
 		g_free(writeid);
 		writeid = fb_json_values_next_str_dup(values, NULL);
+		count++;
+
+		str = fb_json_values_next_str(values, "0");
+		uid = FB_ID_FROM_STR(str);
 		str = fb_json_values_next_str(values, NULL);
-		count++;
-
-		if (!purple_strequal(str, "ARE_FRIENDS")) {
+
+		if (!purple_strequal(str, "ARE_FRIENDS") &&
+		    (uid != priv->uid))
+		{
 			continue;
 		}
 
 		user = fb_api_user_dup(NULL, FALSE);
-		str = fb_json_values_next_str(values, "0");
-
-		user->uid = FB_ID_FROM_STR(str);
+		user->uid = uid;
 		user->name = fb_json_values_next_str_dup(values, NULL);
 		user->icon = fb_json_values_next_str_dup(values, NULL);
 



More information about the Commits mailing list