summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/communication.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2016-05-17 20:15:33 +0000
committerRobert Pösel <robyer@seznam.cz>2016-05-17 20:15:33 +0000
commit5e5cabbee2c2249be4e34efc9bafa1b05136111a (patch)
tree5705bd162306f31b1d41dc2b1d48ae53ca4046d4 /protocols/FacebookRM/src/communication.cpp
parent82cd0bd751e964a84746740abd03a419b8b80532 (diff)
Facebook: Rework loading online contacts (not properly finished!); version bump
This is work in progress, which might (and will) cause wrong status reporting and maybe related problems. On the other hand this way is only "preferred" way. Previous way (using buddy_list request) isn't used anymore and might cause the captcha problems and antivirus checks from FB... git-svn-id: http://svn.miranda-ng.org/main/trunk@16843 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r--protocols/FacebookRM/src/communication.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 8e77b71316..c847279530 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -1273,6 +1273,8 @@ bool facebook_client::channel()
}
std::string type = utils::text::source_get_value(&resp.data, 2, "\"t\":\"", "\"");
+ parent->debugLogA("Pull response type = %s", type.c_str());
+
if (type == "continue" || type == "heartbeat") {
// Everything is OK, no new message received
}
@@ -1284,21 +1286,19 @@ bool facebook_client::channel()
this->chat_sticky_num_ = utils::text::source_get_value2(&resp.data, "\"sticky\":\"", "\"");
parent->debugLogA(" Got self sticky number: %s", this->chat_sticky_num_.c_str());
}
- else if (type == "fullReload" || type == "refresh") {
- // Requested reload of page or relogin (due to some settings change, removing this session, etc.)
- parent->debugLogA("!!! Requested %s", type.c_str());
+ if (type == "refresh") {
+ // Requested relogin (due to some settings change, removing this session, etc.)
+ parent->debugLogA("!!! Requested refresh");
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());
- if (type == "refresh") {
- this->chat_reconnect_reason_ = utils::text::source_get_value2(&resp.data, "\"reason\":", ",}");
- parent->debugLogA(" Got reconnect reason: %s", this->chat_reconnect_reason_.c_str());
+ this->chat_reconnect_reason_ = utils::text::source_get_value2(&resp.data, "\"reason\":", ",}");
+ parent->debugLogA(" Got reconnect reason: %s", this->chat_reconnect_reason_.c_str());
- return this->reconnect();
- }
- }
- else if (!type.empty()) {
+ return this->reconnect();
+ }
+ else if (!type.empty()) { // for "msg", "fullReload" and maybe also other types
// 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);
@@ -1311,6 +1311,10 @@ bool facebook_client::channel()
// Update msgs_recv number for every "msg" type we receive (during fullRefresh/reload responses it stays the same)
this->chat_msgs_recv_++;
}
+ else if (type == "fullReload") {
+ // At fullReload we force our seq number to received value (there may have been some error or something)
+ this->chat_sequence_num_ = seq;
+ }
// Check if it's different from our old one (which means we should increment our old one)
if (seq != this->chat_sequence_num_) {