From cc8010159eb49e389124c5fab3ed9ee0ec948d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 30 Nov 2014 22:18:20 +0000 Subject: Facebook: Rework options; Add new option to disable multi chats support git-svn-id: http://svn.miranda-ng.org/main/trunk@11182 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/docs/facebook - readme.txt | 1 - protocols/FacebookRM/res/facebook.rc | 106 ++++++++++++------- protocols/FacebookRM/src/connection.cpp | 2 +- protocols/FacebookRM/src/constants.h | 1 + protocols/FacebookRM/src/db.h | 2 +- protocols/FacebookRM/src/dialogs.cpp | 133 ++++++++++++++++-------- protocols/FacebookRM/src/dialogs.h | 5 +- protocols/FacebookRM/src/proto.cpp | 14 ++- protocols/FacebookRM/src/resource.h | 4 +- 9 files changed, 173 insertions(+), 95 deletions(-) diff --git a/protocols/FacebookRM/docs/facebook - readme.txt b/protocols/FacebookRM/docs/facebook - readme.txt index e84746533c..8eca1c3193 100644 --- a/protocols/FacebookRM/docs/facebook - readme.txt +++ b/protocols/FacebookRM/docs/facebook - readme.txt @@ -31,7 +31,6 @@ Info: "KeepUnread" (Byte) - 1 = Don't mark messages as read on server (works globally or per contact) "NaseemsSpamMode" (Byte) - 1 = Don't add contacts when we send message to them from other instances, add them only when they reply "NameAsNick" (Byte) - 0 = don't use real name as nickname, use nickname if possible (default is 1) -"EnableChat" (Byte) - 0 = don't use multi user chat at all (default is 1) (requires restart to apply) -------------------------------- Version history diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index fdb94969ac..a7eb8de43e 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -101,7 +101,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,110,94,44,15 END -IDD_OPTIONS DIALOGEX 0, 0, 305, 146 +IDD_OPTIONS DIALOGEX 0, 0, 305, 190 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -113,12 +113,16 @@ BEGIN EDITTEXT IDC_PW,84,33,123,13,ES_PASSWORD | ES_AUTOHSCROLL CONTROL "Create a new Facebook account",IDC_NEWACCOUNTLINK, "Hyperlink",WS_TABSTOP,84,52,189,10 - GROUPBOX "Contacts Settings",IDC_STATIC,7,72,291,60 - LTEXT "Default group:",IDC_STATIC,17,85,61,8,0,WS_EX_RIGHT - EDITTEXT IDC_GROUP,84,84,123,13,ES_AUTOHSCROLL + GROUPBOX "Network", IDC_STATIC, 7, 72, 291, 42 + CONTROL "Force secure (HTTPS) connection",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,85,281,10 + CONTROL "Use secure connection also for channel requests",IDC_SECURE_CHANNEL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,31,99,262,10 + GROUPBOX "Contacts",IDC_STATIC,7,120,291,60 + LTEXT "Default group:",IDC_STATIC,17,133,61,8,0,WS_EX_RIGHT + EDITTEXT IDC_GROUP,84,131,123,13,ES_AUTOHSCROLL CONTROL "Automatically set 'Ignore status change' flag",IDC_SET_IGNORE_STATUS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,101,271,10 - CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,114,271,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,149,271,10 + CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,162,271,10 END IDD_OPTIONS_EVENTS DIALOGEX 0, 0, 305, 185 @@ -134,50 +138,29 @@ BEGIN COMBOBOX IDC_FEED_TYPE,150,49,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Don't show advertising posts",IDC_FILTER_ADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,67,138,8 CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,79,272,8 - CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,272,8 + CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,272,8 CONTROL "Use balloon notifications in system tray instead of popups",IDC_SYSTRAY_NOTIFY, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,121,272,8 CONTROL "Use logging notifications into special chatroom",IDC_NOTIFICATIONS_CHATROOM, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,138,272,8 - PUSHBUTTON "Preview",IDC_PREVIEW,116,156,68,14 + PUSHBUTTON "Preview",IDC_PREVIEW,116,156,68,14 END -IDD_OPTIONS_ADVANCED DIALOGEX 0, 0, 308, 242 +IDD_OPTIONS_STATUSES DIALOGEX 0, 0, 308, 226 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - GROUPBOX "Advanced Settings",IDC_STATIC,7,7,294,104 - CONTROL "Force secure (HTTPS) connection",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,22,281,10 - CONTROL "Post Miranda statuses to Wall",IDC_SET_STATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,13,44,281,10 - CONTROL "Use secure connection also for channel requests",IDC_SECURE_CHANNEL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,32,33,262,10 + GROUPBOX "Statuses",IDC_STATIC,7,7,294,91 + CONTROL "Post Miranda statuses to Wall",IDC_SET_STATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,13,21,281,10 CONTROL "Turn off chat on Facebook when going to offline in Miranda",IDC_DISCONNECT_CHAT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,55,281,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,281,10 CONTROL "Map unsupported statuses to Invisible (instead of Online)",IDC_MAP_STATUSES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,67,281,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,47,281,10 CONTROL "Allow posting statuses to my pages (may slow down login)",IDC_LOAD_PAGES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,79,281,10 - RTEXT "Use this server for opening links:",IDC_STATIC,13,94,139,8 - COMBOBOX IDC_URL_SERVER,156,91,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Show stickers as custom smileys (EXPERIMENTAL)",IDC_CUSTOM_SMILEYS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,129,281,10 - CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,142,281,10 - GROUPBOX "Message sessions",IDC_STATIC,7,114,294,126 - CONTROL "Keep messages as unread on server (don't send ""seen"" info)",IDC_KEEP_UNREAD, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,155,281,10 - CONTROL "Receive messages from ""inbox"" folder only",IDC_INBOX_ONLY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,168,281,10 - CONTROL "Load last messages on opening message window (EXPERIMENTAL)",IDC_MESSAGES_ON_OPEN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,181,281,10 - RTEXT "Number of messages to load:",IDC_STATIC,13,195,231,8 - EDITTEXT IDC_MESSAGES_COUNT,249,192,34,14,ES_AUTOHSCROLL - CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,192,11,14 - CONTROL "Do not open chat windows on creation",IDC_HIDE_CHATS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,225,281,10 - CONTROL "Synchronize last 24 hours on login",IDC_LOGIN_SYNC, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,212,281,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,61,281,10 + RTEXT "Use this server for opening links:",IDC_STATIC,13,77,139,8 + COMBOBOX IDC_URL_SERVER,156,74,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224 @@ -196,6 +179,35 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,200,203,50,14 END +IDD_OPTIONS_MESSAGING DIALOGEX 0, 0, 308, 226 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + GROUPBOX "Messages",IDC_STATIC,7,7,294,70 + CONTROL "Receive messages from ""inbox"" folder only",IDC_INBOX_ONLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,281,10 + CONTROL "Use local time for received messages", IDC_USE_LOCAL_TIME, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 33, 281, 10 + CONTROL "Keep messages as unread on server (don't send ""seen"" info)",IDC_KEEP_UNREAD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,47,281,10 + CONTROL "Show stickers as custom smileys (EXPERIMENTAL)", IDC_CUSTOM_SMILEYS, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 61, 281, 10 + GROUPBOX "Multi user chats", IDC_STATIC, 7, 83, 294, 43 + CONTROL "Enable multi user chats support", IDC_ENABLE_CHATS, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 96, 281, 10 + CONTROL "Do not open chat windows on creation", IDC_HIDE_CHATS, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 110, 281, 10 + GROUPBOX "History synchronization", IDC_STATIC, 7, 134, 294, 59 + CONTROL "Load last messages (24 hours old) on login (EXPERIMENTAL)", IDC_LOGIN_SYNC, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 148, 281, 10 + CONTROL "Load last messages on opening message window (EXPERIMENTAL)", IDC_MESSAGES_ON_OPEN, + "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 162, 281, 10 + RTEXT "Number of messages to load:", IDC_STATIC, 13, 176, 231, 8 + EDITTEXT IDC_MESSAGES_COUNT,249,173,34,14,ES_AUTOHSCROLL + CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,173,11,14 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -237,13 +249,14 @@ BEGIN BEGIN LEFTMARGIN, 7 VERTGUIDE, 17 + VERTGUIDE, 31 VERTGUIDE, 78 VERTGUIDE, 84 VERTGUIDE, 207 VERTGUIDE, 288 VERTGUIDE, 298 TOPMARGIN, 7 - BOTTOMMARGIN, 139 + BOTTOMMARGIN, 183 END IDD_OPTIONS_EVENTS, DIALOG @@ -257,7 +270,20 @@ BEGIN BOTTOMMARGIN, 177 END - IDD_OPTIONS_ADVANCED, DIALOG + IDD_OPTIONS_STATUSES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 301 + VERTGUIDE, 13 + VERTGUIDE, 32 + VERTGUIDE, 152 + VERTGUIDE, 156 + VERTGUIDE, 294 + TOPMARGIN, 7 + BOTTOMMARGIN, 224 + END + + IDD_OPTIONS_MESSAGING, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 301 @@ -267,7 +293,7 @@ BEGIN VERTGUIDE, 156 VERTGUIDE, 294 TOPMARGIN, 7 - BOTTOMMARGIN, 240 + BOTTOMMARGIN, 224 END END #endif // APSTUDIO_INVOKED diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index d0d33ab838..2d86147031 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -92,7 +92,7 @@ void FacebookProto::ChangeStatus(void*) debugLogA("***** Beginning SignOn process"); - m_enableChat = getBool(FACEBOOK_KEY_ENABLE_CHAT, true); + m_enableChat = getBool(FACEBOOK_KEY_ENABLE_CHATS, true); m_iStatus = facy.self_.status_id = ID_STATUS_CONNECTING; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index 3bd34a0ff0..4ffcf4a848 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -87,6 +87,7 @@ along with this program. If not, see . #define DEFAULT_MESSAGES_ON_OPEN 0 #define DEFAULT_MESSAGES_ON_OPEN_COUNT 10 #define DEFAULT_HIDE_CHATS 0 +#define DEFAULT_ENABLE_CHATS 1 #define DEFAULT_NOTIFICATIONS_CHATROOM 0 #define DEFAULT_EVENT_NOTIFICATIONS_ENABLE 1 diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index a397e46fe3..e08322dfc3 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -67,6 +67,7 @@ along with this program. If not, see . #define FACEBOOK_KEY_MESSAGES_ON_OPEN "MessagesOnOpen" #define FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT "MessagesOnOpenCount" #define FACEBOOK_KEY_HIDE_CHATS "HideChats" +#define FACEBOOK_KEY_ENABLE_CHATS "EnableChat" #define FACEBOOK_KEY_NOTIFICATIONS_CHATROOM "NotificationsChatroom" // Account DB keys - notifications @@ -84,4 +85,3 @@ along with this program. If not, see . #define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode" #define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // [HIDDEN] - (byte) 0 = don't use real name as nickname, use nickname if possible #define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with -#define FACEBOOK_KEY_ENABLE_CHAT "EnableChat" // [HIDDEN] - (byte) 0 = don't use multi user chat at all (default is 1) (requires restart to apply) diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 024e920626..f546a54cf4 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -3,7 +3,7 @@ Facebook plugin for Miranda Instant Messenger _____________________________________________ -Copyright © 2009-11 Michal Zelinka, 2011-13 Robert Pösel +Copyright � 2009-11 Michal Zelinka, 2011-13 Robert P�sel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -362,6 +362,11 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp SendMessage(GetDlgItem(hwnd,IDC_PW),EM_SETREADONLY,TRUE,0); } + LoadDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS); + LoadDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL); + + EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE)); + SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0); ptrT group(db_get_tsa(NULL, proto->ModuleName(), FACEBOOK_KEY_DEF_GROUP)); @@ -385,6 +390,13 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if (HIWORD(wparam)==EN_CHANGE && (HWND)lparam==GetFocus()) SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); break; + case IDC_SECURE: + EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE)); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; + case IDC_SECURE_CHANNEL: + if (IsDlgButtonChecked(hwnd, IDC_SECURE_CHANNEL)) + MessageBox(hwnd, TranslateT("Note: Make sure you have disabled 'Validate SSL certificates' option in Network options to work properly."), proto->m_tszUserName, MB_OK); default: SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); } @@ -412,6 +424,9 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY); StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS); + StoreDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS); + StoreDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL); + return TRUE; } break; @@ -421,7 +436,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return FALSE; } -INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) +INT_PTR CALLBACK FBOptionsStatusesProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { FacebookProto *proto = reinterpret_cast(GetWindowLongPtr(hwnd,GWLP_USERDATA)); @@ -439,49 +454,20 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast(Translate(server_types[i].name))); SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0); - LoadDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS); - LoadDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL); LoadDBCheckState(proto, hwnd, IDC_DISCONNECT_CHAT, FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT); LoadDBCheckState(proto, hwnd, IDC_SET_STATUS, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS); LoadDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES); - LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS); - LoadDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP, DEFAULT_LOCAL_TIME); LoadDBCheckState(proto, hwnd, IDC_LOAD_PAGES, FACEBOOK_KEY_LOAD_PAGES, DEFAULT_LOAD_PAGES); - LoadDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY, DEFAULT_INBOX_ONLY); - 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_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS); - - int count = proto->getByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, 10); - count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT); - SetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, count, TRUE); - - SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT, EM_LIMITTEXT, 2, 0); - SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT_SPIN, UDM_SETRANGE32, 1, 99); - - EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE)); return TRUE; } case WM_COMMAND: { switch (LOWORD(wparam)) { - case IDC_SECURE: - EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE)); - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; case IDC_URL_SERVER: if(HIWORD(wparam) == CBN_SELCHANGE) SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); break; - case IDC_MESSAGES_COUNT: - if(HIWORD(wparam) == EN_CHANGE && (HWND)lparam==GetFocus()) - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - case IDC_SECURE_CHANNEL: - if (IsDlgButtonChecked(hwnd, IDC_SECURE_CHANNEL)) - MessageBox(hwnd, TranslateT("Note: Make sure you have disabled 'Validate SSL certificates' option in Network options to work properly."), proto->m_tszUserName, MB_OK); default: SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); break; @@ -494,22 +480,9 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L { proto->setByte(FACEBOOK_KEY_SERVER_TYPE, SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_GETCURSEL, 0, 0)); - StoreDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS); - StoreDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL); StoreDBCheckState(proto, hwnd, IDC_DISCONNECT_CHAT, FACEBOOK_KEY_DISCONNECT_CHAT); StoreDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES); - StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS); - StoreDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP); StoreDBCheckState(proto, hwnd, IDC_LOAD_PAGES, FACEBOOK_KEY_LOAD_PAGES); - StoreDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY); - 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_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS); - - int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, NULL, TRUE); - count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT); - proto->setByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, count); BOOL setStatus = IsDlgButtonChecked(hwnd, IDC_SET_STATUS); BOOL setStatusOld = proto->getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS); @@ -530,7 +503,7 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L } -INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) +INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { FacebookProto *proto = reinterpret_cast(GetWindowLongPtr(hwnd,GWLP_USERDATA)); @@ -600,3 +573,73 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa return FALSE; } + +INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) +{ + FacebookProto *proto = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); + + switch (message) + { + + case WM_INITDIALOG: + { + TranslateDialogDefault(hwnd); + + proto = reinterpret_cast(lparam); + SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); + + LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS); + LoadDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP, DEFAULT_LOCAL_TIME); + LoadDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY, DEFAULT_INBOX_ONLY); + 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); + + int count = proto->getByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, 10); + count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT); + SetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, count, TRUE); + + SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT, EM_LIMITTEXT, 2, 0); + SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT_SPIN, UDM_SETRANGE32, 1, 99); + + } return TRUE; + + case WM_COMMAND: + switch (LOWORD(wparam)) + { + case IDC_MESSAGES_COUNT: + if (HIWORD(wparam) == EN_CHANGE && (HWND)lparam == GetFocus()) + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; + default: + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + } + return TRUE; + + case WM_NOTIFY: + { + if (reinterpret_cast(lparam)->code == PSN_APPLY) + { + StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS); + StoreDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP); + StoreDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY); + 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); + StoreDBCheckState(proto, hwnd, IDC_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS); + + int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, NULL, TRUE); + count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT); + proto->setByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, count); + } + } return TRUE; + + } + + return FALSE; +} diff --git a/protocols/FacebookRM/src/dialogs.h b/protocols/FacebookRM/src/dialogs.h index facc969acd..10fa04ef6f 100644 --- a/protocols/FacebookRM/src/dialogs.h +++ b/protocols/FacebookRM/src/dialogs.h @@ -25,5 +25,6 @@ along with this program. If not, see . INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); -INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); -INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); +INT_PTR CALLBACK FBOptionsStatusesProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index ffd21442c9..21ca57a4a1 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -473,13 +473,19 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.position = 271829; odp.ptszTab = LPGENT("Events"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_EVENTS); - odp.pfnDlgProc = FBEventsProc; + odp.pfnDlgProc = FBOptionsEventsProc; Options_AddPage(wParam, &odp); odp.position = 271830; - odp.ptszTab = LPGENT("Advanced"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_ADVANCED); - odp.pfnDlgProc = FBOptionsAdvancedProc; + odp.ptszTab = LPGENT("Statuses"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_STATUSES); + odp.pfnDlgProc = FBOptionsStatusesProc; + Options_AddPage(wParam, &odp); + + odp.position = 271831; + odp.ptszTab = LPGENT("Messaging"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MESSAGING); + odp.pfnDlgProc = FBOptionsMessagingProc; Options_AddPage(wParam, &odp); return 0; } diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index 6c73fcf362..ee6cad34da 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -9,8 +9,9 @@ #define IDD_MIND 112 #define IDD_OPTIONS 113 #define IDD_OPTIONS_EVENTS 114 -#define IDD_OPTIONS_ADVANCED 115 +#define IDD_OPTIONS_STATUSES 115 #define IDD_CAPTCHAFORM 116 +#define IDD_OPTIONS_MESSAGING 117 #define IDI_POKE 127 #define IDI_NOTIFICATION 128 #define IDI_NEWSFEED 129 @@ -43,6 +44,7 @@ #define IDC_CLIENT_ENABLE 1044 #define IDC_FILTER_ADS 1045 #define IDC_LOGIN_SYNC 1046 +#define IDC_ENABLE_CHATS 1047 #define IDC_SYSTRAY_NOTIFY 1098 #define IDC_PREVIEW 1099 #define IDC_NOTIFICATIONS_CHATROOM 1100 -- cgit v1.2.3