diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-05-31 07:03:01 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-05-31 07:03:01 +0000 |
commit | 63bea9fe2a7f02f9246db900c08501fd6f567918 (patch) | |
tree | 277618b1f0901c3d2a99146cbbf655c410a3d5c9 /protocols | |
parent | 656dc1d17f378e819fb6723b7cd1dc8b14d22a5e (diff) |
Facebook: Fix loading notifications on login again (now really) and marking them as read
git-svn-id: http://svn.miranda-ng.org/main/trunk@13924 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 7 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 6 |
3 files changed, 13 insertions, 4 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 2583e7a377..e9e3de967f 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -445,11 +445,11 @@ std::string facebook_client::choose_action(RequestType request_type, std::string action += "&cap=0"; // TODO: what's this item? // action += "&wtc=0,0,0.000,0,0"; // TODO: what's this item? It's numbers grows with every new request... + action += "&msgs_recv=" + utils::conversion::to_string(&this->chat_msgs_recv_, UTILS_CONV_UNSIGNED_NUMBER); + action += "&uid=" + self_.user_id; action += "&viewer_uid=" + self_.user_id; - action += "&msgs_recv=" + utils::conversion::to_string(&this->chat_msgs_recv_, UTILS_CONV_UNSIGNED_NUMBER); - if (!this->chat_sticky_num_.empty()) action += "&sticky_token=" + this->chat_sticky_num_; diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 3945ddb89e..df528d7cc9 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -227,6 +227,12 @@ int facebook_json_parser::parse_notifications(std::string *data, std::map< std:: facebook_notification* notification = new facebook_notification(); notification->id = id_.as_string(); + + // Fix notification ID + std::string::size_type pos = notification->id.find(":"); + if (pos != std::string::npos) + notification->id = notification->id.substr(pos + 1); + notification->link = url_.as_string(); notification->text = utils::text::html_entities_decode(utils::text::slashu_to_utf8(text_.as_string())); notification->time = utils::time::from_string(time_.as_string()); @@ -581,6 +587,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo notification->id = alert_id.as_string(); notification->time = timestamp; + // Fix notification ID std::string::size_type pos = notification->id.find(":"); if (pos != std::string::npos) notification->id = notification->id.substr(pos + 1); diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index b0b0cc888a..cbd2bff762 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -887,11 +887,13 @@ void FacebookProto::ProcessNotifications(void*) facy.handle_entry("notifications"); - std::string data = "/ajax/notifications/client/get.php?__a=1&__dyn=&__req=&__rev="; + int count = FACEBOOK_NOTIFICATIONS_LOAD_COUNT; + + std::string data = "__dyn=&__req=&__rev="; data += "&__user=" + facy.self_.user_id; data += "&fb_dtsg=" + facy.dtsg_; data += "&cursor="; // when loading more - data += "&length=" + FACEBOOK_NOTIFICATIONS_LOAD_COUNT; // number of items to load + data += "&length=" + utils::conversion::to_string(&count, UTILS_CONV_UNSIGNED_NUMBER); // number of items to load data += "&businessID="; // probably for pages? data += "&ttstamp=" + facy.ttstamp(); |