summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/json.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-04-02 22:53:15 +0000
committerRobert Pösel <robyer@seznam.cz>2014-04-02 22:53:15 +0000
commit3ff89e16119e063eb5719679e7b34d306116b265 (patch)
tree561932232ef2520287a3835509629f5a8a53c8a8 /protocols/FacebookRM/src/json.cpp
parentfe7d9276ebedd60308159925eb3f37d9a3b113a0 (diff)
Facebook: Add support for showing unread notifications count as "unread emails" in clist
git-svn-id: http://svn.miranda-ng.org/main/trunk@8831 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r--protocols/FacebookRM/src/json.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 34b23a1fc9..dc824d0cbf 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -599,13 +599,20 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa
messages->push_back(message);
}
}
+ } else if (t == "notifications_read") {
+ JSONNODE *alerts = json_get(it, "alert_ids");
+ proto->facy.notifications_count_ -= json_size(alerts);
+
+ if (proto->facy.notifications_count_ < 0)
+ proto->facy.notifications_count_ = 0;
} else if (t == "notification_json") {
// event notification
+ JSONNODE *nodes = json_get(it, "nodes");
+ proto->facy.notifications_count_ += json_size(nodes);
if (!proto->getByte(FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
continue;
-
- JSONNODE *nodes = json_get(it, "nodes");
+
for (unsigned int j = 0; j < json_size(nodes); j++) {
JSONNODE *itNodes = json_at(nodes, j);