summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_dialogs.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-06-17 09:20:49 +0000
committerRobert Pösel <robyer@seznam.cz>2013-06-17 09:20:49 +0000
commit5b81eaa46fd18c6b3b0bf4a102b0f863232b6866 (patch)
tree0b10473f0092711b0bae86be0ad69e4d4d93ccae /protocols/Skype/src/skype_dialogs.cpp
parent5338cdcb3caa60be15a0c989fe3c453c521421e6 (diff)
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
Diffstat (limited to 'protocols/Skype/src/skype_dialogs.cpp')
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp39
1 files changed, 32 insertions, 7 deletions
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 &param)
NULL,
CSkypeProto::SkypePasswordChangeProc,
(LPARAM)&param);
- return value == 1;
+ return value == IDOK;
}
INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)