From cdf4d005c67b8b5ef62170ccd4fdd29579965d9c Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 10 Jun 2013 15:09:08 +0000 Subject: removed password field, coz we can't change it added checkbutton for using 443 port git-svn-id: http://svn.miranda-ng.org/main/trunk@4910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/dialogs.cpp | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'protocols/WhatsApp/src/dialogs.cpp') diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 6905ca4b87..c1e4807a17 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -13,7 +13,7 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam); SendDlgItemMessage(hwnd, IDC_REG_CODE_1, EM_LIMITTEXT, 3, 0); SendDlgItemMessage(hwnd, IDC_REG_CODE_2, EM_LIMITTEXT, 3, 0); - + CheckDlgButton(hwnd, IDC_SSL, db_get_b(NULL, proto->ModuleName(), WHATSAPP_KEY_SSL, 0)); DBVARIANT dbv; if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_CC,&dbv,DBVT_ASCIIZ)) @@ -34,19 +34,11 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA db_free(&dbv); } - if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,&dbv,DBVT_ASCIIZ)) - { - CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1, - reinterpret_cast(dbv.pszVal)); - SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal); - db_free(&dbv); - } - if (!proto->isOffline()) { SendMessage(GetDlgItem(hwnd,IDC_CC),EM_SETREADONLY,1,0); SendMessage(GetDlgItem(hwnd,IDC_LOGIN),EM_SETREADONLY,1,0); SendMessage(GetDlgItem(hwnd,IDC_NICK),EM_SETREADONLY,1,0); - SendMessage(GetDlgItem(hwnd,IDC_PW),EM_SETREADONLY,1,0); + EnableWindow(GetDlgItem(hwnd, IDC_SSL), FALSE); } return TRUE; @@ -87,7 +79,6 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA string pw = proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code)); if (!pw.empty()) { - SetDlgItemTextA(hwnd, IDC_PW, pw.c_str()); CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(pw.c_str()), (LPARAM)pw.c_str()); db_set_s(NULL, proto->ModuleName(), WHATSAPP_KEY_PASS, pw.c_str()); MessageBox(NULL, TranslateT("Your password has been set automatically.\nIf you change your password manually you may lose it and need to request a new code!"), PRODUCT_NAME, MB_ICONWARNING); @@ -102,30 +93,28 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA case IDC_CC: case IDC_LOGIN: case IDC_NICK: - case IDC_PW: - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + case IDC_SSL: + SendMessage(GetParent(hwnd) ,PSM_CHANGED, 0, 0); } } break; case WM_NOTIFY: - if ( reinterpret_cast(lparam)->code == PSN_APPLY ) + if (reinterpret_cast(lparam)->code == PSN_APPLY) { - proto = reinterpret_cast(GetWindowLongPtr(hwnd,GWLP_USERDATA)); + proto = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); char str[128]; GetDlgItemTextA(hwnd, IDC_CC, str, sizeof(str)); - db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_CC,str); + db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_CC, str); GetDlgItemTextA(hwnd, IDC_LOGIN, str, sizeof(str)); - db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_LOGIN,str); + db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_LOGIN, str); GetDlgItemTextA(hwnd, IDC_NICK, str, sizeof(str)); - db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_NICK,str); + db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_NICK, str); - GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str)); - CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast(str)); - db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,str); + db_set_b(0, proto->ModuleName(), WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwnd, IDC_SSL)); return TRUE; } -- cgit v1.2.3