From 5b81eaa46fd18c6b3b0bf4a102b0f863232b6866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 17 Jun 2013 09:20:49 +0000 Subject: Skype: Password change dialog improvements. Fixed options button in Accounts dialog. git-svn-id: http://svn.miranda-ng.org/main/trunk@4996 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_dialogs.cpp | 39 ++++++++++++++++++++++++++++------- protocols/Skype/src/skype_proto.cpp | 3 +++ 2 files changed, 35 insertions(+), 7 deletions(-) (limited to 'protocols/Skype/src') diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 3ce20c4e3e..d26868284b 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -134,6 +134,8 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd)); PasswordChangeBoxParam param; + param.password = ::mir_strdup(pwd); + if (proto->ChangePassword(param)) { proto->account->ChangePassword(param.password, param.password2); @@ -266,6 +268,10 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WP case WM_INITDIALOG: ::TranslateDialogDefault(hwndDlg); + SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0); + SendDlgItemMessage(hwndDlg, IDC_PASSWORD2, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0); + SendDlgItemMessage(hwndDlg, IDC_PASSWORD3, EM_LIMITTEXT, SKYPE_PASSWORD_LIMIT, 0); + param = (PasswordChangeBoxParam *)lParam; ::SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); { @@ -285,16 +291,35 @@ INT_PTR CALLBACK CSkypeProto::SkypePasswordChangeProc(HWND hwndDlg, UINT msg, WP case IDOK: { char oldPwd[SKYPE_PASSWORD_LIMIT]; - ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD, oldPwd, SIZEOF(oldPwd)); - param->password = ::mir_strdup(oldPwd); - char pwd1[SKYPE_PASSWORD_LIMIT]; - ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD2, pwd1, SIZEOF(pwd1)); - param->password2 = ::mir_strdup(pwd1); - char pwd2[SKYPE_PASSWORD_LIMIT]; + + ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD, oldPwd, SIZEOF(oldPwd)); + ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD2, pwd1, SIZEOF(pwd1)); ::GetDlgItemTextA(hwndDlg, IDC_PASSWORD3, pwd2, SIZEOF(pwd2)); + if (!::strlen(oldPwd) || !::strlen(pwd1)) { + ::MessageBox(NULL, TranslateT("Password can't be empty."), TranslateT("Change password"), MB_OK | MB_ICONERROR); + break; + } + + if (::strcmp(param->password, oldPwd)) { + ::MessageBox(NULL, TranslateT("Old password is not correct."), TranslateT("Change password"), MB_OK | MB_ICONERROR); + break; + } + + if (!::strcmp(oldPwd, pwd1)) { + ::MessageBox(NULL, TranslateT("New password is same as old password."), TranslateT("Change password"), MB_OK | MB_ICONERROR); + break; + } + + if (::strcmp(pwd1, pwd2)) { + ::MessageBox(NULL, TranslateT("New password and confirmation must be same."), TranslateT("Change password"), MB_OK | MB_ICONERROR); + break; + } + + param->password2 = ::mir_strdup(pwd1); + ::EndDialog(hwndDlg, IDOK); } break; @@ -318,7 +343,7 @@ bool CSkypeProto::ChangePassword(PasswordChangeBoxParam ¶m) NULL, CSkypeProto::SkypePasswordChangeProc, (LPARAM)¶m); - return value == 1; + return value == IDOK; } INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b74811ddbc..68f55adb90 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -533,6 +533,9 @@ int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM case EV_PROTO_ONEXIT: return this->OnPreShutdown(wParam, lParam); + case EV_PROTO_ONOPTIONS: + return this->OnOptionsInit(wParam,lParam); + case EV_PROTO_ONCONTACTDELETED: return this->OnContactDeleted(wParam, lParam); -- cgit v1.2.3