/soc/2015/jgeboski/facebook: 600f41974cb3: facebook: fixed non-f...

James Geboski jgeboski at gmail.com
Sun Aug 2 13:01:49 EDT 2015


Changeset: 600f41974cb3383b2a0d578d0cd873adfec81734
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-08-02 13:01 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/600f41974cb3

Description:

facebook: fixed non-friends being added as buddies

diffstat:

 libpurple/protocols/facebook/api.c |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (29 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
@@ -1102,6 +1102,7 @@ fb_api_cb_contacts(PurpleHttpConnection 
 	FbApi *api = data;
 	FbApiUser user;
 	FbHttpParams *params;
+	gboolean friend;
 	gchar *str;
 	gchar *writeid = NULL;
 	GError *err = NULL;
@@ -1133,6 +1134,17 @@ fb_api_cb_contacts(PurpleHttpConnection 
 		                               &err);
 		FB_API_ERROR_CHK(api, err, goto finish);
 
+		str = fb_json_node_get_str(node, "$.represented_profile"
+				                  ".friendship_status", &err);
+		FB_API_ERROR_CHK(api, err, goto finish);
+
+		friend = g_ascii_strcasecmp(str, "ARE_FRIENDS") == 0;
+		g_free(str);
+
+		if (!friend) {
+			continue;
+		}
+
 		str = fb_json_node_get_str(node, "$.represented_profile.id",
 		                           NULL);
 



More information about the Commits mailing list