summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/FacebookRM/src/client.h3
-rw-r--r--protocols/FacebookRM/src/communication.cpp11
-rw-r--r--protocols/FacebookRM/src/connection.cpp1
3 files changed, 14 insertions, 1 deletions
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index 652a5b3dfa..06b63c861d 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -37,7 +37,7 @@ public:
facebook_client()
{
- msgid_ = error_count_ = last_feeds_update_ = last_notification_time_ = random_ = 0;
+ msgid_ = error_count_ = last_feeds_update_ = last_notification_time_ = random_ = chat_msgs_recv_ = 0;
is_typing_ = false;
@@ -85,6 +85,7 @@ public:
time_t last_feeds_update_;
time_t last_notification_time_;
int msgid_;
+ int chat_msgs_recv_;
////////////////////////////////////////////////////////////
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
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 31acc8955e..01e63d6ff9 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -57,6 +57,7 @@ void FacebookProto::ChangeStatus(void*)
facy.chat_traceid_.clear();
facy.chat_sticky_num_.clear();
facy.chat_sticky_pool_.clear();
+ facy.chat_msgs_recv_ = 0;
facy.clear_cookies();
facy.clear_notifications();