summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/json.cpp
diff options
context:
space:
mode:
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);