diff options
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index bf42ab2f87..ea4dfdc7e2 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -456,70 +456,6 @@ void FacebookProto::LoadLastMessages(void *pParam) OnDbEventRead(hContact, NULL); } -void FacebookProto::SyncThreads(void*) -{ - facy.handle_entry("SyncThreads"); - - if (isOffline()) - return; - - // Always load unread messages because syncthreads request is not reliable (probably doesn't load multi user chat messages at all) - ProcessUnreadMessages(NULL); - - // Get timestamp of last action (message or other event) - time_t timestamp = getDword(FACEBOOK_KEY_LAST_ACTION_TS, 0); - - // If last event is older than 2 day, we force sync to be max. 2 day old - time_t daysBefore = ::time(NULL) - 24 * 60 * 60 * 2; - if (timestamp < daysBefore) { - debugLogA(" Last action timestamp is too old: %d, use 24 hours old instead: %d", timestamp, daysBefore); - timestamp = daysBefore; - } - - // Get milli timestamp string for Facebook - std::string time = utils::conversion::to_string((void*)×tamp, UTILS_CONV_TIME_T) + "000"; - - std::string data = "last_action_timestamp=" + time; - data += "&folders[0]=inbox&folders[1]=other"; // TODO: I'm not sure if this is still valid/used on fb side (or it has any effect at all) - 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); // NOTE: Request revised 11.2.2016 - - if (resp.code != HTTP_CODE_OK || resp.data.empty()) { - facy.handle_error("LoadLastMessages"); - return; - } - - CODE_BLOCK_TRY - - std::vector<facebook_message> messages; - std::map<std::string, facebook_chatroom*> chatrooms; - - facebook_json_parser* p = new facebook_json_parser(this); - p->parse_thread_messages(&resp.data, &messages, &chatrooms, false); - delete p; - - ReceiveMessages(messages, true); - - debugLogA("*** Thread messages processed"); - - CODE_BLOCK_CATCH - - debugLogA("*** Error processing thread messages: %s", e.what()); - - CODE_BLOCK_END - - facy.handle_success("SyncThreads"); -} - std::string truncateUtf8(std::string &text, size_t maxLength) { // To not split some unicode character we need to transform it to wchar_t first, then split it, and then convert it back, because we want std::string as result // TODO: Probably there is much simpler and nicer way |