diff options
Diffstat (limited to 'protocols/VKontakte/src/vk_options.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 1041 |
1 files changed, 391 insertions, 650 deletions
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 223df9ce21..178a9e37c9 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -17,669 +17,61 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Account manager dialog
-
-INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- {
- ptrT ptszLogin(ppro->getTStringA("Login"));
- if (ptszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
-
- ptrT ptszPassw(ppro->GetUserStoredPassword());
- if (ptszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
- }
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_URL:
- Utils_OpenUrl("http://vk.com");
- break;
-
- case IDC_LOGIN:
- case IDC_PASSWORD:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- TCHAR str[1025];
- bool bNeedClearToken = false;
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
-
- CMString tszLogin(ptrT(ppro->getTStringA("Login")));
- if (tszLogin != str) {
- bNeedClearToken = true;
- ppro->setTString("Login", str);
- }
-
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
- CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
-
- T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL && tszPassw != str) {
- bNeedClearToken = true;
- ppro->setString("Password", szRawPasswd);
- }
-
- if (bNeedClearToken)
- ppro->ClearAccessToken();
-
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
-
- return FALSE;
-}
+////////////////////// Account manager dialog ////////////////////////////////
INT_PTR CVkProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, VKAccountProc, (LPARAM)this);
+ CVkAccMgrForm *dlg = new CVkAccMgrForm(this, (HWND)lParam);
+ dlg->Show();
+ return (INT_PTR)dlg->GetHwnd();
}
//////////////////////////////////////////////////////////////////////////////
-// Options
-
-INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- CVKLang vkLangCodes[] = {
- { NULL, LPGENT("Account language") },
- { _T("en"), LPGENT("English") },
- { _T("ru"), LPGENT("Russian") },
- { _T("be"), LPGENT("Belarusian") },
- { _T("ua"), LPGENT("Ukrainian") },
- { _T("es"), LPGENT("Spanish") },
- { _T("fi"), LPGENT("Finnish") },
- { _T("de"), LPGENT("German") },
- { _T("it"), LPGENT("Italian") },
- };
-
- HWND hWndCombo = GetDlgItem(hwndDlg, IDC_COMBO_LANGUAGE);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- {
- ptrT ptszLogin(ppro->getTStringA("Login"));
- if (ptszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
-
- ptrT ptszPassw(ppro->GetUserStoredPassword());
- if (ptszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
- }
-
- SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
-
- for (size_t i = 0; i < _countof(vkLangCodes); i++) {
- LRESULT iItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(vkLangCodes[i].szDescription));
- SendMessage(hWndCombo, CB_SETITEMDATA, iItem, (LPARAM)vkLangCodes[i].szCode);
- if (!mir_tstrcmpi(vkLangCodes[i].szCode, ppro->m_VKLang))
- SendMessage(hWndCombo, CB_SETCURSEL, i, 0);
- }
-
- CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USE_LOCAL_TIME, ppro->m_bUseLocalTime ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getBool("AutoClean") ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ONREAD, (ppro->m_iMarkMessageReadOn == markOnRead) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONRECEIVE, (ppro->m_iMarkMessageReadOn == markOnReceive) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONREPLY, (ppro->m_iMarkMessageReadOn == markOnReply) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTYPING, (ppro->m_iMarkMessageReadOn == markOnTyping) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_SYNC_OFF, (ppro->m_iSyncHistoryMetod == syncOff) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_AUTO, (ppro->m_iSyncHistoryMetod == syncAuto) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_LAST1DAY, (ppro->m_iSyncHistoryMetod == sync1Days) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_LAST3DAY, (ppro->m_iSyncHistoryMetod == sync3Days) ? BST_CHECKED : BST_UNCHECKED);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_URL:
- Utils_OpenUrl("http://vk.com");
- break;
-
- case IDC_LOGIN:
- case IDC_PASSWORD:
- case IDC_GROUPNAME:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_COMBO_LANGUAGE:
- if (HIWORD(wParam) == CBN_SELCHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- case IDC_DELIVERY:
- case IDC_USE_LOCAL_TIME:
- case IDC_AUTOCLEAN:
-
- case IDC_ONREAD:
- case IDC_ONRECEIVE:
- case IDC_ONREPLY:
- case IDC_ONTYPING:
-
- case IDC_SYNC_OFF:
- case IDC_SYNC_AUTO:
- case IDC_SYNC_LAST1DAY:
- case IDC_SYNC_LAST3DAY:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- TCHAR str[1025];
- bool bNeedClearToken = false;
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
-
- CMString tszLogin(ptrT(ppro->getTStringA("Login")));
- if (tszLogin != str) {
- bNeedClearToken = true;
- ppro->setTString("Login", str);
- }
-
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
- CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
-
- T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL && tszPassw != str) {
- bNeedClearToken = true;
- ppro->setString("Password", szRawPasswd);
- }
-
- GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
- if (mir_tstrcmp(ppro->getGroup(), str)) {
- ppro->setGroup(str);
- ppro->setTString("ProtoGroup", str);
- }
-
- ppro->m_VKLang = mir_tstrdup((TCHAR*)SendMessage(hWndCombo, CB_GETITEMDATA, SendMessage(hWndCombo, CB_GETCURSEL, 0, 0), 0));
- if (!IsEmpty(ppro->m_VKLang))
- ppro->setTString("VKLang", ppro->m_VKLang);
- else
- ppro->delSetting("VKLang");
-
- ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
- ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
-
- ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
-
- ppro->m_bUseLocalTime = IsDlgButtonChecked(hwndDlg, IDC_USE_LOCAL_TIME) == BST_CHECKED;
- ppro->setByte("UseLocalTime", ppro->m_bUseLocalTime);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_ONREAD) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnRead;
- if (IsDlgButtonChecked(hwndDlg, IDC_ONRECEIVE) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnReceive;
- if (IsDlgButtonChecked(hwndDlg, IDC_ONREPLY) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnReply;
- if (IsDlgButtonChecked(hwndDlg, IDC_ONTYPING) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnTyping;
- ppro->setByte("MarkMessageReadOn", ppro->m_iMarkMessageReadOn);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_OFF) == BST_CHECKED)
- ppro->m_iSyncHistoryMetod = syncOff;
- if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_AUTO) == BST_CHECKED)
- ppro->m_iSyncHistoryMetod = syncAuto;
- if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_LAST1DAY) == BST_CHECKED)
- ppro->m_iSyncHistoryMetod = sync1Days;
- if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_LAST3DAY) == BST_CHECKED)
- ppro->m_iSyncHistoryMetod = sync3Days;
-
- ppro->setByte("SyncHistoryMetod", ppro->m_iSyncHistoryMetod);
-
- if (bNeedClearToken)
- ppro->ClearAccessToken();
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
- return FALSE;
-}
+CVkAccMgrForm::CVkAccMgrForm(CVkProto *proto, HWND hwndParent):
+ CVkDlgBase(proto, IDD_ACCMGRUI, false),
+ m_edtLogin(this, IDC_LOGIN),
+ m_edtPassword(this, IDC_PASSWORD),
+ m_hlLink(this, IDC_URL, "https://vk.com/"),
+ m_proto(proto)
-INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_MSG_STATUS, ppro->m_bSyncReadMessageStatusFromServer ? BST_CHECKED : BST_UNCHECKED);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_MESASUREAD), IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MESASUREAD, ppro->m_bMesAsUnread ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_FORCE_ONLINE_ON_ACT, ppro->m_bUserForceOnlineOnActivity ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USENOSTDURLENCODE, ppro->m_bUseNonStandardUrlEncode ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USENOSTDPOPUPS, ppro->m_bUseNonStandardNotifications ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_REPORT_ABUSE, ppro->m_bReportAbuse ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLEAR_SERVER_HISTORY, ppro->m_bClearServerHistory ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_FRENDLIST, ppro->m_bRemoveFromFrendlist ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_CLIST, ppro->m_bRemoveFromClist ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_NONE, (ppro->m_iMusicSendMetod == sendNone) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_BROADCAST, (ppro->m_iMusicSendMetod == sendBroadcastOnly) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_STATUS, (ppro->m_iMusicSendMetod == sendStatusOnly) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_BROADCAST_AND_STATUS, (ppro->m_iMusicSendMetod == sendBroadcastAndStatus) ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETRANGE, 0, MAKELONG(60, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETPOS, 0, ppro->m_iInvisibleInterval);
-
- SetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, ppro->m_ReturnChatMessage);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ED_INT_INVIS:
- if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_SYNC_MSG_STATUS:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus()) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MESASUREAD), IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_UNCHECKED);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_RET_CHAT_MES:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_HIDECHATS:
- case IDC_MESASUREAD:
- case IDC_FORCE_ONLINE_ON_ACT:
- case IDC_USENOSTDURLENCODE:
- case IDC_USENOSTDPOPUPS:
- case IDC_REPORT_ABUSE:
- case IDC_CLEAR_SERVER_HISTORY:
- case IDC_REMOVE_FROM_FRENDLIST:
- case IDC_REMOVE_FROM_CLIST:
- case IDC_SEND_MUSIC_NONE:
- case IDC_SEND_MUSIC_BROADCAST:
- case IDC_SEND_MUSIC_STATUS:
- case IDC_SEND_MUSIC_BROADCAST_AND_STATUS:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
- ppro->setByte("HideChats", ppro->m_bHideChats);
-
- ppro->m_bSyncReadMessageStatusFromServer = IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_CHECKED;
- ppro->setByte("SyncReadMessageStatusFromServer", ppro->m_bSyncReadMessageStatusFromServer);
-
- ppro->m_bMesAsUnread = IsDlgButtonChecked(hwndDlg, IDC_MESASUREAD) == BST_CHECKED;
- ppro->setByte("MesAsUnread", ppro->m_bMesAsUnread);
-
- ppro->m_bUserForceOnlineOnActivity = IsDlgButtonChecked(hwndDlg, IDC_FORCE_ONLINE_ON_ACT) == BST_CHECKED;
- ppro->setByte("UserForceOnlineOnActivity", ppro->m_bUserForceOnlineOnActivity);
-
- ppro->m_bUseNonStandardUrlEncode = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDURLENCODE) == BST_CHECKED;
- ppro->setByte("UseNonStandardUrlEncode", ppro->m_bUseNonStandardUrlEncode);
-
- ppro->m_bUseNonStandardNotifications = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDPOPUPS) == BST_CHECKED;
- ppro->setByte("UseNonStandardNotifications", ppro->m_bUseNonStandardNotifications);
-
- ppro->m_bReportAbuse = IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) == BST_CHECKED;
- ppro->setByte("ReportAbuseOnBanUser", ppro->m_bReportAbuse);
-
- ppro->m_bClearServerHistory = IsDlgButtonChecked(hwndDlg, IDC_CLEAR_SERVER_HISTORY) == BST_CHECKED;
- ppro->setByte("ClearServerHistoryOnBanUser", ppro->m_bClearServerHistory);
-
- ppro->m_bRemoveFromFrendlist = IsDlgButtonChecked(hwndDlg, IDC_REMOVE_FROM_FRENDLIST) == BST_CHECKED;
- ppro->setByte("RemoveFromFrendlistOnBanUser", ppro->m_bRemoveFromFrendlist);
-
- ppro->m_bRemoveFromClist = IsDlgButtonChecked(hwndDlg, IDC_REMOVE_FROM_CLIST) == BST_CHECKED;
- ppro->setByte("RemoveFromClistOnBanUser", ppro->m_bRemoveFromClist);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_NONE) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendNone;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_BROADCAST) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendBroadcastOnly;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_STATUS) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendStatusOnly;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_BROADCAST_AND_STATUS) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendBroadcastAndStatus;
- ppro->setByte("MusicSendMetod", ppro->m_iMusicSendMetod);
- CMStringA szListeningTo(ppro->m_szModuleName);
- szListeningTo += "Enabled";
- db_set_b(NULL, "ListeningTo", szListeningTo, ppro->m_iMusicSendMetod == 0 ? 0 : 1);
-
- TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, _countof(buffer));
- ppro->setDword("InvisibleInterval", ppro->m_iInvisibleInterval = _ttoi(buffer));
-
- TCHAR str[4096];
- GetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, str, _countof(str));
- CMString tszReturnChatMessage(str);
- if (tszReturnChatMessage != ppro->m_ReturnChatMessage) {
- tszReturnChatMessage.Trim();
- ppro->m_ReturnChatMessage = mir_tstrdup(tszReturnChatMessage.IsEmpty() ? TranslateT("I'm back"): tszReturnChatMessage);
- ppro->setTString("ReturnChatMessage", ppro->m_ReturnChatMessage);
- }
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
+ SetParent(hwndParent);
- return FALSE;
+ CreateLink(m_edtLogin, "Login", _T(""));
}
-INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+void CVkAccMgrForm::OnInitDialog()
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_NEWS_ENBL, ppro->m_bNewsEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOTIF_ENBL, ppro->m_bNotificationsEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOTIF_MARK_VIEWED, ppro->m_bNotificationsMarkAsViewed ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SPEC_CONT_ENBL, ppro->m_bSpecialContactAlwaysEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSAUTOCLEAR, ppro->m_bNewsAutoClearHistory ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_F_POSTS, ppro->m_bNewsFilterPosts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_PHOTOS, ppro->m_bNewsFilterPhotos ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_TAGS, ppro->m_bNewsFilterTags ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_WALLPHOTOS, ppro->m_bNewsFilterWallPhotos ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_S_FRIENDS, ppro->m_bNewsSourceFriends ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_GROUPS, ppro->m_bNewsSourceGroups ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_PAGES, ppro->m_bNewsSourcePages ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_FOLLOWING, ppro->m_bNewsSourceFollowing ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_BANNED, ppro->m_bNewsSourceIncludeBanned ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_NOREPOSTES, ppro->m_bNewsSourceNoReposts ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_N_COMMENTS, ppro->m_bNotificationFilterComments ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_LIKES, ppro->m_bNotificationFilterLikes ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_REPOSTS, ppro->m_bNotificationFilterReposts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_MENTIONS, ppro->m_bNotificationFilterMentions ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_INVITES, ppro->m_bNotificationFilterInvites ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETRANGE, 0, MAKELONG(60*24, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETPOS, 0, ppro->m_iNewsInterval);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NOTIF, UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NOTIF, UDM_SETPOS, 0, ppro->m_iNotificationsInterval);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ED_INT_NEWS:
- case IDC_ED_INT_NOTIF:
- if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_NEWS_ENBL:
- case IDC_NOTIF_ENBL:
- case IDC_NOTIF_MARK_VIEWED:
- case IDC_SPEC_CONT_ENBL:
- case IDC_NEWSAUTOCLEAR:
- case IDC_F_POSTS:
- case IDC_F_PHOTOS:
- case IDC_F_TAGS:
- case IDC_F_WALLPHOTOS:
- case IDC_S_FRIENDS:
- case IDC_S_GROUPS:
- case IDC_S_PAGES:
- case IDC_S_FOLLOWING:
- case IDC_S_BANNED:
- case IDC_S_NOREPOSTES:
- case IDC_N_COMMENTS:
- case IDC_N_LIKES:
- case IDC_N_REPOSTS:
- case IDC_N_MENTIONS:
- case IDC_N_INVITES:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- ppro->m_bNewsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NEWS_ENBL) == BST_CHECKED;
- ppro->setByte("NewsEnabled", ppro->m_bNewsEnabled);
-
- ppro->m_bNotificationsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_ENBL) == BST_CHECKED;
- ppro->setByte("NotificationsEnabled", ppro->m_bNotificationsEnabled);
-
- ppro->m_bNotificationsMarkAsViewed = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_MARK_VIEWED) == BST_CHECKED;
- ppro->setByte("NotificationsMarkAsViewed", ppro->m_bNotificationsMarkAsViewed);
-
- ppro->m_bSpecialContactAlwaysEnabled = IsDlgButtonChecked(hwndDlg, IDC_SPEC_CONT_ENBL) == BST_CHECKED;
- ppro->setByte("SpecialContactAlwaysEnabled", ppro->m_bSpecialContactAlwaysEnabled);
-
- ppro->m_bNewsAutoClearHistory = IsDlgButtonChecked(hwndDlg, IDC_NEWSAUTOCLEAR) == BST_CHECKED;
- ppro->setByte("NewsAutoClearHistory", ppro->m_bNewsAutoClearHistory);
-
- ppro->m_bNewsFilterPosts = IsDlgButtonChecked(hwndDlg, IDC_F_POSTS) == BST_CHECKED;
- ppro->setByte("NewsFilterPosts", ppro->m_bNewsFilterPosts);
-
- ppro->m_bNewsFilterPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_PHOTOS) == BST_CHECKED;
- ppro->setByte("NewsFilterPhotos", ppro->m_bNewsFilterPhotos);
-
- ppro->m_bNewsFilterTags = IsDlgButtonChecked(hwndDlg, IDC_F_TAGS) == BST_CHECKED;
- ppro->setByte("NewsFilterTags", ppro->m_bNewsFilterTags);
-
- ppro->m_bNewsFilterWallPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_WALLPHOTOS) == BST_CHECKED;
- ppro->setByte("NewsFilterWallPhotos", ppro->m_bNewsFilterWallPhotos);
-
- ppro->m_bNewsSourceFriends = IsDlgButtonChecked(hwndDlg, IDC_S_FRIENDS) == BST_CHECKED;
- ppro->setByte("NewsSourceFriends", ppro->m_bNewsSourceFriends);
-
- ppro->m_bNewsSourceGroups = IsDlgButtonChecked(hwndDlg, IDC_S_GROUPS) == BST_CHECKED;
- ppro->setByte("NewsSourceGroups", ppro->m_bNewsSourceGroups);
-
- ppro->m_bNewsSourcePages = IsDlgButtonChecked(hwndDlg, IDC_S_PAGES) == BST_CHECKED;
- ppro->setByte("NewsSourcePages", ppro->m_bNewsSourcePages);
-
- ppro->m_bNewsSourceFollowing = IsDlgButtonChecked(hwndDlg, IDC_S_FOLLOWING) == BST_CHECKED;
- ppro->setByte("NewsSourceFollowing", ppro->m_bNewsSourceFollowing);
-
- ppro->m_bNewsSourceIncludeBanned = IsDlgButtonChecked(hwndDlg, IDC_S_BANNED) == BST_CHECKED;
- ppro->setByte("NewsSourceIncludeBanned", ppro->m_bNewsSourceIncludeBanned);
-
- ppro->m_bNewsSourceNoReposts = IsDlgButtonChecked(hwndDlg, IDC_S_NOREPOSTES) == BST_CHECKED;
- ppro->setByte("NewsSourceNoReposts", ppro->m_bNewsSourceNoReposts);
-
- ppro->m_bNotificationFilterComments = IsDlgButtonChecked(hwndDlg, IDC_N_COMMENTS) == BST_CHECKED;
- ppro->setByte("NotificationFilterComments", ppro->m_bNotificationFilterComments);
-
- ppro->m_bNotificationFilterLikes = IsDlgButtonChecked(hwndDlg, IDC_N_LIKES) == BST_CHECKED;
- ppro->setByte("NotificationFilterLikes", ppro->m_bNotificationFilterLikes);
+ CSuper::OnInitDialog();
- ppro->m_bNotificationFilterReposts = IsDlgButtonChecked(hwndDlg, IDC_N_REPOSTS) == BST_CHECKED;
- ppro->setByte("NotificationFilterReposts", ppro->m_bNotificationFilterReposts);
-
- ppro->m_bNotificationFilterMentions = IsDlgButtonChecked(hwndDlg, IDC_N_MENTIONS) == BST_CHECKED;
- ppro->setByte("NotificationFilterMentions", ppro->m_bNotificationFilterMentions);
-
- ppro->m_bNotificationFilterInvites = IsDlgButtonChecked(hwndDlg, IDC_N_INVITES) == BST_CHECKED;
- ppro->setByte("NotificationFilterInvites", ppro->m_bNotificationFilterInvites);
-
- TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, _countof(buffer));
- ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
-
- GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, _countof(buffer));
- ppro->setDword("NotificationsInterval", ppro->m_iNotificationsInterval = _ttoi(buffer));
+ m_ptszOldLogin = m_edtLogin.GetText();
+ m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
-
- return FALSE;
+ m_ptszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_ptszOldPass);
+ m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
}
-INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+void CVkAccMgrForm::OnApply()
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_IMG_OFF, (ppro->m_iIMGBBCSupport == imgNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_FULLSIZE, (ppro->m_iIMGBBCSupport == imgFullSize) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_130, (ppro->m_iIMGBBCSupport == imgPreview130) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_604, (ppro->m_iIMGBBCSupport == imgPreview604) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_OFF, (ppro->m_iBBCForNews == bbcNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_BASIC, (ppro->m_iBBCForNews == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_ADV, (ppro->m_iBBCForNews == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_BBC_ATT_NEWS, ppro->m_bUseBBCOnAttacmentsAsNews ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ATTBBC_OFF, (ppro->m_iBBCForAttachments == bbcNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ATTBBC_BASIC, (ppro->m_iBBCForAttachments == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ATTBBC_ADV, (ppro->m_iBBCForAttachments == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_STICKERS_AS_SMYLES, ppro->m_bStikersAsSmyles ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOTEN_LINKS_FOR_AUDIO, ppro->m_bShortenLinksForAudio ? BST_CHECKED : BST_UNCHECKED);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_IMG_OFF:
- case IDC_IMG_FULLSIZE:
- case IDC_IMG_130:
- case IDC_IMG_604:
- case IDC_NEWSBBC_OFF:
- case IDC_NEWSBBC_BASIC:
- case IDC_NEWSBBC_ADV:
- case IDC_BBC_ATT_NEWS:
- case IDC_ATTBBC_OFF:
- case IDC_ATTBBC_BASIC:
- case IDC_ATTBBC_ADV:
- case IDC_STICKERS_AS_SMYLES:
- case IDC_SHOTEN_LINKS_FOR_AUDIO:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_OFF) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_FULLSIZE) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgFullSize;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_130) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgPreview130;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_604) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgPreview604;
- ppro->setByte("IMGBBCSupport", ppro->m_iIMGBBCSupport);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_OFF) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_BASIC) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcBasic;
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_ADV) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcAdvanced;
- ppro->setByte("BBCForNews", ppro->m_iBBCForNews);
-
- ppro->m_bUseBBCOnAttacmentsAsNews = IsDlgButtonChecked(hwndDlg, IDC_BBC_ATT_NEWS) == BST_CHECKED;
- ppro->setByte("UseBBCOnAttacmentsAsNews", ppro->m_bStikersAsSmyles);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_OFF) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_BASIC) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcBasic;
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_ADV) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcAdvanced;
- ppro->setByte("BBCForAttachments", ppro->m_iBBCForAttachments);
-
- ppro->m_bStikersAsSmyles = IsDlgButtonChecked(hwndDlg, IDC_STICKERS_AS_SMYLES) == BST_CHECKED;
- ppro->setByte("StikersAsSmyles", ppro->m_bStikersAsSmyles);
-
- ppro->m_bShortenLinksForAudio = IsDlgButtonChecked(hwndDlg, IDC_SHOTEN_LINKS_FOR_AUDIO) == BST_CHECKED;
- ppro->setByte("ShortenLinksForAudio", ppro->m_bShortenLinksForAudio);
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
+ pass_ptrT ptszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ if (bPassChanged) {
+ T2Utf szRawPasswd(ptszNewPass);
+ m_proto->setString("Password", szRawPasswd);
+ pass_ptrA pszPass(szRawPasswd);
+ m_ptszOldPass = ptszNewPass;
}
- return FALSE;
+ ptrT ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ m_proto->ClearAccessToken();
+ m_ptszOldLogin = ptszNewLogin;
}
+////////////////////// Options ///////////////////////////////////////////////
+
int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
@@ -691,26 +83,375 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.ptszTab = LPGENT("Account");
odp.position = 1;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
- odp.pfnDlgProc = &CVkProto::OptionsProc;
+ odp.pDialog = new CVkOptionAccountForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Advanced");
odp.position = 2;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADV);
- odp.pfnDlgProc = &CVkProto::OptionsAdvProc;
+ odp.pDialog = new CVkOptionAdvancedForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("News and notifications");
odp.position = 3;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FEEDS);
- odp.pfnDlgProc = &CVkProto::OptionsFeedsProc;
+ odp.pDialog = new CVkOptionFeedsForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("View");
odp.position = 4;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VIEW);
- odp.pfnDlgProc = &CVkProto::OptionsViewProc;
+ odp.pDialog = new CVkOptionViewForm(this);
Options_AddPage(wParam, &odp);
+
return 0;
-}
\ No newline at end of file +}
+
+////////////////////// Account page //////////////////////////////////////////
+
+static CVKLang vkLangCodes[] = {
+ { NULL, LPGENT("Account language") },
+ { _T("en"), LPGENT("English") },
+ { _T("ru"), LPGENT("Russian") },
+ { _T("be"), LPGENT("Belarusian") },
+ { _T("ua"), LPGENT("Ukrainian") },
+ { _T("es"), LPGENT("Spanish") },
+ { _T("fi"), LPGENT("Finnish") },
+ { _T("de"), LPGENT("German") },
+ { _T("it"), LPGENT("Italian") },
+};
+
+CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_MAIN, false),
+ m_edtLogin(this, IDC_LOGIN),
+ m_edtPassword(this, IDC_PASSWORD),
+ m_hlLink(this, IDC_URL, "https://vk.com/"),
+ m_edtGroupName(this, IDC_GROUPNAME),
+ m_cbxVKLang(this, IDC_COMBO_LANGUAGE),
+ m_cbDelivery(this, IDC_DELIVERY),
+ m_cbUseLocalTime(this, IDC_USE_LOCAL_TIME),
+ m_cbAutoClean(this, IDC_AUTOCLEAN),
+ m_cbMarkMessageOnRead(this, IDC_ONREAD),
+ m_cbMarkMessageOnReceive(this, IDC_ONRECEIVE),
+ m_cbMarkMessageOnReply(this, IDC_ONREPLY),
+ m_cbMarkMessageOnTyping(this, IDC_ONTYPING),
+ m_cbSyncHistoryOff(this, IDC_SYNC_OFF),
+ m_cbSyncHistoryAuto(this, IDC_SYNC_AUTO),
+ m_cbSyncHistoryForLast1Day(this, IDC_SYNC_LAST1DAY),
+ m_cbSyncHistoryForLast3Day(this, IDC_SYNC_LAST3DAY),
+ m_proto(proto)
+
+{
+ CreateLink(m_edtLogin, "Login", _T(""));
+ CreateLink(m_edtGroupName, "ProtoGroup", _T("VKontakte"));
+ CreateLink(m_cbDelivery, m_proto->m_vkOptions.bServerDelivery);
+ CreateLink(m_cbUseLocalTime, m_proto->m_vkOptions.bUseLocalTime);
+ CreateLink(m_cbAutoClean, m_proto->m_vkOptions.bAutoClean);
+
+}
+
+void CVkOptionAccountForm::OnInitDialog()
+{
+ m_ptszOldLogin = m_edtLogin.GetText();
+ m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
+
+ m_ptszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_ptszOldPass);
+ m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
+
+ m_ptszOldGroup = m_edtGroupName.GetText();
+
+ m_cbMarkMessageOnRead.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnRead);
+ m_cbMarkMessageOnReceive.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive);
+ m_cbMarkMessageOnReply.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReply);
+ m_cbMarkMessageOnTyping.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnTyping);
+
+ m_cbSyncHistoryOff.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncOff);
+ m_cbSyncHistoryAuto.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncAuto);
+ m_cbSyncHistoryForLast1Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync1Days);
+ m_cbSyncHistoryForLast3Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync3Days);
+
+ for (size_t i = 0; i < _countof(vkLangCodes); i++) {
+ m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
+ if (!mir_tstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
+ m_cbxVKLang.SetCurSel(i);
+ }
+
+}
+
+void CVkOptionAccountForm::OnApply()
+{
+ if (m_cbSyncHistoryOff.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncOff;
+ if (m_cbSyncHistoryAuto.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncAuto;
+ if (m_cbSyncHistoryForLast1Day.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync1Days;
+ if (m_cbSyncHistoryForLast3Day.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync3Days;
+
+ if (m_cbMarkMessageOnRead.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnRead;
+ if (m_cbMarkMessageOnReceive.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReceive;
+ if (m_cbMarkMessageOnReply.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReply;
+ if (m_cbMarkMessageOnTyping.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnTyping;
+
+ m_proto->m_vkOptions.ptszVKLang = (TCHAR *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
+ if (!IsEmpty(m_proto->m_vkOptions.ptszVKLang))
+ m_proto->setTString("VKLang", m_proto->m_vkOptions.ptszVKLang);
+ else
+ m_proto->delSetting("VKLang");
+
+ ptrT ptszGroupName(m_edtGroupName.GetText());
+ if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
+ m_proto->setGroup(ptszGroupName);
+ m_ptszOldGroup = ptszGroupName;
+ }
+
+ pass_ptrT ptszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ if (bPassChanged) {
+ T2Utf szRawPasswd(ptszNewPass);
+ m_proto->setString("Password", szRawPasswd);
+ pass_ptrA pszPass(szRawPasswd);
+ m_ptszOldPass = ptszNewPass;
+ }
+
+ ptrT ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ m_proto->ClearAccessToken();
+ m_ptszOldLogin = ptszNewLogin;
+
+}
+
+////////////////////// Advanced page /////////////////////////////////////////
+
+CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_ADV, false),
+ m_cbHideChats(this, IDC_HIDECHATS),
+ m_cbSyncReadMessageStatusFromServer(this, IDC_SYNC_MSG_STATUS),
+ m_cbMesAsUnread(this, IDC_MESASUREAD),
+ m_edtInvInterval(this, IDC_ED_INT_INVIS),
+ m_spInvInterval(this, IDC_SPIN_INT_INVIS),
+ m_cbUseNonStandardNotifications(this, IDC_USENOSTDURLENCODE),
+ m_cbUseNonStandardUrlEncode(this, IDC_USENOSTDURLENCODE),
+ m_cbReportAbuse(this, IDC_REPORT_ABUSE),
+ m_cbClearServerHistory(this, IDC_CLEAR_SERVER_HISTORY),
+ m_cbRemoveFromFrendlist(this, IDC_REMOVE_FROM_FRENDLIST),
+ m_cbRemoveFromCList(this, IDC_REMOVE_FROM_CLIST),
+ m_cbMusicSendOff(this, IDC_SEND_MUSIC_NONE),
+ m_cbMusicSendBroadcastAndStatus(this, IDC_SEND_MUSIC_BROADCAST_AND_STATUS),
+ m_cbSendMetodBroadcast(this, IDC_SEND_MUSIC_BROADCAST),
+ m_cbMusicSendStatus(this, IDC_SEND_MUSIC_STATUS),
+ m_edtReturnChatMessage(this, IDC_RET_CHAT_MES),
+ m_proto(proto)
+{
+ CreateLink(m_cbHideChats, m_proto->m_vkOptions.bHideChats);
+ CreateLink(m_cbSyncReadMessageStatusFromServer, m_proto->m_vkOptions.bSyncReadMessageStatusFromServer);
+ CreateLink(m_cbMesAsUnread, m_proto->m_vkOptions.bMesAsUnread);
+ CreateLink(m_edtInvInterval, m_proto->m_vkOptions.iInvisibleInterval);
+
+ CreateLink(m_cbUseNonStandardNotifications, m_proto->m_vkOptions.bUseNonStandardNotifications);
+ CreateLink(m_cbUseNonStandardUrlEncode, m_proto->m_vkOptions.bUseNonStandardUrlEncode);
+ CreateLink(m_cbReportAbuse, m_proto->m_vkOptions.bReportAbuse);
+ CreateLink(m_cbClearServerHistory, m_proto->m_vkOptions.bClearServerHistory);
+ CreateLink(m_cbRemoveFromFrendlist, m_proto->m_vkOptions.bRemoveFromFrendlist);
+ CreateLink(m_cbRemoveFromCList, m_proto->m_vkOptions.bRemoveFromCList);
+
+ CreateLink(m_edtReturnChatMessage, "ReturnChatMessage", TranslateT("I\'m back"));
+}
+
+void CVkOptionAdvancedForm::OnInitDialog()
+{
+
+ m_cbMusicSendOff.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone);
+ m_cbMusicSendBroadcastAndStatus.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus);
+ m_cbSendMetodBroadcast.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly);
+ m_cbMusicSendStatus.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendStatusOnly);
+
+ m_spInvInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60, 0));
+ m_spInvInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iInvisibleInterval);
+}
+
+void CVkOptionAdvancedForm::OnApply()
+{
+ if (m_cbMusicSendOff.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendNone;
+ if (m_cbMusicSendBroadcastAndStatus.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastAndStatus;
+ if (m_cbSendMetodBroadcast.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastOnly;
+ if (m_cbMusicSendStatus.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendStatusOnly;
+
+ m_proto->m_vkOptions.ptszReturnChatMessage = m_edtReturnChatMessage.GetText();
+}
+
+////////////////////// News and notifications ////////////////////////////////
+
+CVkOptionFeedsForm::CVkOptionFeedsForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_FEEDS, false),
+ m_cbNewsEnabled(this, IDC_NEWS_ENBL),
+ m_edtNewsInterval(this, IDC_ED_INT_NEWS),
+ m_spNewsInterval(this, IDC_SPIN_INT_NEWS),
+ m_cbNotificationsEnabled(this, IDC_NOTIF_ENBL),
+ m_edtNotificationsInterval(this, IDC_ED_INT_NOTIF),
+ m_spNotificationsInterval(this, IDC_SPIN_INT_NOTIF),
+ m_cbNotificationsMarkAsViewed(this, IDC_NOTIF_MARK_VIEWED),
+ m_cbSpecialContactAlwaysEnabled(this, IDC_SPEC_CONT_ENBL),
+ m_cbNewsAutoClearHistory(this, IDC_NEWSAUTOCLEAR),
+ m_cbNewsFilterPosts(this, IDC_F_POSTS),
+ m_cbNewsFilterPhotos(this, IDC_F_PHOTOS),
+ m_cbNewsFilterTags(this, IDC_F_TAGS),
+ m_cbNewsFilterWallPhotos(this, IDC_F_WALLPHOTOS),
+ m_cbNewsSourceFriends(this, IDC_S_FRIENDS),
+ m_cbNewsSourceGroups(this, IDC_S_GROUPS),
+ m_cbNewsSourcePages(this, IDC_S_PAGES),
+ m_cbNewsSourceFollowing(this, IDC_S_FOLLOWING),
+ m_cbNewsSourceIncludeBanned(this, IDC_S_BANNED),
+ m_cbNewsSourceNoReposts(this, IDC_S_NOREPOSTES),
+ m_cbNotificationFilterComments(this, IDC_N_COMMENTS),
+ m_cbNotificationFilterLikes(this, IDC_N_LIKES),
+ m_cbNotificationFilterReposts(this, IDC_N_REPOSTS),
+ m_cbNotificationFilterMentions(this, IDC_N_MENTIONS),
+ m_cbNotificationFilterInvites(this, IDC_N_INVITES)
+{
+ CreateLink(m_cbNewsEnabled, m_proto->m_vkOptions.bNewsEnabled);
+ CreateLink(m_edtNewsInterval, m_proto->m_vkOptions.iNewsInterval);
+ CreateLink(m_cbNotificationsEnabled, m_proto->m_vkOptions.bNotificationsEnabled);
+ CreateLink(m_edtNotificationsInterval, m_proto->m_vkOptions.iNotificationsInterval);
+ CreateLink(m_cbNotificationsMarkAsViewed, m_proto->m_vkOptions.bNotificationsMarkAsViewed);
+ CreateLink(m_cbSpecialContactAlwaysEnabled, m_proto->m_vkOptions.bSpecialContactAlwaysEnabled);
+ CreateLink(m_cbNewsAutoClearHistory, m_proto->m_vkOptions.bNewsAutoClearHistory);
+ CreateLink(m_cbNewsFilterPosts, m_proto->m_vkOptions.bNewsFilterPosts);
+ CreateLink(m_cbNewsFilterPhotos, m_proto->m_vkOptions.bNewsFilterPhotos);
+ CreateLink(m_cbNewsFilterTags, m_proto->m_vkOptions.bNewsFilterTags);
+ CreateLink(m_cbNewsFilterWallPhotos, m_proto->m_vkOptions.bNewsFilterWallPhotos);
+ CreateLink(m_cbNewsSourceFriends, m_proto->m_vkOptions.bNewsSourceFriends);
+ CreateLink(m_cbNewsSourceGroups, m_proto->m_vkOptions.bNewsSourceGroups);
+ CreateLink(m_cbNewsSourcePages, m_proto->m_vkOptions.bNewsSourcePages);
+ CreateLink(m_cbNewsSourceFollowing, m_proto->m_vkOptions.bNewsSourceFollowing);
+ CreateLink(m_cbNewsSourceIncludeBanned, m_proto->m_vkOptions.bNewsSourceIncludeBanned);
+ CreateLink(m_cbNewsSourceNoReposts, m_proto->m_vkOptions.bNewsSourceNoReposts);
+ CreateLink(m_cbNotificationFilterComments, m_proto->m_vkOptions.bNotificationFilterComments);
+ CreateLink(m_cbNotificationFilterLikes, m_proto->m_vkOptions.bNotificationFilterLikes);
+ CreateLink(m_cbNotificationFilterReposts, m_proto->m_vkOptions.bNotificationFilterReposts);
+ CreateLink(m_cbNotificationFilterMentions, m_proto->m_vkOptions.bNotificationFilterMentions);
+ CreateLink(m_cbNotificationFilterInvites, m_proto->m_vkOptions.bNotificationFilterInvites);
+
+ m_cbNewsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNewsEnabledChange);
+ m_cbNotificationsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNotificationsEnabledChange);
+
+}
+
+void CVkOptionFeedsForm::OnInitDialog()
+{
+ m_spNewsInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
+ m_spNewsInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iNewsInterval);
+
+ m_spNotificationsInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
+ m_spNotificationsInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iNotificationsInterval);
+
+ On_cbNewsEnabledChange(&m_cbNewsEnabled);
+ On_cbNotificationsEnabledChange(&m_cbNotificationsEnabled);
+}
+
+void CVkOptionFeedsForm::On_cbNewsEnabledChange(CCtrlCheck*)
+{
+ bool bState = m_cbNewsEnabled.GetState() != 0;
+
+ m_edtNewsInterval.Enable(bState);
+ m_spNewsInterval.Enable(bState);
+ m_cbNewsFilterPosts.Enable(bState);
+ m_cbNewsFilterPhotos.Enable(bState);
+ m_cbNewsFilterTags.Enable(bState);
+ m_cbNewsFilterWallPhotos.Enable(bState);
+ m_cbNewsSourceFriends.Enable(bState);
+ m_cbNewsSourceGroups.Enable(bState);
+ m_cbNewsSourcePages.Enable(bState);
+ m_cbNewsSourceFollowing.Enable(bState);
+ m_cbNewsSourceIncludeBanned.Enable(bState);
+ m_cbNewsSourceNoReposts.Enable(bState);
+
+}
+
+void CVkOptionFeedsForm::On_cbNotificationsEnabledChange(CCtrlCheck*)
+{
+ bool bState = m_cbNotificationsEnabled.GetState() != 0;
+
+ m_cbNotificationsMarkAsViewed.Enable(bState);
+ m_edtNotificationsInterval.Enable(bState);
+ m_spNotificationsInterval.Enable(bState);
+ m_cbNotificationFilterComments.Enable(bState);
+ m_cbNotificationFilterLikes.Enable(bState);
+ m_cbNotificationFilterReposts.Enable(bState);
+ m_cbNotificationFilterMentions.Enable(bState);
+ m_cbNotificationFilterInvites.Enable(bState);
+}
+
+////////////////////// View page /////////////////////////////////////////////
+
+CVkOptionViewForm::CVkOptionViewForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_VIEW, false),
+ m_cbIMGBBCSupportOff(this, IDC_IMG_OFF),
+ m_cbIMGBBCSupportFullSize(this, IDC_IMG_FULLSIZE),
+ m_cbIMGBBCSupport130(this, IDC_IMG_130),
+ m_cbIMGBBCSupport604(this, IDC_IMG_604),
+ m_cbBBCForNewsOff(this, IDC_NEWSBBC_OFF),
+ m_cbBBCForNewsBasic(this, IDC_NEWSBBC_BASIC),
+ m_cbBBCForNewsAdvanced(this, IDC_NEWSBBC_ADV),
+ m_cbUseBBCOnAttacmentsAsNews(this, IDC_BBC_ATT_NEWS),
+ m_cbBBCForAttachmentsOff(this, IDC_ATTBBC_OFF),
+ m_cbBBCForAttachmentsBasic(this, IDC_ATTBBC_BASIC),
+ m_cbBBCForAttachmentsAdvanced(this, IDC_ATTBBC_ADV),
+ m_cbStikersAsSmyles(this, IDC_STICKERS_AS_SMYLES),
+ m_cbShortenLinksForAudio(this, IDC_SHOTEN_LINKS_FOR_AUDIO),
+ m_proto(proto)
+{
+ CreateLink(m_cbUseBBCOnAttacmentsAsNews, m_proto->m_vkOptions.bUseBBCOnAttacmentsAsNews);
+ CreateLink(m_cbStikersAsSmyles, m_proto->m_vkOptions.bStikersAsSmyles);
+ CreateLink(m_cbShortenLinksForAudio, m_proto->m_vkOptions.bShortenLinksForAudio);
+}
+
+void CVkOptionViewForm::OnInitDialog()
+{
+ m_cbIMGBBCSupportOff.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgNo);
+ m_cbIMGBBCSupportFullSize.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgFullSize);
+ m_cbIMGBBCSupport130.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgPreview130);
+ m_cbIMGBBCSupport604.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgPreview604);
+
+ m_cbBBCForNewsOff.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcNo);
+ m_cbBBCForNewsBasic.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcBasic);
+ m_cbBBCForNewsAdvanced.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcAdvanced);
+
+ m_cbBBCForAttachmentsOff.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcNo);
+ m_cbBBCForAttachmentsBasic.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcBasic);
+ m_cbBBCForAttachmentsAdvanced.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcAdvanced);
+}
+
+void CVkOptionViewForm::OnApply()
+{
+ if (m_cbIMGBBCSupportOff.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgNo;
+ if (m_cbIMGBBCSupportFullSize.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgFullSize;
+ if (m_cbIMGBBCSupport130.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgPreview130;
+ if (m_cbIMGBBCSupport604.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgPreview604;
+
+ if (m_cbBBCForNewsOff.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcNo;
+ if (m_cbBBCForNewsBasic.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcBasic;
+ if (m_cbBBCForNewsAdvanced.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcAdvanced;
+
+ if (m_cbBBCForAttachmentsOff.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcNo;
+ if (m_cbBBCForAttachmentsBasic.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcBasic;
+ if (m_cbBBCForAttachmentsAdvanced.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcAdvanced;
+}
+
|