From d6e05cc3bca53565d9ca65377ab8b0b6190774b3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 Nov 2013 18:01:14 +0000 Subject: preparing to the transparent cyphering: end of MS_DB_CRYPT_ENCODESTRING/MS_DB_CRYPT_DECODESTRING git-svn-id: http://svn.miranda-ng.org/main/trunk@6938 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/connection.cpp | 44 +++++-------- protocols/AimOscar/src/ui.cpp | 114 ++++++++++++++-------------------- 2 files changed, 59 insertions(+), 99 deletions(-) (limited to 'protocols/AimOscar/src') diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index fcff93ef09..d9acb8d542 100644 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -61,22 +61,14 @@ HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port) void CAimProto::aim_connection_authorization(void) { - DBVARIANT dbv; - char *password = NULL; - NETLIBPACKETRECVER packetRecv = {0}; HANDLE hServerPacketRecver = NULL; if (m_iDesiredStatus == ID_STATUS_OFFLINE) goto exit; - if (!getString(AIM_KEY_PW, &dbv)) - { - CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); - password = mir_strdup(dbv.pszVal); - db_free(&dbv); - } - else + char *password = getStringA(AIM_KEY_PW); + if (password == NULL) goto exit; mir_free(username); @@ -87,44 +79,37 @@ void CAimProto::aim_connection_authorization(void) hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 2048 * 4); packetRecv.cbSize = sizeof(packetRecv); packetRecv.dwTimeout = 5000; - for (;;) - { + for (;;) { int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv); - if (recvResult == 0) - { + if (recvResult == 0) { debugLogA("Connection Closed: No Error? during Connection Authorization"); break; } - else if (recvResult < 0) - { + else if (recvResult < 0) { debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError()); break; } - else - { + else { unsigned short flap_length=0; - for (;packetRecv.bytesUsedgetString(AIM_KEY_SN, &dbv)) - { + if (!ppro->getString(AIM_KEY_SN, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal); db_free(&dbv); } - if (!ppro->getString(AIM_KEY_NK, &dbv)) - { + if (!ppro->getString(AIM_KEY_NK, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal); db_free(&dbv); } - else if (!ppro->getString(AIM_KEY_SN, &dbv)) - { + else if (!ppro->getString(AIM_KEY_SN, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal); db_free(&dbv); } - if (!ppro->getString(AIM_KEY_PW, &dbv)) - { - CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); + if (!ppro->getString(AIM_KEY_PW, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal); db_free(&dbv); } - if (!ppro->getString(AIM_KEY_HN, &dbv)) - { + if (!ppro->getString(AIM_KEY_HN, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_HN, dbv.pszVal); db_free(&dbv); } - else - SetDlgItemTextA(hwndDlg, IDC_HN, ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER); + else SetDlgItemTextA(hwndDlg, IDC_HN, ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER); SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE); @@ -892,11 +884,9 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //PW GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str)); if (str[0] != 0) - { - CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str); ppro->setString(AIM_KEY_PW, str); - } - else ppro->delSetting(AIM_KEY_PW); + else + ppro->delSetting(AIM_KEY_PW); //END PW //HN @@ -1166,58 +1156,50 @@ int CAimProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); + CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - CAimProto* ppro = (CAimProto*)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + ppro = (CAimProto*)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + { DBVARIANT dbv; - if (!ppro->getString(AIM_KEY_SN, &dbv)) - { + if (!ppro->getString(AIM_KEY_SN, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal); db_free(&dbv); } - if (!ppro->getString(AIM_KEY_PW, &dbv)) - { - CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal); + if (!ppro->getString(AIM_KEY_PW, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal); db_free(&dbv); } - return TRUE; } + return TRUE; case WM_COMMAND: - if (LOWORD(wParam) == IDC_NEWAIMACCOUNTLINK) - { + if (LOWORD(wParam) == IDC_NEWAIMACCOUNTLINK) { CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.aim.com/redirects/inclient/register.adp"); return TRUE; } - if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) - { - switch(LOWORD(wParam)) - { - case IDC_SN: case IDC_PW: + if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { + switch(LOWORD(wParam)) { + case IDC_SN: + case IDC_PW: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) - { - CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { char str[128]; GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str)); ppro->setString(AIM_KEY_SN, str); + GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str)); - CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str); ppro->setString(AIM_KEY_PW, str); return TRUE; } @@ -1241,8 +1223,7 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1257,6 +1238,7 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemInt(hwndDlg, IDC_IIM, minutes,0); } break; + case WM_CLOSE: EndDialog(hwndDlg, 0); break; @@ -1271,13 +1253,12 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR unsigned short minutes=(unsigned short)GetDlgItemInt(hwndDlg, IDC_IIM,0,0); if (minutes > 59) minutes = 59; + ppro->setDword(AIM_KEY_IIT, hours*60+minutes); - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDOK: //Instant Idle - if (ppro->state==1) - { + if (ppro->state == 1) { ppro->aim_set_idle(ppro->hServerConn,ppro->seqno,hours * 60 * 60 + minutes * 60); ppro->instantidle=1; } @@ -1304,8 +1285,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1323,24 +1303,20 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK: - char room[128]; - GetDlgItemTextA(hwndDlg, IDC_ROOM, room, sizeof(room)); - if (ppro->state == 1 && room[0] != 0) - { - chatnav_param* par = new chatnav_param(room, 4); - ppro->ForkThread(&CAimProto::chatnav_request_thread, par); - } - EndDialog(hwndDlg, IDOK); - break; - - case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - break; + switch (LOWORD(wParam)) { + case IDOK: + char room[128]; + GetDlgItemTextA(hwndDlg, IDC_ROOM, room, sizeof(room)); + if (ppro->state == 1 && room[0] != 0) { + chatnav_param* par = new chatnav_param(room, 4); + ppro->ForkThread(&CAimProto::chatnav_request_thread, par); } + EndDialog(hwndDlg, IDOK); + break; + + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + break; } break; } -- cgit v1.2.3