summaryrefslogtreecommitdiff
path: root/protocols/AimOscar
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-11-19 18:01:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-11-19 18:01:14 +0000
commitd6e05cc3bca53565d9ca65377ab8b0b6190774b3 (patch)
tree76040facd4d0b82162069a19cae8f7f024bf1f65 /protocols/AimOscar
parent2ef414538760079fa2955fca1a2c03d610459fa8 (diff)
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
Diffstat (limited to 'protocols/AimOscar')
-rw-r--r--protocols/AimOscar/src/connection.cpp44
-rw-r--r--protocols/AimOscar/src/ui.cpp114
2 files changed, 59 insertions, 99 deletions
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.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
- {
+ for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed = flap_length) {
if (!packetRecv.buffer)
break;
+
FLAP flap((char*)&packetRecv.buffer[packetRecv.bytesUsed],(unsigned short)(packetRecv.bytesAvailable-packetRecv.bytesUsed));
if (!flap.len())
break;
+
flap_length+=FLAP_SIZE+flap.len();
- if (flap.cmp(0x01))
- {
+ if (flap.cmp(0x01)) {
if (aim_send_connection_packet(hServerConn, seqno,flap.val())==0)//cookie challenge
aim_authkey_request(hServerConn, seqno);//md5 authkey request
}
- else if (flap.cmp(0x02))
- {
+ else if (flap.cmp(0x02)) {
SNAC snac(flap.val(),flap.snaclen());
- if (snac.cmp(0x0017))
- {
+ if (snac.cmp(0x0017)) {
snac_md5_authkey(snac,hServerConn,seqno, username, password);
int authres = snac_authorization_reply(snac);
- switch (authres)
- {
+ switch (authres) {
case 1:
mir_free(password);
Netlib_CloseHandle(hServerPacketRecver);
@@ -141,8 +126,7 @@ void CAimProto::aim_connection_authorization(void)
}
}
}
- else if (flap.cmp(0x04))
- {
+ else if (flap.cmp(0x04)) {
debugLogA("Connection Authorization Thread Ending: Flap 0x04");
goto exit;
}
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index ea80e9be76..acbdfc7557 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -779,8 +779,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
CAimProto* ppro = (CAimProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -788,34 +787,27 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ppro = (CAimProto*)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_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;
}