diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-08-17 12:53:06 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-08-17 12:53:06 +0000 |
commit | 0a82846a9176641fbb556cb96ff745bbf0cdda37 (patch) | |
tree | 035cdd67a39cecfd6ef7a0454c9e8e6a773e42d0 /protocols/FacebookRM | |
parent | d1ff6d1f09cc8f24993060d03e9e20cc855c2bb7 (diff) |
Facebook: Remove option "Load last messages (24 hours old)" as it doesn't work anymore
git-svn-id: http://svn.miranda-ng.org/main/trunk@17190 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/res/facebook.rc | 12 | ||||
-rw-r--r-- | protocols/FacebookRM/src/connection.cpp | 7 | ||||
-rw-r--r-- | protocols/FacebookRM/src/constants.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/db.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 64 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/resource.h | 1 |
8 files changed, 7 insertions, 82 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index 94d1ba1ce2..f918e1efd6 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -207,14 +207,12 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,83,281,10
CONTROL "Automatically join active chats that exist in contact list",IDC_JOIN_EXISTING_CHATS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,97,281,10
- GROUPBOX "History synchronization",IDC_STATIC,7,121,294,59
- CONTROL "Load last messages (24 hours old) on login (EXPERIMENTAL)",IDC_LOGIN_SYNC,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,135,281,10
+ GROUPBOX "History synchronization",IDC_STATIC,7,121,294,44
CONTROL "Load last messages on opening message window (EXPERIMENTAL)",IDC_MESSAGES_ON_OPEN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,149,281,10
- RTEXT "Number of messages to load:",IDC_STATIC,13,163,231,8
- EDITTEXT IDC_MESSAGES_COUNT,249,160,34,14,ES_AUTOHSCROLL
- CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,160,11,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,134,281,10
+ RTEXT "Number of messages to load:",IDC_STATIC,13,148,231,8
+ EDITTEXT IDC_MESSAGES_COUNT,249,145,34,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,145,11,14
END
IDD_GUARD DIALOGEX 0, 0, 285, 104
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index e26c64e471..1a6c60ad50 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -114,11 +114,8 @@ void FacebookProto::ChangeStatus(void*) // Process friendship requests ForkThread(&FacebookProto::ProcessFriendRequests, NULL); - // Sync threads, get messages - or get unread messages - if (getBool(FACEBOOK_KEY_LOGIN_SYNC, DEFAULT_LOGIN_SYNC)) - ForkThread(&FacebookProto::SyncThreads, NULL); - else - ForkThread(&FacebookProto::ProcessUnreadMessages, NULL); + // Get unread messages + ForkThread(&FacebookProto::ProcessUnreadMessages, NULL); // Get notifications if (getByte(FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE)) diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index 378ad30cf0..bc90d50636 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -91,7 +91,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DEFAULT_LOAD_PAGES 0
#define DEFAULT_KEEP_UNREAD 0
#define DEFAULT_FILTER_ADS 0
-#define DEFAULT_LOGIN_SYNC 0
#define DEFAULT_MESSAGES_ON_OPEN 0
#define DEFAULT_MESSAGES_ON_OPEN_COUNT 10
#define DEFAULT_HIDE_CHATS 0
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index be346fd2f4..1f6bcfb234 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -65,7 +65,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FACEBOOK_KEY_LOAD_PAGES "LoadPages"
#define FACEBOOK_KEY_FILTER_ADS "FilterAds"
#define FACEBOOK_KEY_LOGON_TS "LogonTS"
-#define FACEBOOK_KEY_LOGIN_SYNC "LoginSync" // (byte) 0 = get only unread messages, 1 = sync messages since last activity (default is 0)
#define FACEBOOK_KEY_LAST_ACTION_TS "LastActionTS"
#define FACEBOOK_KEY_MESSAGES_ON_OPEN "MessagesOnOpen"
#define FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT "MessagesOnOpenCount"
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index bf478d165f..cb9aee5a4b 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -572,7 +572,6 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS); LoadDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD, DEFAULT_KEEP_UNREAD); LoadDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN); - LoadDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC, DEFAULT_LOGIN_SYNC); LoadDBCheckState(proto, hwnd, IDC_ENABLE_CHATS, FACEBOOK_KEY_ENABLE_CHATS, DEFAULT_ENABLE_CHATS); LoadDBCheckState(proto, hwnd, IDC_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS); @@ -605,7 +604,6 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, { StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS); StoreDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD); - StoreDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC); StoreDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN); StoreDBCheckState(proto, hwnd, IDC_ENABLE_CHATS, FACEBOOK_KEY_ENABLE_CHATS); 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 diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index cb1b8febe3..6aa1690dd7 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -174,7 +174,6 @@ public: void __cdecl SearchIdAckThread(void*); void __cdecl ProcessPages(void*); void __cdecl LoadLastMessages(void*); - void __cdecl SyncThreads(void*); void __cdecl ProcessMemories(void*); // Worker threads diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index 79fe37e726..886c607041 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -45,7 +45,6 @@ #define IDC_NOTIFICATIONS_ENABLE 1041 #define IDC_FEEDS_ENABLE 1042 #define IDC_FILTER_ADS 1045 -#define IDC_LOGIN_SYNC 1046 #define IDC_ENABLE_CHATS 1047 #define IDC_FRIENDSHIP_ENABLE 1048 #define IDC_TICKER_ENABLE 1049 |