summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-11-09 09:10:43 +0000
committerRobert Pösel <robyer@seznam.cz>2015-11-09 09:10:43 +0000
commitb067cb5f4dd97509448956205c41f96cce6f8473 (patch)
tree2bdabc26b6e7881919ba882d6ae0a1b1ed431027 /protocols/FacebookRM/src
parentee3deb0f5d1f432100307d8a600df5fdf4a5f9ea (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')
-rw-r--r--protocols/FacebookRM/src/db.h1
-rw-r--r--protocols/FacebookRM/src/json.cpp15
-rw-r--r--protocols/FacebookRM/src/process.cpp3
3 files changed, 17 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index 0838548bb1..3beb11e56a 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -86,3 +86,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode"
#define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with
#define FACEBOOK_KEY_SEND_MESSAGE_TRIES "SendMessageTries" // [HIDDEN] - (byte) = number of tries to send message, default=1, min=1, max=5
+#define FACEBOOK_KEY_FETCH_MOBILE "FetchMobile" // [HIDDEN] - (byte) 0 = don't fetch mobile contacts (default), 1 = fetch mobile classicaly, 2 = other method to determine mobile contacts (not reliable, just random guessing) \ No newline at end of file
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
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 5bc32be1ff..8a3a88effa 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -57,7 +57,8 @@ void FacebookProto::ProcessBuddyList(void*)
data += i->data->user_id + "%2C";
}
- data += "&fetch_mobile=true";
+ if (getByte(FACEBOOK_KEY_FETCH_MOBILE, 0) == 1)
+ data += "&fetch_mobile=true";
// data += "&additional_buddies[0]=" + some_user_id; // FIXME: I'm not sure what this is for
// data += "&additional_buddies[1]=" + some_user_id;
data += "&get_now_available_list=true";