diff options
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/db.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 15 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 3 |
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"; |