diff options
Diffstat (limited to 'protocols')
34 files changed, 358 insertions, 626 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;
}
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index abfb0a607b..3b6a57e45e 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -148,12 +148,11 @@ bool FacebookProto::NegotiateConnection() }
ptrA password( getStringA(FACEBOOK_KEY_PASS));
- if (!password || !strlen(password)) {
+ if (!password || !*password) {
NotifyEvent(m_tszUserName,TranslateT("Please enter a password."),NULL,FACEBOOK_EVENT_CLIENT);
return false;
}
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(password) + 1, password);
password = mir_utf8encode(password);
// Refresh last time of feeds update
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 3df11ce99c..fbc388bf26 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -58,16 +58,15 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if (!db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
- reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
db_free(&dbv);
}
- if (!proto->isOffline()) {
+ if (!proto->isOffline())
+ {
SendMessage(GetDlgItem(hwnd,IDC_UN),EM_SETREADONLY,1,0);
- SendMessage(GetDlgItem(hwnd,IDC_PW),EM_SETREADONLY,1,0); }
-
+ SendMessage(GetDlgItem(hwnd,IDC_PW),EM_SETREADONLY,1,0);
+ }
return TRUE;
case WM_COMMAND:
@@ -97,9 +96,7 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,str);
-
return TRUE;
}
break;
@@ -356,7 +353,6 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if (!db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
db_free(&dbv);
}
@@ -409,7 +405,6 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
proto->setString(FACEBOOK_KEY_PASS, str);
GetDlgItemText(hwnd,IDC_GROUP,tstr,sizeof(tstr));
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f8e44b03f8..074c2128ba 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -284,45 +284,37 @@ void __cdecl GGPROTO::mainthread(void *) // Setup proxy
nlus.cbSize = sizeof(nlus);
- if (CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hNetlibUser, (LPARAM)&nlus))
- {
+ if (CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hNetlibUser, (LPARAM)&nlus)) {
if (nlus.useProxy)
debugLogA("mainthread() (%x): Using proxy %s:%d.", this, nlus.szProxyServer, nlus.wProxyPort);
gg_proxy_enabled = nlus.useProxy;
gg_proxy_host = nlus.szProxyServer;
gg_proxy_port = nlus.wProxyPort;
- if (nlus.useProxyAuth)
- {
+ if (nlus.useProxyAuth) {
gg_proxy_username = nlus.szProxyAuthUser;
gg_proxy_password = nlus.szProxyAuthPassword;
}
else gg_proxy_username = gg_proxy_password = NULL;
}
- else
- {
+ else {
debugLogA("mainthread() (%x): Failed loading proxy settings.", this);
gg_proxy_enabled = 0;
}
// Check out manual host setting
- if (getByte(GG_KEY_MANUALHOST, GG_KEYDEF_MANUALHOST))
- {
- if (!getString(GG_KEY_SERVERHOSTS, &dbv))
- {
+ if (getByte(GG_KEY_MANUALHOST, GG_KEYDEF_MANUALHOST)) {
+ if (!getString(GG_KEY_SERVERHOSTS, &dbv)) {
hostcount = gg_decodehosts(dbv.pszVal, hosts, 64);
db_free(&dbv);
}
}
// Readup password
- if (!getString(GG_KEY_PASSWORD, &dbv))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
+ if (!getString(GG_KEY_PASSWORD, &dbv)) {
p.password = mir_strdup(dbv.pszVal);
db_free(&dbv);
}
- else
- {
+ else {
debugLogA("mainthread() (%x): No password specified. Exiting.", this);
broadcastnewstatus(ID_STATUS_OFFLINE);
#ifdef DEBUGMODE
@@ -332,8 +324,7 @@ void __cdecl GGPROTO::mainthread(void *) }
// Readup number
- if (!(p.uin = getDword(GG_KEY_UIN, 0)))
- {
+ if (!(p.uin = getDword(GG_KEY_UIN, 0))) {
debugLogA("mainthread() (%x): No Gadu-Gadu number specified. Exiting.", this);
broadcastnewstatus(ID_STATUS_OFFLINE);
mir_free(p.password);
@@ -352,8 +343,7 @@ void __cdecl GGPROTO::mainthread(void *) ////////////////////////////// DCC STARTUP /////////////////////////////
// Uin is ok so startup dcc if not started already
- if (!dcc)
- {
+ if (!dcc) {
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
dccstart();
@@ -364,13 +354,11 @@ void __cdecl GGPROTO::mainthread(void *) while (WaitForSingleObjectEx(hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(hEvent); hEvent = NULL;
}
+
// Check if dcc is running and setup forwarding port
- if (dcc && getByte(GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING))
- {
- if (!getString(GG_KEY_FORWARDHOST, &dbv))
- {
- if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal)))
- {
+ if (dcc && getByte(GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING)) {
+ if (!getString(GG_KEY_FORWARDHOST, &dbv)) {
+ if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal))) {
TCHAR error[128];
TCHAR* forwardHostT = mir_a2t(dbv.pszVal);
mir_sntprintf(error, SIZEOF(error), TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index eb47f96fab..2e9093015c 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -252,7 +252,6 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow(GetDlgItem(hwndDlg, IDC_LOSTPASS), SW_HIDE);
}
if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -414,7 +413,6 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, // Update password
if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -462,7 +460,6 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str));
uin = atoi(str);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
gg->checknewuser(uin, str);
gg->setDword(GG_KEY_UIN, uin);
gg->setString(GG_KEY_PASSWORD, str);
@@ -957,7 +954,6 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (num = gg->getDword(GG_KEY_UIN, 0))
SetDlgItemTextA(hwndDlg, IDC_UIN, ditoa(num));
if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -1000,7 +996,6 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Update password
if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -1030,7 +1025,6 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str));
uin = atoi(str);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
gg->checknewuser(uin, str);
gg->setDword(GG_KEY_UIN, uin);
gg->setString(GG_KEY_PASSWORD, str);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 7c28acd9df..12233c226c 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -253,10 +253,6 @@ void GGPROTO::parsecontacts(char *contacts) INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam)
{
- char *password;
- uin_t uin;
- DBVARIANT dbv;
-
// Check if connected
if (!isonline())
{
@@ -268,14 +264,11 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam) }
// Readup password
- if (!getString(GG_KEY_PASSWORD, &dbv))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- password = _strdup(dbv.pszVal);
- db_free(&dbv);
- }
- else return 0;
+ char *password = getStringA(GG_KEY_PASSWORD);
+ if (password == NULL)
+ return 0;
+ uin_t uin;
if (!(uin = getDword(GG_KEY_UIN, 0)))
return 0;
@@ -300,13 +293,8 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam) INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam)
{
- char *password;
- uin_t uin;
- DBVARIANT dbv;
-
// Check if connected
- if (!isonline())
- {
+ if (!isonline()) {
MessageBox(NULL,
TranslateT("You have to be connected before you can import/export contacts from/to server."),
m_tszUserName, MB_OK | MB_ICONSTOP
@@ -315,14 +303,11 @@ INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam) }
// Readup password
- if (!getString(GG_KEY_PASSWORD, &dbv))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- password = _strdup(dbv.pszVal);
- db_free(&dbv);
- }
- else return 0;
+ char *password = getStringA(GG_KEY_PASSWORD);
+ if (password == NULL)
+ return 0;
+ uin_t uin;
if (!(uin = getDword(GG_KEY_UIN, 0)))
return 0;
@@ -491,14 +476,10 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam) }
// Readup password
- DBVARIANT dbv;
- if (getString(GG_KEY_PASSWORD, &dbv))
+ char *password = getStringA(GG_KEY_PASSWORD);
+ if (password == NULL)
return 0;
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- char *password = _strdup(dbv.pszVal);
- db_free(&dbv);
-
uin_t uin = getDword(GG_KEY_UIN, 0);
if (!uin)
return 0;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index db2a8220f9..4b6f07e295 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -295,28 +295,18 @@ char* GGPROTO::oauth_header(const char *httpmethod, const char *url) UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
ptrA token( getStringA(GG_KEY_TOKEN));
ptrA password( getStringA(GG_KEY_PASSWORD));
- if (password != NULL)
- CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(password) + 1, (LPARAM)password);
ptrA token_secret( getStringA(GG_KEY_TOKENSECRET));
- if (token_secret != NULL)
- CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(token_secret) + 1, (LPARAM)token_secret);
-
return oauth_auth_header(httpmethod, url, HMACSHA1, uin, password, token, token_secret);
}
int GGPROTO::oauth_receivetoken()
{
- char szUrl[256], uin[32], *password = NULL, *str, *token = NULL, *token_secret = NULL;
- DBVARIANT dbv;
+ char szUrl[256], uin[32], *str, *token = NULL, *token_secret = NULL;
int res = 0;
HANDLE nlc = NULL;
UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
- if (!getString(GG_KEY_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
- password = mir_strdup(dbv.pszVal);
- db_free(&dbv);
- }
+ char *password = getStringA(GG_KEY_PASSWORD);
// 1. Obtaining an Unauthorized Request Token
debugLogA("oauth_receivetoken(): Obtaining an Unauthorized Request Token...");
@@ -435,7 +425,6 @@ int GGPROTO::oauth_receivetoken() if (token != NULL && token_secret != NULL) {
setString(GG_KEY_TOKEN, token);
- CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)(int)strlen(token_secret) + 1, (LPARAM) token_secret);
setString(GG_KEY_TOKENSECRET, token_secret);
debugLogA("oauth_receivetoken(): Access Token obtained successfully.");
res = 1;
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index b33dcd33bc..d7b4643de8 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -38,8 +38,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) // Load token
if (!gg->gettoken(&token)) return NULL;
- if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin)
- {
+ if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
TCHAR error[128];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h ? h->error : 0) :
@@ -47,10 +46,8 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLogA("gg_doregister(): Cannot register. errno=%d: %s", errno, strerror(errno));
}
- else
- {
+ else {
gg->setDword(GG_KEY_UIN, s->uin);
- CallService(MS_DB_CRYPT_ENCODESTRING, strlen(newPass) + 1, (LPARAM) newPass);
gg->checknewuser(s->uin, newPass);
gg->setString(GG_KEY_PASSWORD, newPass);
gg->setString(GG_KEY_EMAIL, newEmail);
@@ -149,7 +146,6 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) else
{
gg_pubdir_free(h);
- CallService(MS_DB_CRYPT_ENCODESTRING, strlen(newPass) + 1, (LPARAM) newPass);
gg->setString(GG_KEY_PASSWORD, newPass);
gg->debugLogA("gg_dochpass(): Password change succesful.");
MessageBox(NULL, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index ea5e4e116c..31a2a2be9a 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -719,7 +719,6 @@ void CConnectPrefsDlg::OnApply() m_port.GetTextA( m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
m_port2.GetTextA( m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
m_pass.GetTextA( m_proto->m_password, SIZEOF(m_proto->m_password));
- CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(m_proto->m_password), (LPARAM)m_proto->m_password);
}
else m_proto->m_serverName[0] = m_proto->m_portStart[0] = m_proto->m_portEnd[0] = m_proto->m_password[0] = 0;
@@ -812,8 +811,6 @@ void CConnectPrefsDlg::OnApply() } } }
m_proto->WriteSettings( ConnectSettings, SIZEOF( ConnectSettings ));
-
- CallService(MS_DB_CRYPT_DECODESTRING, SIZEOF(m_proto->m_password), (LPARAM)m_proto->m_password);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1713,8 +1710,6 @@ void CIrcProto::InitPrefs(void) ReadSettings(OtherSettings, SIZEOF( OtherSettings ));
ReadSettings(IgnoreSettings, SIZEOF( IgnoreSettings ));
- CallService(MS_DB_CRYPT_DECODESTRING, 499, (LPARAM)m_password);
-
int x = getDword( "SizeOfListBottom", -1 );
if ( x != -1 ) {
db_unset( NULL, m_szModuleName, "SizeOfListBottom" );
@@ -1816,7 +1811,6 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto> m_port.GetTextA( m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
m_port2.GetTextA( m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
m_pass.GetTextA( m_proto->m_password, SIZEOF(m_proto->m_password));
- CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(m_proto->m_password), (LPARAM)m_proto->m_password);
m_nick.GetText( m_proto->m_nick, SIZEOF(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
@@ -1827,7 +1821,6 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto> removeSpaces(m_proto->m_userID);
m_name.GetText( m_proto->m_name, SIZEOF(m_proto->m_name));
m_proto->WriteSettings( ConnectSettings, SIZEOF( ConnectSettings ));
- CallService(MS_DB_CRYPT_DECODESTRING, SIZEOF(m_proto->m_password), (LPARAM)m_proto->m_password);
}
void OnChangeCombo( CCtrlCombo* )
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index d4dc453e07..f67e3345fd 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -644,9 +644,7 @@ void CQuickDlg::OnOk( CCtrlButton* ) m_proto->setString("ServerName",m_proto->m_serverName);
m_proto->setString("PortStart",m_proto->m_portStart);
m_proto->setString("PortEnd",m_proto->m_portEnd);
- CallService(MS_DB_CRYPT_ENCODESTRING, 499, (LPARAM)m_proto->m_password);
m_proto->setString("Password",m_proto->m_password);
- CallService(MS_DB_CRYPT_DECODESTRING, 499, (LPARAM)m_proto->m_password);
m_proto->setString("Network",m_proto->m_network);
m_proto->setByte("UseSSL",m_proto->m_iSSL);
}
diff --git a/protocols/IcqOscarJ/src/changeinfo/upload.cpp b/protocols/IcqOscarJ/src/changeinfo/upload.cpp index 8e562b80f0..b619f099e2 100644 --- a/protocols/IcqOscarJ/src/changeinfo/upload.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/upload.cpp @@ -36,7 +36,8 @@ int CIcqProto::StringToListItemId(const char *szSetting,int def) if (!strcmpnull(szSetting,setting[i].szDbSetting))
break;
- if (i==settingCount) return def;
+ if (i == settingCount)
+ return def;
FieldNamesItem *list = (FieldNamesItem*)setting[i].pList;
@@ -57,8 +58,7 @@ int CIcqProto::StringToListItemId(const char *szSetting,int def) int ChangeInfoData::UploadSettings(void)
{
- if (!ppro->icqOnline())
- {
+ if (!ppro->icqOnline()) {
MessageBox(hwndDlg, TranslateT("You are not currently connected to the ICQ network. You must be online in order to update your information on the server."), TranslateT("Change ICQ Details"), MB_OK);
return 0;
}
@@ -67,10 +67,8 @@ int ChangeInfoData::UploadSettings(void) //password
char* tmp = ppro->GetUserPassword(TRUE);
- if (tmp)
- {
- if (strlennull(Password) > 0 && strcmpnull(Password, tmp))
- {
+ if (tmp) {
+ if (strlennull(Password) > 0 && strcmpnull(Password, tmp)) {
// update password in user info dialog (still open)
strcpy(Password, tmp);
// update password in protocol
@@ -79,16 +77,9 @@ int ChangeInfoData::UploadSettings(void) hUpload[1] = (HANDLE)ppro->icq_changeUserPasswordServ(tmp);
char szPwd[PASSWORDMAXLEN] = {0};
+ // password is stored in DB, update
if (ppro->GetUserStoredPassword(szPwd, sizeof(szPwd)))
- { // password is stored in DB, update
- char ptmp[PASSWORDMAXLEN];
-
- strcpy(ptmp, tmp);
-
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ptmp), (LPARAM)ptmp);
-
- ppro->setString("Password", ptmp);
- }
+ ppro->setString("Password", tmp);
}
}
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 9a5d6bbe11..47dd485da1 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -29,13 +29,11 @@ // -----------------------------------------------------------------------------
#include "icqoscar.h"
-
static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg)
{
char pszUIN[20];
DWORD dwUIN = ppro->getContactUin(NULL);
- if (dwUIN)
- {
+ if (dwUIN) {
mir_snprintf(pszUIN, 20, "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
@@ -45,7 +43,6 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) SetDlgItemTextA(hwndDlg, IDC_PW, pszPwd);
}
-
INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CIcqProto* ppro = (CIcqProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
@@ -75,48 +72,42 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_REGISTER:
CallService(MS_UTILS_OPENURL, 1, (LPARAM)URL_REGISTER);
break;
- case IDC_UIN:
- case IDC_PW:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_UIN:
+ case IDC_PW:
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
- }
- break;
+ }
+ break;
case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code)
- {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str));
- ppro->setDword(UNIQUEIDSETTING, atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(ppro->m_szPassword));
- strcpy(ppro->m_szPassword, str);
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ppro->m_szPassword), (LPARAM) str);
- ppro->setString("Password", str);
- }
- break;
-
- case PSN_RESET:
- accountLoadDetails(ppro, hwndDlg);
- break;
- }
+ char str[128];
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str));
+ ppro->setDword(UNIQUEIDSETTING, atoi(str));
+
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(ppro->m_szPassword));
+ strcpy(ppro->m_szPassword, str);
+ ppro->setString("Password", str);
+ break;
+
+ case PSN_RESET:
+ accountLoadDetails(ppro, hwndDlg);
+ break;
+ }
break;
}
return FALSE;
}
-
INT_PTR CIcqProto::OnCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index f8c3e3c2a9..ded5f25990 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -78,12 +78,10 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
+ // bit of a security hole here, since it's easy to extract a password from an edit box
char pszPwd[PASSWORDMAXLEN];
if (ppro->GetUserStoredPassword(pszPwd, sizeof(pszPwd)))
- {
- //bit of a security hole here, since it's easy to extract a password from an edit box
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, pszPwd);
- }
LoadDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection", DEFAULT_SECURE_CONNECTION);
LoadDBCheckState(ppro, hwndDlg, IDC_MD5LOGIN, "SecureLogin", DEFAULT_SECURE_LOGIN);
@@ -106,86 +104,73 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
case WM_HSCROLL:
- {
- SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL,TBM_GETPOS, 0, 0)]));
- OptDlgChanged(hwndDlg);
- }
+ SetDlgItemText(hwndDlg, IDC_LEVELDESCR, TranslateTS(szLogLevelDescr[4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL,TBM_GETPOS, 0, 0)]));
+ OptDlgChanged(hwndDlg);
break;
case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_LOOKUPLINK:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)URL_FORGOT_PASSWORD);
- return TRUE;
-
- case IDC_NEWUINLINK:
- CallService(MS_UTILS_OPENURL, 1, (LPARAM)URL_REGISTER);
- return TRUE;
-
- case IDC_RESETSERVER:
- SetDlgItemInt(hwndDlg, IDC_ICQPORT, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT, FALSE);
+ switch (LOWORD(wParam)) {
+ case IDC_LOOKUPLINK:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)URL_FORGOT_PASSWORD);
+ return TRUE;
- case IDC_SSL:
- SetDlgItemTextA(hwndDlg, IDC_ICQSERVER, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_HOST_SSL : DEFAULT_SERVER_HOST);
- SetDlgItemInt(hwndDlg, IDC_ICQPORT, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT, FALSE);
- OptDlgChanged(hwndDlg);
- return TRUE;
- }
+ case IDC_NEWUINLINK:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)URL_REGISTER);
+ return TRUE;
- if (ppro->icqOnline() && LOWORD(wParam) != IDC_NOERRMULTI)
- {
- char szClass[80];
- GetClassNameA((HWND)lParam, szClass, sizeof(szClass));
+ case IDC_RESETSERVER:
+ SetDlgItemInt(hwndDlg, IDC_ICQPORT, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT, FALSE);
- if (stricmpnull(szClass, "EDIT") || HIWORD(wParam) == EN_CHANGE)
- ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW);
- }
+ case IDC_SSL:
+ SetDlgItemTextA(hwndDlg, IDC_ICQSERVER, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_HOST_SSL : DEFAULT_SERVER_HOST);
+ SetDlgItemInt(hwndDlg, IDC_ICQPORT, IsDlgButtonChecked(hwndDlg, IDC_SSL) ? DEFAULT_SERVER_PORT_SSL : DEFAULT_SERVER_PORT, FALSE);
+ OptDlgChanged(hwndDlg);
+ return TRUE;
+ }
- if ((LOWORD(wParam)==IDC_ICQNUM || LOWORD(wParam)==IDC_PASSWORD || LOWORD(wParam)==IDC_ICQSERVER || LOWORD(wParam)==IDC_ICQPORT) &&
- (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()))
- {
- return 0;
- }
+ if (ppro->icqOnline() && LOWORD(wParam) != IDC_NOERRMULTI) {
+ char szClass[80];
+ GetClassNameA((HWND)lParam, szClass, sizeof(szClass));
- OptDlgChanged(hwndDlg);
- break;
+ if (stricmpnull(szClass, "EDIT") || HIWORD(wParam) == EN_CHANGE)
+ ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW);
}
- case WM_NOTIFY:
+ if ((LOWORD(wParam)==IDC_ICQNUM || LOWORD(wParam)==IDC_PASSWORD || LOWORD(wParam)==IDC_ICQSERVER || LOWORD(wParam)==IDC_ICQPORT) &&
+ (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()))
{
- switch (((LPNMHDR)lParam)->code)
- {
+ return 0;
+ }
- case PSN_APPLY:
- {
- char str[128];
+ OptDlgChanged(hwndDlg);
+ break;
- ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(ppro->m_szPassword));
- if (strlennull(str))
- {
- strcpy(ppro->m_szPassword, str);
- ppro->m_bRememberPwd = TRUE;
- }
- else
- ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0);
-
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(ppro->m_szPassword), (LPARAM)str);
- ppro->setString("Password", str);
- GetDlgItemTextA(hwndDlg,IDC_ICQSERVER, str, sizeof(str));
- ppro->setString("OscarServer", str);
- ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
- StoreDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive");
- StoreDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection");
- StoreDBCheckState(ppro, hwndDlg, IDC_MD5LOGIN, "SecureLogin");
- StoreDBCheckState(ppro, hwndDlg, IDC_LEGACY, "LegacyFix");
- StoreDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox");
- ppro->setByte("ShowLogLevel", (BYTE)(4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)));
-
- return TRUE;
- }
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ char str[128];
+
+ ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(ppro->m_szPassword));
+ if (strlennull(str)) {
+ strcpy(ppro->m_szPassword, str);
+ ppro->m_bRememberPwd = TRUE;
}
+ else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0);
+ ppro->setString("Password", str);
+
+ GetDlgItemTextA(hwndDlg,IDC_ICQSERVER, str, sizeof(str));
+ ppro->setString("OscarServer", str);
+
+ ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
+
+ StoreDBCheckState(ppro, hwndDlg, IDC_KEEPALIVE, "KeepAlive");
+ StoreDBCheckState(ppro, hwndDlg, IDC_SSL, "SecureConnection");
+ StoreDBCheckState(ppro, hwndDlg, IDC_MD5LOGIN, "SecureLogin");
+ StoreDBCheckState(ppro, hwndDlg, IDC_LEGACY, "LegacyFix");
+ StoreDBCheckState(ppro, hwndDlg, IDC_NOERRMULTI, "IgnoreMultiErrorBox");
+ ppro->setByte("ShowLogLevel", (BYTE)(4-SendDlgItemMessage(hwndDlg, IDC_LOGLEVEL, TBM_GETPOS, 0, 0)));
+ return TRUE;
}
break;
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 1e073e55b0..de9d020fd6 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1791,12 +1791,9 @@ char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsiz char* CIcqProto::GetUserStoredPassword(char *szBuffer, int cbSize)
{
if (!getSettingStringStatic(NULL, "Password", szBuffer, cbSize))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlennull(szBuffer) + 1, (LPARAM)szBuffer);
-
if (strlennull(szBuffer))
return szBuffer;
- }
+
return NULL;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 44561e2faa..4d0a5631ba 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -159,7 +159,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) : ptrA szPassword( getStringA("Password"));
if (szPassword != NULL) {
- CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(szPassword) + 1, szPassword);
JSetStringCrypt(NULL, "LoginPassword", _A2T(szPassword));
delSetting("Password");
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index dd860176c6..e69972e28a 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -135,7 +135,6 @@ int CMsnProto::MSN_GetPassportAuth(void) char szPassword[100];
getStaticString(NULL, "Password", szPassword, sizeof(szPassword));
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(szPassword)+1, (LPARAM)szPassword);
szPassword[16] = 0;
char* szEncPassword = HtmlEncode(szPassword);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 240768ee53..6f809e39d1 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -80,21 +80,17 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TranslateDialogDefault(hwndDlg);
-
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
CMsnProto* proto = (CMsnProto*)lParam;
SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer);
+ if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) {
tBuffer[16] = 0;
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer);
}
@@ -102,8 +98,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND wnd = GetDlgItem(hwndDlg, IDC_HANDLE2);
DBVARIANT dbv;
- if (!proto->getTString("Nick", &dbv))
- {
+ if (!proto->getTString("Nick", &dbv)) {
SetWindowText(wnd, dbv.ptszVal);
db_free(&dbv);
}
@@ -123,35 +118,30 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!proto->getStaticString(NULL, "MailerPath", tBuffer, sizeof(tBuffer)))
SetDlgItemTextA(hwndDlg, IDC_MAILER_APP, tBuffer);
- if (!proto->msnLoggedIn)
- {
+ if (!proto->msnLoggedIn) {
EnableWindow(GetDlgItem(hwndDlg, IDC_MANAGEGROUPS), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS), FALSE);
}
else CheckDlgButton(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS, proto->msnOtherContactsBlocked);
- return TRUE;
}
+ return TRUE;
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
- {
+ if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) {
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com");
return TRUE;
}
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- {
- switch(LOWORD(wParam))
- {
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
+ switch(LOWORD(wParam)) {
case IDC_HANDLE: case IDC_PASSWORD: case IDC_HANDLE2:
case IDC_GATEWAYSERVER: case IDC_YOURHOST: case IDC_DIRECTSERVER:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- if (HIWORD(wParam) == BN_CLICKED)
- switch(LOWORD(wParam))
- {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch(LOWORD(wParam)) {
case IDC_SENDFONTINFO:
case IDC_DISABLE_ANOTHER_CONTACTS:
case IDC_MOBILESEND:
@@ -159,8 +149,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case IDC_MANAGEGROUPS:
- if (IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS))
- {
+ if (IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS)) {
if (IDYES == MessageBox(hwndDlg,
TranslateT("Server groups import may change your contact list layout after next login. Do you want to upload your groups to the server?"),
TranslateT("MSN Protocol"), MB_YESNOCANCEL))
@@ -178,8 +167,8 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_MAILER_APP), tIsChosen);
EnableWindow(GetDlgItem(hwndDlg, IDC_ENTER_MAILER_APP), tIsChosen);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
+ break;
case IDC_ENTER_MAILER_APP:
{
@@ -190,11 +179,9 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP size_t tSelectLen = 0;
- if (szFile[0] == '\"')
- {
+ if (szFile[0] == '\"') {
char* p = strchr(szFile+1, '\"');
- if (p != NULL)
- {
+ if (p != NULL) {
*p = '\0';
memmove(szFile, szFile+1, strlen(szFile));
tSelectLen += 2;
@@ -218,8 +205,7 @@ LBL_Continue: if (GetOpenFileNameA(&ofn) != TRUE)
break;
- if (strchr(szFile, ' ') != NULL)
- {
+ if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
mir_snprintf(tmpBuf, sizeof(tmpBuf), "\"%s\"", szFile);
strcpy(szFile, tmpBuf);
@@ -229,13 +215,12 @@ LBL_Continue: SendMessageA(tEditField, EM_REPLACESEL, TRUE, LPARAM(szFile));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
+ }
}
-
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
bool reconnectRequired = false;
TCHAR screenStr[MAX_PATH];
char password[100], szEmail[MSN_MAX_EMAIL_LEN];
@@ -244,52 +229,41 @@ LBL_Continue: CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail));
- if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail))
- {
+ if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
}
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password);
- if (!proto->getString("Password", &dbv))
- {
- if (strcmp(password, dbv.pszVal))
- {
+ if (!proto->getString("Password", &dbv)) {
+ if (strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
proto->setString("Password", password);
}
db_free(&dbv);
}
- else
- {
+ else {
reconnectRequired = true;
proto->setString("Password", password);
}
GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
- if (!proto->getTString("Nick", &dbv))
- {
+ if (!proto->getTString("Nick", &dbv)) {
if (_tcscmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
db_free(&dbv);
}
- else
- {
- proto->MSN_SendNickname(screenStr);
- }
+ else proto->MSN_SendNickname(screenStr);
BYTE mblsnd = IsDlgButtonChecked(hwndDlg, IDC_MOBILESEND) == BST_CHECKED;
- if (mblsnd != proto->getByte("MobileAllowed", 0))
- {
+ if (mblsnd != proto->getByte("MobileAllowed", 0)) {
proto->msnNsThread->sendPacket("PRP", "MOB %c", mblsnd ? 'Y' : 'N');
proto->MSN_SetServerStatus(proto->m_iStatus);
}
unsigned tValue = IsDlgButtonChecked(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS);
- if (tValue != proto->msnOtherContactsBlocked && proto->msnLoggedIn)
- {
+ if (tValue != proto->msnOtherContactsBlocked && proto->msnLoggedIn) {
proto->msnOtherContactsBlocked = tValue;
proto->msnNsThread->sendPacket("BLP", tValue ? "BL" : "AL");
proto->MSN_ABUpdateAttr(NULL, "MSN.IM.BLP", tValue ? "0" : "1");
@@ -304,8 +278,9 @@ LBL_Continue: proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
- MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
- TranslateT("MSN Options"), MB_OK);
+ MessageBox(hwndDlg,
+ TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
+ TranslateT("MSN Options"), MB_OK);
proto->LoadOptions();
return TRUE;
@@ -330,15 +305,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
CMsnProto* proto = (CMsnProto*)lParam;
- if (!proto->getString("DirectServer", &dbv))
- {
+ if (!proto->getString("DirectServer", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, dbv.pszVal);
db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
- if (!proto->getString("GatewayServer", &dbv))
- {
+ if (!proto->getString("GatewayServer", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, dbv.pszVal);
db_free(&dbv);
}
@@ -367,13 +340,11 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam else
SetDlgItemText(hwndDlg, IDC_YOURHOST, TranslateT("IP info available only after login"));
EnableWindow(GetDlgItem(hwndDlg, IDC_YOURHOST), gethst == 1);
-
- return TRUE;
}
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_RESETSERVER:
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, MSN_DEFAULT_GATEWAY);
@@ -389,15 +360,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_HOSTOPT)
- {
+ if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_HOSTOPT) {
unsigned gethst = SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_YOURHOST), gethst == 1);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- if (HIWORD(wParam) == BN_CLICKED)
- {
+ if (HIWORD(wParam) == BN_CLICKED) {
switch(LOWORD(wParam)) {
case IDC_SLOWSEND:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -407,8 +376,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
bool reconnectRequired = false;
char str[MAX_PATH];
@@ -427,8 +395,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->delSetting("GatewayServer");
proto->setByte("SlowSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SLOWSEND ));
- if (proto->getByte("SlowSend", FALSE))
- {
+ if (proto->getByte("SlowSend", FALSE)) {
if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
db_get_dw(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
{
@@ -442,8 +409,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (gethst < 2) gethst = !gethst;
proto->setByte("AutoGetHost", (BYTE)gethst);
- if (gethst == 0)
- {
+ if (gethst == 0) {
GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, sizeof(str));
proto->setString("YourHost", str);
}
@@ -550,65 +516,55 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer);
+ if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) {
tBuffer[16] = 0;
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer);
}
SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETLIMITTEXT, 16, 0);
DBVARIANT dbv;
- if (!proto->getTString("Place", &dbv))
- {
+ if (!proto->getTString("Place", &dbv)) {
SetDlgItemText(hwndDlg, IDC_PLACE, dbv.ptszVal);
db_free(&dbv);
}
- return TRUE;
}
+ return TRUE;
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
- {
+ if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK) {
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com");
return TRUE;
}
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- {
- switch(LOWORD(wParam))
- {
- case IDC_HANDLE: case IDC_PASSWORD:
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
+ switch(LOWORD(wParam)) {
+ case IDC_HANDLE:
+ case IDC_PASSWORD:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
- {
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
char password[100], szEmail[MSN_MAX_EMAIL_LEN];
DBVARIANT dbv;
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail));
- if (strcmp(szEmail, proto->MyOptions.szEmail))
- {
+ if (strcmp(szEmail, proto->MyOptions.szEmail)) {
strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
}
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password);
- if (!proto->getString("Password", &dbv))
- {
+ if (!proto->getString("Password", &dbv)) {
if (strcmp(password, dbv.pszVal))
proto->setString("Password", password);
db_free(&dbv);
}
- else
- proto->setString("Password", password);
+ else proto->setString("Password", password);
TCHAR szPlace[64];
GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, SIZEOF(szPlace));
@@ -627,8 +583,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
@@ -639,20 +594,16 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDOK)
- {
+ if (LOWORD(wParam) == IDOK) {
int isBlock = IsDlgButtonChecked(hwndDlg, IDC_REMOVEBLOCK);
int isHot = IsDlgButtonChecked(hwndDlg, IDC_REMOVEHOT);
DeleteParam *param = (DeleteParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char szEmail[MSN_MAX_EMAIL_LEN];
- if (!param->proto->getStaticString(param->hContact, "e-mail", szEmail, sizeof(szEmail)))
- {
+ if (!param->proto->getStaticString(param->hContact, "e-mail", szEmail, sizeof(szEmail))) {
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_FL | (isHot ? LIST_REMOVE : LIST_REMOVENH));
-
- if (isBlock)
- {
+ if (isBlock) {
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_AL | LIST_REMOVE);
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_BL);
}
@@ -664,6 +615,7 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return FALSE;
}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Initialize options pages
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index ceb0748dcb..7111f2b637 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -95,8 +95,6 @@ bool CSkypeProto::PreparePassword() this->rememberPassword = param.rememberPassword;
}
}
- else
- ::CallService(MS_DB_CRYPT_DECODESTRING, ::strlen(this->password), (LPARAM)this->password);
}
return true;
@@ -221,10 +219,6 @@ void CSkypeProto::OnLoggedIn() ::mir_free(this->password);
this->password = NULL;
}
- else
- {
- ::CallService(MS_DB_CRYPT_ENCODESTRING, ::strlen(this->password), (LPARAM)this->password);
- }
this->SetServerStatus(this->m_iDesiredStatus);
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 3a830b2471..9eeb4bd25c 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -18,9 +18,6 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR }
{
ptrA pwd( ::db_get_sa(NULL, proto->m_szModuleName, SKYPE_SETTINGS_PASSWORD));
- if (pwd)
- ::CallService(MS_DB_CRYPT_DECODESTRING, ::strlen(pwd), pwd);
-
SetDlgItemTextA(hwnd, IDC_PW, pwd);
}
{
@@ -157,7 +154,6 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR char pwd[128];
GetDlgItemTextA(hwnd, IDC_PW, pwd, SIZEOF(pwd));
- ::CallService(MS_DB_CRYPT_ENCODESTRING, ::strlen(pwd), (LPARAM)&pwd);
::db_set_s(NULL, proto->m_szModuleName, SKYPE_SETTINGS_PASSWORD, pwd);
HWND item = GetDlgItem(hwnd, IDC_PORT);
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index c041a53a43..c7d8ab8010 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -407,14 +407,17 @@ char *SkypeRcvTime(char *what, time_t st, DWORD maxwait) { LOG(("<SkypeRcv: (empty)"));
return NULL;
}
-char *SkypeRcv(char *what, DWORD maxwait) {
+
+char *SkypeRcv(char *what, DWORD maxwait)
+{
return SkypeRcvTime(what, 0, maxwait);
}
-char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait) {
- char *msg, msgid[32]={0}, *pMsg, *pCurMsg;
+char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait)
+{
+ char *msg, msgid[32]={0}, *pMsg, *pCurMsg;
struct MsgQueue *ptr;
- int iLenWhat = strlen(what);
+ int iLenWhat = (int)strlen(what);
DWORD dwWaitStat;
BOOL bIsError, bProcess;
@@ -1346,7 +1349,8 @@ static int my_spawnv(const char *cmdname, const char *const *argv, PROCESS_INFOR BOOL bRet;
memset (pi, 0, sizeof(PROCESS_INFORMATION));
- for (i=0; argv[i]; i++) iLen+=strlen(argv[i])+1;
+ for (i=0; argv[i]; i++)
+ iLen += (int)strlen(argv[i])+1;
if (!(CommandLine = (char*)calloc(1, iLen))) return -1;
for (i=0; argv[i]; i++) {
if (i) strcat (CommandLine, " ");
@@ -1407,11 +1411,9 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { {
char reply=0;
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
- if ((reply=SendSkypeproxyCommand(AUTHENTICATE))==-1)
- {
- db_free(&dbv);
- return -1;
+ if ((reply=SendSkypeproxyCommand(AUTHENTICATE))==-1) {
+ db_free(&dbv);
+ return -1;
}
if (!reply) {
OUTPUT(_T("Authentication is not supported/needed for this Skype proxy server. It will be disabled."));
@@ -1492,7 +1494,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { if (iStart != 2 || counter)
{
LOG(("ConnectToSkypeAPI sending discover message.. hWnd=%08X", (long)g_hWnd));
- retval=SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
+ retval = (int)SendMessageTimeout(HWND_BROADCAST, ControlAPIDiscover, (WPARAM)g_hWnd, 0, SMTO_ABORTIFHUNG, 3000, NULL);
LOG(("ConnectToSkypeAPI sent discover message returning %d", retval));
}
@@ -1521,7 +1523,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { LOG(("ConnectToSkypeAPI Starting Skype, as it's not running"));
j=1;
- for (i=0; i<sizeof(SkypeOptions)/sizeof(SkypeOptions[0]); i++)
+ for (i=0; i < SIZEOF(SkypeOptions); i++)
if (db_get_b(NULL, SKYPE_PROTONAME, SkypeOptions[i]+1, SkypeDefaults[i])) {
DBVARIANT dbv;
@@ -1532,7 +1534,7 @@ static int _ConnectToSkypeAPI(char *path, int iStart) { {
int paramSize;
TranslateMirandaRelativePathToAbsolute(dbv.pszVal, szAbsolutePath, TRUE);
- paramSize = strlen(SkypeOptions[i]) + strlen(szAbsolutePath);
+ paramSize = (int)strlen(SkypeOptions[i]) + (int)strlen(szAbsolutePath);
pFree = args[j] = (char*)malloc(paramSize + 1);
sprintf(args[j],"%s%s",SkypeOptions[i],szAbsolutePath);
db_free(&dbv);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 078770d1a6..db077b8b74 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -210,10 +210,10 @@ INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case IDC_POPUPBACKCOLOR:
case IDC_POPUPTEXTCOLORERR:
case IDC_POPUPBACKCOLORERR:
- popupBackColor = SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLOR,CPM_GETCOLOUR,0,0);
- popupTextColor = SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLOR,CPM_GETCOLOUR,0,0);
- popupBackColorErr = SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLORERR,CPM_GETCOLOUR,0,0);
- popupTextColorErr = SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLORERR,CPM_GETCOLOUR,0,0);
+ popupBackColor = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLOR,CPM_GETCOLOUR,0,0);
+ popupTextColor = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLOR,CPM_GETCOLOUR,0,0);
+ popupBackColorErr = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPBACKCOLORERR,CPM_GETCOLOUR,0,0);
+ popupTextColorErr = (UINT)SendDlgItemMessage(hwnd,IDC_POPUPTEXTCOLORERR,CPM_GETCOLOUR,0,0);
SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
break;
case IDC_USEWINCOLORS:
@@ -385,7 +385,6 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA CheckDlgButton(hwndDlg, IDC_REQPASS, (BYTE)db_get_b(NULL, SKYPE_PROTONAME, "RequiresPassword", 0));
CheckDlgButton(hwndDlg, IDC_USES2S, (BYTE)db_get_b(NULL, SKYPE_PROTONAME, "UseSkype2Socket", 0));
if (!db_get_s(NULL, SKYPE_PROTONAME, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM)dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -408,7 +407,6 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA db_set_b (NULL, SKYPE_PROTONAME, "UseSkype2Socket", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_USES2S), BM_GETCHECK,0,0)));
ZeroMemory(buf, sizeof(buf));
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, sizeof(buf));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(buf), (LPARAM)buf);
db_set_s(NULL, SKYPE_PROTONAME, "Password", buf);
return TRUE;
}
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index dbb36e1108..0bf2926e3e 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -187,13 +187,9 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) login = mir_strdup(dbv.pszVal);
db_free(&dbv);
}
- if (db_get_b(NULL, m_szModuleName, "SavePassword", TRUE) == TRUE) {
- if (!db_get(NULL, m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
- password = mir_strdup(dbv.pszVal);
- db_free(&dbv);
- }
- }
+
+ if (db_get_b(NULL, m_szModuleName, "SavePassword", TRUE) == TRUE)
+ password = db_get_sa(NULL, m_szModuleName, "Password");
else if (threadData != NULL && strlen(threadData->password) > 0)
password = mir_strdup(threadData->password);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index d8c47e0859..5d8a66af30 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -127,7 +127,6 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_free(&dbv);
}
if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -167,7 +166,6 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
if (dbv.pszVal != NULL) db_free(&dbv);
@@ -205,7 +203,6 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara db_free(&dbv);
}
if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -303,7 +300,6 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
if (dbv.pszVal != NULL) db_free(&dbv);
@@ -399,9 +395,8 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal);
db_free(&dbv);
- } else {
- SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
}
+ else SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE);
@@ -409,8 +404,9 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal);
db_free(&dbv);
- } else
- SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
+ }
+ else SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
+
SetDlgItemInt(hwndDlg, IDC_HOSTPORT, db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
CheckDlgButton(hwndDlg, IDC_KEEPALIVE, db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
@@ -431,11 +427,11 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE)
CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE);
- } else {
+ else
bChecked = FALSE;
- }
+
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER_LABEL), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USER), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PASSWORD_LABEL), bChecked);
@@ -454,8 +450,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal);
db_free(&dbv);
}
- if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
+ if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
@@ -503,63 +498,63 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
break;
+
case WM_NOTIFY:
- {
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- WORD port;
- BOOL useEncryption;
- BOOL reconnectRequired = FALSE;
- DBVARIANT dbv;
- GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
- if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) db_free(&dbv);
- db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ WORD port;
+ BOOL useEncryption;
+ BOOL reconnectRequired = FALSE;
+ DBVARIANT dbv;
+ GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
+ reconnectRequired = TRUE;
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
- GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
- if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
- reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) db_free(&dbv);
- db_set_s(NULL, proto->m_szModuleName, "ManualHost", text);
+ GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
+ if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
+ reconnectRequired = TRUE;
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "ManualHost", text);
- port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
- if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
- reconnectRequired = TRUE;
- db_set_w(NULL, proto->m_szModuleName, "ManualPort", port);
+ port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
+ if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
+ reconnectRequired = TRUE;
+ db_set_w(NULL, proto->m_szModuleName, "ManualPort", port);
- proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
- db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
+ proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
+ db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
- useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
- if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
- reconnectRequired = TRUE;
- db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
-
- db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
- // File transfer options
- db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
- db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
- db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
- db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
- db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
- db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
- GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
- if (reconnectRequired && proto->isConnected)
- MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
- ApplyChanges(proto, 4);
- return TRUE;
- }
- }
+ useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
+ if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
+ reconnectRequired = TRUE;
+ db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
+
+ db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
+
+ // File transfer options
+ db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
+
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
+
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
+
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
+
+ GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
+
+ if (reconnectRequired && proto->isConnected)
+ MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
+ ApplyChanges(proto, 4);
+ return TRUE;
}
break;
- case WM_DESTROY:
- break;
}
return FALSE;
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 88e561803b..c8ca8df1dd 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -470,12 +470,11 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft) strcpy(sb.szPassword, "");
if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
- if (!db_get(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
strcpy(sb.szUser, dbv.pszVal);
db_free(&dbv);
}
- if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
+ if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
strcpy(sb.szPassword, dbv.pszVal);
db_free(&dbv);
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 42a34bfa5f..ca7bce7e61 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -167,21 +167,23 @@ void __cdecl TlenServerThread(ThreadData *info) QueueUserAPC(TlenPasswordCreateDialogApcProc, hMainThread, (DWORD) jidStr);
WaitForSingleObject(hEventPasswdDlg, INFINITE);
CloseHandle(hEventPasswdDlg);
- //if ((p=(char *)DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PASSWORD), NULL, TlenPasswordDlgProc, (LPARAM) jidStr)) != onlinePassword) {
+
if (onlinePassword[0] != (char) -1) {
strncpy(info->password, onlinePassword, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
- } else {
+ }
+ else {
info->proto->debugLogA("Thread ended, password request dialog was canceled");
loginErr = LOGINERR_BADUSERID;
}
- } else {
+ }
+ else {
if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
db_free(&dbv);
- } else {
+ }
+ else {
info->proto->debugLogA("Thread ended, password is not configured");
loginErr = LOGINERR_BADUSERID;
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index c412e3ca5c..db2b2654d5 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -20,11 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. TCHAR* CVkProto::GetUserStoredPassword()
{
ptrA szRawPass( getStringA("Password"));
- if (szRawPass != NULL) {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(szRawPass), szRawPass);
- return mir_utf8decodeT(szRawPass);
- }
- return NULL;
+ return (szRawPass != NULL) ? mir_utf8decodeT(szRawPass) : NULL;
}
void CVkProto::SetAllContactStatuses(int iStatus)
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index c8d7ed7796..ae722029c4 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -68,10 +68,8 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
ptrA szRawPasswd( mir_utf8encodeT(str));
- if (szRawPasswd != NULL) {
- CallService(MS_DB_CRYPT_ENCODESTRING, strlen(szRawPasswd), szRawPasswd);
+ if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
- }
}
break;
diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp index 9aae55ac32..5fc08ec1dc 100644 --- a/protocols/WhatsApp/src/connection.cpp +++ b/protocols/WhatsApp/src/connection.cpp @@ -87,8 +87,6 @@ void WhatsAppProto::stayConnectedLoop(void*) error = true;
if ( !getString(WHATSAPP_KEY_PASS, &dbv))
{
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
- reinterpret_cast<LPARAM>(dbv.pszVal));
pass = dbv.pszVal;
db_free(&dbv);
error = pass.empty();
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 73f420f2f0..6a909346a8 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -4,8 +4,7 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA {
WhatsAppProto *proto;
- switch (message)
- {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
@@ -36,17 +35,15 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,&dbv,DBVT_ASCIIZ))
{
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
- reinterpret_cast<LPARAM>(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);
+ 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);
}
@@ -88,7 +85,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())
{
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(pw.c_str()), (LPARAM)pw.c_str());
proto->setString(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);
}
@@ -127,7 +123,6 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA db_set_b(0, proto->ModuleName(), WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwnd, IDC_SSL));
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,str);
return TRUE;
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index c76e364f38..9adbe4290b 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1517,49 +1517,17 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam) }
else
{
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv2.pszVal)+1,(LPARAM)dbv2.pszVal);
-
if(myClient!=NULL)
delete myClient;
- //alter proxycode, entfernt da über netlib die proxysache geregelt wird
- /* if(db_get_b(NULL, protocolname, "useproxy" ,0))
- {
- //verbindung über proxy
- DBVARIANT dbv3;
- DBVARIANT dbv4;
- if(!db_get(NULL,protocolname,"proxyip",&dbv3))
- {
- if(!db_get(NULL,protocolname,"proxyport",&dbv4))
- {
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0),1,dbv3.pszVal,atoi(dbv4.pszVal));
- db_free(&dbv4);
- }
- db_free(&dbv3);
- }
- }
- else */
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
+ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
//verbindung als thread
bpStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(protocolname,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)oldStatus,ID_STATUS_CONNECTING);
mir_forkthread(ConnectingThread,(LPVOID)wParam);
- //alte verb
- /*
- myClient->run();
- if(myClient->client->connected)
- {
- sendonrecieve=TRUE;
- }
- else
- {
- MSGBOXE(Translate("Unable to connect to XFire."));
- wParam =ID_STATUS_OFFLINE;
- }
- */
//für die vars
db_unset(NULL,protocolname,"currentgamename");
db_unset(NULL,protocolname,"currentvoicename");
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 9d7e519e93..004242dc63 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -179,7 +179,6 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
if(!db_get(NULL,protocolname,"password",&dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,(LPARAM)dbv.pszVal);
SetDlgItemTextA(hwndDlg,IDC_PASSWORD,dbv.pszVal);
db_free(&dbv);
}
@@ -298,8 +297,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if(dbv.pszVal!=NULL) db_free(&dbv);
GetDlgItemTextA(hwndDlg,IDC_PASSWORD,str,sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),(LPARAM)str);
- dbv.pszVal=NULL;
+ dbv.pszVal = NULL;
if(db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
reconnectRequired=1;
if(dbv.pszVal!=NULL) db_free(&dbv);
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index d53e46b965..f0fdfe9611 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -48,7 +48,6 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if ( !ppro->getString( YAHOO_PASSWORD, &dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
- CallService(MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, (LPARAM)dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal );
db_free(&dbv);
}
@@ -110,7 +109,6 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro->setString( YAHOO_LOGINID, str );
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str ));
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM)str);
dbv.pszVal = NULL;
if ( ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = true;
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 9c7be6525d..c7e3821ab8 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -440,28 +440,29 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) * Load Yahoo ID from the database.
*/
if (!getString(YAHOO_LOGINID, &dbv)) {
- if (lstrlenA(dbv.pszVal) > 0) {
+ if (lstrlenA(dbv.pszVal) > 0)
lstrcpynA(m_yahoo_id, dbv.pszVal, 255);
- } else
+ else
err++;
db_free(&dbv);
- } else {
+ }
+ else {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
err++;
}
- if (err) {
+ if (err)
lstrcpynA(errmsg, Translate("Please enter your Yahoo ID in Options/Network/Yahoo"), 80);
- } else {
+ else {
if (!getString(YAHOO_PASSWORD, &dbv)) {
- CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- if (lstrlenA(dbv.pszVal) > 0) {
+ if (lstrlenA(dbv.pszVal) > 0)
lstrcpynA(m_password, dbv.pszVal, 255);
- } else
+ else
err++;
db_free(&dbv);
- } else {
+ }
+ else {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
err++;
}
@@ -483,9 +484,8 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) FREE(m_pw_token); // No Token yet.
if (!getString(YAHOO_PWTOKEN, &dbv)) {
- if (lstrlenA(dbv.pszVal) > 0) {
+ if (lstrlenA(dbv.pszVal) > 0)
m_pw_token = strdup(dbv.pszVal);
- }
db_free(&dbv);
}
@@ -719,33 +719,29 @@ int __cdecl CYahooProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARA INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
+ DBVARIANT dbv;
+ CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
+ TranslateDialogDefault(hwndDlg);
- CYahooProto* ppro = (CYahooProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ ppro = (CYahooProto*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- DBVARIANT dbv;
- if ( !ppro->getString(YAHOO_LOGINID, &dbv))
- {
- SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal);
- db_free(&dbv);
- }
-
- if ( !ppro->getString(YAHOO_PASSWORD, &dbv))
- {
- CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- db_free(&dbv);
- }
+ if ( !ppro->getString(YAHOO_LOGINID, &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal);
+ db_free(&dbv);
+ }
- SetButtonCheck(hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
- return TRUE;
+ if ( !ppro->getString(YAHOO_PASSWORD, &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
+ db_free(&dbv);
}
+ SetButtonCheck(hwndDlg, IDC_YAHOO_JAPAN, ppro->getByte("YahooJapan", 0));
+ return TRUE;
+
case WM_COMMAND:
if ( LOWORD( wParam ) == IDC_NEWYAHOOACCOUNTLINK ) {
CallService(MS_UTILS_OPENURL,
@@ -769,11 +765,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY )
- {
- CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY ) {
char str[128];
- DBVARIANT dbv;
BOOL reconnectRequired = FALSE;
GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof(str));
@@ -798,7 +791,6 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (reconnectRequired)
ppro->delSetting(YAHOO_PWTOKEN);
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
ppro->setString(YAHOO_PASSWORD, str);
ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN ));
|