diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-07-16 07:54:37 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-07-16 07:54:37 +0000 |
commit | dd9f965fb221b92a4888558df1318bc70295c00d (patch) | |
tree | 53c188df65438afb1b3b06317f6842a31fedf37a /protocols/FacebookRM/src/communication.cpp | |
parent | ba2acec9aad01af50c36a32a89f8fdcd634ffb66 (diff) |
Facebook: Update channel request with traceid
git-svn-id: http://svn.miranda-ng.org/main/trunk@9822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 5f29f113b0..f3e0c19c85 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -523,9 +523,14 @@ std::string facebook_client::choose_action(RequestType request_type, std::string else action += "&idle=1"; + action += "&cap=0"; + if (!this->chat_sticky_num_.empty()) action += "&sticky_token=" + this->chat_sticky_num_; + if (!this->chat_traceid_.empty()) + action += "&traceid=" + this->chat_traceid_; + return action; } @@ -1044,6 +1049,12 @@ bool facebook_client::channel() return handle_error("channel"); } + // Load traceId, if present + std::string traceId = utils::text::source_get_value(&resp.data, 2, "\"tr\":\"", "\""); + if (!traceId.empty()) { + this->chat_traceid_ = traceId; + } + std::string type = utils::text::source_get_value(&resp.data, 2, "\"t\":\"", "\""); if (type == "continue" || type == "heartbeat") { // Everything is OK, no new message received @@ -1069,7 +1080,7 @@ bool facebook_client::channel() if (type == "refresh") return this->reconnect(); } - else { + else if (!type.empty()) { // Something has been received, throw to new thread to process std::string* response_data = new std::string(resp.data); parent->ForkThread(&FacebookProto::ProcessMessages, response_data); @@ -1078,6 +1089,10 @@ bool facebook_client::channel() 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()); } + else { + // No type? This shouldn't happen unless there is a big API change. + return handle_error("channel"); + } // Return switch (resp.code) |