summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r--protocols/FacebookRM/src/process.cpp67
1 files changed, 46 insertions, 21 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 96aa8d1949..5bc32be1ff 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -49,19 +49,28 @@ void FacebookProto::ProcessBuddyList(void*)
facy.handle_entry("ProcessBuddyList");
- // Prepare update data
- std::string post_data = "user=" + facy.self_.user_id + "&fetch_mobile=true&fb_dtsg=" + facy.dtsg_ + "&__user=" + facy.self_.user_id + "&cached_user_info_ids=";
+ std::string data = "user=" + facy.self_.user_id;
+ data += "&cached_user_info_ids=";
int counter = 0;
- for (List::Item< facebook_user >* i = facy.buddies.begin(); i != NULL; i = i->next, counter++)
- {
- post_data += i->data->user_id + "%2C";
+ for (List::Item< facebook_user >* i = facy.buddies.begin(); i != NULL; i = i->next, counter++) {
+ data += i->data->user_id + "%2C";
}
- post_data += "&ttstamp=" + facy.ttstamp_;
+ data += "&fetch_mobile=true";
+ // data += "&additional_buddies[0]=" + some_user_id; // FIXME: I'm not sure what this is for
+ // data += "&additional_buddies[1]=" + some_user_id;
+ data += "&get_now_available_list=true";
+
+ data += "&__user=" + facy.self_.user_id;
+ data += "&__dyn=" + facy.__dyn();
+ data += "&__req=" + facy.__req();
+ data += "&fb_dtsg=" + facy.dtsg_;
+ data += "&ttstamp=" + facy.ttstamp_;
+ data += "&__rev=" + facy.__rev();
// Get buddy list
- http::response resp = facy.flap(REQUEST_BUDDY_LIST, &post_data);
+ http::response resp = facy.flap(REQUEST_BUDDY_LIST, &data); // NOTE: Request revised 1.9.2015
if (resp.code != HTTP_CODE_OK) {
facy.handle_error("buddy_list");
@@ -158,8 +167,15 @@ void FacebookProto::ProcessFriendList(void*)
facy.handle_entry("load_friends");
- // Get buddy list
- http::response resp = facy.flap(REQUEST_USER_INFO_ALL);
+ // Get friends list
+ std::string data = "__user=" + facy.self_.user_id;
+ data += "&__dyn=" + facy.__dyn();
+ data += "&__req=" + facy.__req();
+ data += "&fb_dtsg=" + facy.dtsg_;
+ data += "&ttstamp=" + facy.ttstamp_;
+ data += "&__rev=" + facy.__rev();
+
+ http::response resp = facy.flap(REQUEST_USER_INFO_ALL, &data); // NOTE: Request revised 1.9.2015
if (resp.code != HTTP_CODE_OK) {
facy.handle_error("load_friends");
@@ -299,7 +315,7 @@ void FacebookProto::ProcessUnreadMessages(void*)
if (!inboxOnly)
data += "&folders[1]=other";
data += "&client=mercury";
- data += "__user=" + facy.self_.user_id;
+ data += "&__user=" + facy.self_.user_id;
data += "&fb_dtsg=" + facy.dtsg_;
data += "&__a=1&__dyn=&__req=&ttstamp=" + facy.ttstamp_;
@@ -355,11 +371,14 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
// TODO: First load info about amount of unread messages, then load exactly this amount for each thread
- while (!threads->empty()) {
+ while (!threads->empty()) {
std::string data = "client=mercury";
data += "&__user=" + facy.self_.user_id;
+ data += "&__dyn=" + facy.__dyn();
+ data += "&__req=" + facy.__req();
data += "&fb_dtsg=" + facy.dtsg_;
- data += "&__a=1&__dyn=&__req=&ttstamp=" + facy.ttstamp_;
+ data += "&ttstamp=" + facy.ttstamp_;
+ data += "&__rev=" + facy.__rev();
for (std::vector<std::string>::size_type i = 0; i < threads->size(); i++) {
std::string thread_id = utils::url::encode(threads->at(i));
@@ -375,7 +394,7 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
data += "]=" + thread_id;
}
- resp = facy.flap(REQUEST_THREAD_INFO, &data);
+ resp = facy.flap(REQUEST_THREAD_INFO, &data); // NOTE: Request revised 1.9.2015
if (resp.code == HTTP_CODE_OK) {
@@ -459,8 +478,11 @@ void FacebookProto::LoadLastMessages(void *pParam)
std::string data = "client=mercury";
data += "&__user=" + facy.self_.user_id;
+ data += "&__dyn=" + facy.__dyn();
+ data += "&__req=" + facy.__req();
data += "&fb_dtsg=" + facy.dtsg_;
- data += "&__a=1&__dyn=&__req=&ttstamp=" + facy.ttstamp_;
+ data += "&ttstamp=" + facy.ttstamp_;
+ data += "&__rev=" + facy.__rev();
bool isChat = isChatRoom(hContact);
@@ -487,7 +509,7 @@ void FacebookProto::LoadLastMessages(void *pParam)
// request info about thread
data += "&threads[" + type + "][0]=" + id;
- http::response resp = facy.flap(REQUEST_THREAD_INFO, &data);
+ http::response resp = facy.flap(REQUEST_THREAD_INFO, &data); // NOTE: Request revised 1.9.2015
if (resp.code != HTTP_CODE_OK || resp.data.empty()) {
facy.handle_error("LoadLastMessages");
@@ -579,18 +601,21 @@ void FacebookProto::SyncThreads(void*)
// Get milli timestamp string for Facebook
std::string time = utils::conversion::to_string((void*)&timestamp, UTILS_CONV_TIME_T) + "000";
- std::string data = "client=mercury";
- data += "&last_action_timestamp=" + time;
- data += "&__user=" + facy.self_.user_id;
- data += "&fb_dtsg=" + facy.dtsg_;
+ std::string data = "last_action_timestamp=" + time;
data += "&folders[0]=inbox";
if (!inboxOnly)
data += "&folders[1]=other";
- data += "&__req=7&__a=1&__dyn=&__req=&__rev=&ttstamp=" + facy.ttstamp_;
+ data += "&client=mercury_sync";
+ data += "&__user=" + facy.self_.user_id;
+ data += "&__dyn=" + facy.__dyn();
+ data += "&__req=" + facy.__req();
+ data += "&fb_dtsg=" + facy.dtsg_;
+ data += "&ttstamp=" + facy.ttstamp_;
+ data += "&__rev=" + facy.__rev();
debugLogA(" Facebook's milli timestamp for sync: %s", time.c_str());
- http::response resp = facy.flap(REQUEST_THREAD_SYNC, &data);
+ http::response resp = facy.flap(REQUEST_THREAD_SYNC, &data); // NOTE: Request revised 1.9.2015
if (resp.code != HTTP_CODE_OK || resp.data.empty()) {
facy.handle_error("LoadLastMessages");