diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-07-16 13:38:08 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-07-16 13:38:08 +0000 |
commit | 3a30fdfc6c545ba51cf1587b58b22316f2622e8f (patch) | |
tree | 06daf3b099663cba01f6e2432ca8f2b8f020bbee /protocols/FacebookRM/src/json.cpp | |
parent | 5dc9ff65b453efdcbe2218720307fae52b5d6e90 (diff) |
Facebook: Improve working with different user types (friend, user, page)
Also simplify arguments of AddToContactList method. And don't show auth items in contact menu for page contacts.
git-svn-id: http://svn.miranda-ng.org/main/trunk@17099 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index bc79b6b8b6..4786213919 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -42,6 +42,13 @@ void parseUser(const JSONNode &it, facebook_user *fbu) return; } + if (type == "friend") + fbu->type = CONTACT_FRIEND; + else if (type == "user") + fbu->type = CONTACT_NONE; + else if (type == "page") + fbu->type = CONTACT_PAGE; + if (!name.empty()) fbu->real_name = utils::text::slashu_to_utf8(name); if (!thumbSrc.empty()) @@ -608,8 +615,9 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo facebook_user fbu; fbu.user_id = from.as_string(); + fbu.type = CONTACT_FRIEND; // only friends are able to send typing notifications - MCONTACT hContact = proto->AddToContactList(&fbu, CONTACT_FRIEND); // only friends are able to send typing notifications + MCONTACT hContact = proto->AddToContactList(&fbu); const JSONNode &st = (*it)["st"]; if (st.as_int() == 1) @@ -694,7 +702,8 @@ 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->handle = AddToContactList(fbu, CONTACT_FRIEND); // add this contact as friend? + // fbu->type = CONTACT_FRIEND; // add this contact as a friend? + // fbu->handle = AddToContactList(fbu); continue; } @@ -768,7 +777,8 @@ 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->handle = AddToContactList(fbu, CONTACT_FRIEND); // add this contact as friend? + // fbu->type = CONTACT_FRIEND; // add this contact as a friend? + // fbu->handle = AddToContactList(fbu); continue; } |