diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-12-04 14:49:12 +0100 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-12-04 15:25:50 +0100 |
commit | 25ea4914a0b396fd603cd5cc6ef804271563f485 (patch) | |
tree | e0af6cb6e1dcbc0df8f8227e852d82b17fcfca15 /protocols/FacebookRM/src | |
parent | a4bfab81ba7ad352a47d98b99e96d3095af95431 (diff) |
Facebook: Load only friends at login
Because of some change on Facebook side it started sending not only friends, but also other people we talked in some time in history. This commit ignores them and won't load them at login.
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index bf1ed05a38..bb41cd415b 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -34,6 +34,7 @@ void parseUser(const JSONNode &it, facebook_user *fbu) std::string type = it["type"].as_string(); // "friend", "page", "user" (friend with disabled account or not friend) bool isFriend = it["is_friend"].as_bool(); // e.g. "True" or "False" for type="friend" (I don't know why), "False" for type="user", doesn't exist for type="page" int gender = it["gender"].as_int(); + // bool isMessengerContact = it["is_nonfriend_messenger_contact"].as_bool(); // "True" or "False", but we don't care as "is_friend" and "type" are enough for us //const JSONNode &uri = it["uri"); // profile url @@ -179,6 +180,12 @@ int facebook_json_parser::parse_friends(std::string *data, std::map< std::string facebook_user *fbu = new facebook_user(); parseUser(*it, fbu); + // Facebook now sends also other types of contacts, which we do not want here + if (fbu->type != CONTACT_FRIEND) { + delete fbu; + continue; + } + friends->insert(std::make_pair(fbu->user_id, fbu)); } @@ -772,9 +779,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo MCONTACT hContact = proto->ContactIDToHContact(id); if (!hContact) { - // FIXME: What to do, when we don't have this contact? What does it mean? - // fbu->type = CONTACT_FRIEND; // add this contact as a friend? - // fbu->handle = AddToContactList(fbu); + // Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list continue; } @@ -855,9 +860,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo MCONTACT hContact = proto->ContactIDToHContact(id); if (!hContact) { - // FIXME: What to do, when we don't have this contact? What does it mean? - // fbu->type = CONTACT_FRIEND; // add this contact as a friend? - // fbu->handle = AddToContactList(fbu); + // Facebook now sends info also about some nonfriends, so we just ignore status change of contacts we don't have in list continue; } |