summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/json.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-11-19 16:58:01 +0000
committerRobert Pösel <robyer@seznam.cz>2013-11-19 16:58:01 +0000
commit8586f966f558d317d79b3ec25d0bf21d3d92498d (patch)
treeb0e7c9e04d8a841cc9eb546372624fb7f1a91799 /protocols/FacebookRM/src/json.cpp
parent0e80ad0d4c150fa947849cdad07a7d0d34d7340e (diff)
Facebook: Correctly load contacts on mobile phone that are online right now (also removed old related option)
git-svn-id: http://svn.miranda-ng.org/main/trunk@6936 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r--protocols/FacebookRM/src/json.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index b5d23b9af5..a103a6f29c 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -80,7 +80,8 @@ int facebook_json_parser::parse_buddy_list(void* data, List::List< facebook_user
current->user_id = id;
}
- current->status_id = ID_STATUS_ONTHEPHONE;
+ current->status_id = ID_STATUS_OFFLINE;
+ current->mobile = true;
}
}
@@ -100,10 +101,36 @@ int facebook_json_parser::parse_buddy_list(void* data, List::List< facebook_user
current->status_id = ID_STATUS_ONLINE;
- // In new version of Facebook "i" means "offline"
- JSONNODE *idle = json_get(it, "i");
- if (idle != NULL && json_as_bool(idle))
- current->status_id = ID_STATUS_OFFLINE;
+ JSONNODE *p = json_get(it, "p");
+ if (p != NULL) {
+ JSONNODE *status = json_get(p, "status"); // this seems to be "active" everytime
+ JSONNODE *webStatus = json_get(p, "webStatus"); // "active", "idle" or "offline"
+ JSONNODE *fbAppStatus = json_get(p, "fbAppStatus"); // "offline" or "active"
+ JSONNODE *messengerStatus = json_get(p, "messengerStatus"); // "offline" or "active"
+ JSONNODE *otherStatus = json_get(p, "otherStatus"); // "offline" or "active" - this seems to be "active" when webStatus is "idle" or "active" only
+
+ // this may never happen
+ if (json_as_pstring(status) != "active")
+ current->status_id = ID_STATUS_OFFLINE;
+
+ // "webStatus" and "otherStatus" are marked as "WEB" on FB website
+ if (json_as_pstring(webStatus) == "active" || json_as_pstring(otherStatus) == "active") {
+ current->status_id = ID_STATUS_ONLINE;
+ current->mobile = false;
+ }
+
+ // "fbAppStatus" and "messengerStatus" are marked as "MOBILE" on FB website
+ if (json_as_pstring(fbAppStatus) == "active" || json_as_pstring(messengerStatus) == "active") {
+ current->status_id = ID_STATUS_ONTHEPHONE;
+ current->mobile = true;
+ }
+
+ // this is not marked anyhow on website (yet?)
+ current->idle = json_as_pstring(webStatus) == "idle"
+ || json_as_pstring(otherStatus) == "idle"
+ || json_as_pstring(fbAppStatus) == "idle"
+ || json_as_pstring(messengerStatus) == "idle";
+ }
}
}