/soc/2015/jgeboski/facebook: 870dfcff28e3: facebook: fixed the a...

James Geboski jgeboski at gmail.com
Thu Aug 6 15:14:01 EDT 2015


Changeset: 870dfcff28e3488773f9c7287626085aa7a39c94
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-08-06 15:13 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/870dfcff28e3

Description:

facebook: fixed the account user contact being ignored

This is a regression introduced by 600f41974cb3. As can be assumed, the
account user contact cannot be a friend of itself. An additional check
is needed to ensure the contact is only skipped for not being a friend.

This fixes the private alias of the acount user not being set.

diffstat:

 libpurple/protocols/facebook/api.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (50 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
@@ -1356,6 +1356,7 @@ fb_api_cb_contacts(PurpleHttpConnection 
 {
 	const gchar *str;
 	FbApi *api = data;
+	FbApiPrivate *priv = api->priv;
 	FbApiUser user;
 	FbHttpParams *params;
 	FbJsonValues *values;
@@ -1371,29 +1372,31 @@ fb_api_cb_contacts(PurpleHttpConnection 
 
 	values = fb_json_values_new(root, "$.viewer.messenger_contacts.nodes");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+	                   "$.represented_profile.id");
+	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.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");
 
 	while (fb_json_values_update(values, &err)) {
+		fb_api_user_reset(&user, FALSE);
+		str = fb_json_values_next_str(values, NULL);
+		user.uid = FB_ID_FROM_STR(str);
+
 		g_free(writeid);
 		writeid = fb_json_values_next_str_dup(values, NULL);
 		str = fb_json_values_next_str(values, NULL);
 
-		if (!purple_strequal(str, "ARE_FRIENDS")) {
+		if (!purple_strequal(str, "ARE_FRIENDS") &&
+		    (user.uid != priv->uid))
+		{
 			continue;
 		}
 
-		fb_api_user_reset(&user, FALSE);
-		str = fb_json_values_next_str(values, NULL);
-		user.uid = FB_ID_FROM_STR(str);
-
 		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