diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-04-27 22:05:18 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-04-27 22:05:18 +0000 |
commit | bd5a6cebc05210166ce877e89e8597abdb1a4a48 (patch) | |
tree | 5547152b60c571e439de5679b88247ac0a23821f /protocols/FacebookRM/src/communication.cpp | |
parent | db80b3eb8fa3de32297932d8a7d440f29654388c (diff) |
Facebook: Use msgs_recv parameter in channel requests
I'm not sure whether this fixes the "computer needs cleaning" error, but we will see
git-svn-id: http://svn.miranda-ng.org/main/trunk@13213 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 08fe0ea73a..e4f78df31e 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -453,6 +453,8 @@ std::string facebook_client::choose_action(RequestType request_type, std::string 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_; @@ -1079,6 +1081,9 @@ bool facebook_client::reconnect() this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}"); parent->debugLogA(" Got self sequence number: %s", this->chat_sequence_num_.c_str()); + // TODO: I'm not sure this goes to 0 after reconnect, or it is always same as chat_sequence_num_ (when watching website it was always same) + this->chat_msgs_recv_ = 0; + this->chat_conn_num_ = utils::text::source_get_value2(&resp.data, "\"max_conn\":", ",}"); parent->debugLogA(" Got self max_conn: %s", this->chat_conn_num_.c_str()); @@ -1155,6 +1160,12 @@ bool facebook_client::channel() std::string seq = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}"); parent->debugLogA(" Got self sequence number: %s", seq.c_str()); + if (type == "msg") { + // Update msgs_recv number + // TODO: I'm not sure this is updated regarding "msg" received and reseted after reconnect, or it is always same as chat_sequence_num_ (when watching website it was always same) + this->chat_msgs_recv_++; + } + // Check if it's different from our old one (which means we should increment our old one) if (seq != this->chat_sequence_num_) { // Facebook now often return much bigger number which results in skipping few data requests, so we increment it manually |