diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-11-09 09:10:43 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-11-09 09:10:43 +0000 |
commit | b067cb5f4dd97509448956205c41f96cce6f8473 (patch) | |
tree | 2bdabc26b6e7881919ba882d6ae0a1b1ed431027 /protocols/FacebookRM/src/json.cpp | |
parent | ee3deb0f5d1f432100307d8a600df5fdf4a5f9ea (diff) |
Facebook: Disable marking contacts "on the phone" as it is not reliable anymore
Added new hidden option "FetchMobile" (byte), which is default "0" (disabled), but you can set "1" to mark all contacts that are in json's array "mobile_friends" as "on the phone". Also you can set it to "2" to set MirVer based on some "c" field, but it is just guessed and not really correct - it was just internal test to try to distinguish between them to understand what the "c" field means.
git-svn-id: http://svn.miranda-ng.org/main/trunk@15701 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 4a84213eea..97c9c21477 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -84,8 +84,21 @@ int facebook_json_parser::parse_buddy_list(std::string *data, List::List< facebo current->user_id = id; } - current->status_id = (current->client == CLIENT_MOBILE) ? ID_STATUS_ONTHEPHONE : ID_STATUS_ONLINE; + if (proto->getByte(FACEBOOK_KEY_FETCH_MOBILE, 0) == 2) { + // a=1 && c=8 means web for my test contact + // a=1 && c=0 means miranda (i.e. web) for one contact + const JSONNode &a = (*it)["a"]; // usually "2" (active less than 15 minutes ago?), sometimes "1" (active more than 15 minutes ago?) + const JSONNode &c = (*it)["c"]; // sometimes "0", sometimes "8", sometimes "10" + // const JSONNode &i = (*it)["i"]; // it's always "false" for my contacts + + current->idle = (a.as_int() == 1); + current->client = (c.as_int() == 8 ? CLIENT_WEB : (c.as_int() == 0 ? CLIENT_OTHER : (c.as_int() == 10 ? CLIENT_MOBILE : CLIENT_MESSENGER))); + } + + current->status_id = (current->client == CLIENT_MOBILE || current->client == CLIENT_MESSENGER) ? ID_STATUS_ONTHEPHONE : ID_STATUS_ONLINE; + + // Facebook is not sending this info anymore, it should be removed const JSONNode &p = (*it)["p"]; if (p) { std::string status = p["status"].as_string(); // this seems to be "active" everytime |