summaryrefslogtreecommitdiff
path: root/protocols/AimOscar
diff options
context:
space:
mode:
authorAlexander Gluzsky <sss123next@list.ru>2016-04-11 06:58:50 +0000
committerAlexander Gluzsky <sss123next@list.ru>2016-04-11 06:58:50 +0000
commitbee10e1391e35d6e920f894d7f9a3974d7654bb8 (patch)
tree49f3b60b09e426eb893f5cf99a9fc9c2efb1fbe9 /protocols/AimOscar
parentd66c315e6ee4f59215cefadd22a020b8661a4e57 (diff)
aim:
few settings ui fixes "clientlogin": few fixes //still does not work git-svn-id: http://svn.miranda-ng.org/main/trunk@16626 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar')
-rwxr-xr-xprotocols/AimOscar/src/connection.cpp29
-rwxr-xr-xprotocols/AimOscar/src/ui.cpp14
2 files changed, 15 insertions, 28 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index ba5fb521f5..15c09508e0 100755
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -242,14 +242,15 @@ bool parse_clientlogin_response(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *my_he
return true;
}
-void construct_query_string(char *buf, const char *token, time_t hosttime, bool encryption = true)
+void construct_query_string(char *buf, const char *token, time_t hosttime, bool encryption)
{
//TODO: construct query string
/*
a=urlencoded_token&distId=0x00000611&f=xml&k=dev_key&ts=hosttime&useTLS=bool_encryption
*/
+
char *urlencoded_token = mir_urlEncode(token);
- mir_snprintf(buf, 1023, "a=%s&distId=%d&f=xml&k=%s&ts=%d&useTLS=%d", urlencoded_token, AIM_DEFAULT_DISTID, AIM_DEFAULT_CLIENT_KEY, hosttime, encryption ? 1 : 0);
+ snprintf(buf, 2023, "a=%s&distId=%d&f=xml&k=%s&ts=%llu&useTLS=%d", token, AIM_DEFAULT_DISTID, AIM_DEFAULT_CLIENT_KEY, hosttime, (int)encryption); //mir_snprintf bugged
mir_free(urlencoded_token);
}
@@ -258,21 +259,20 @@ void generate_signature(BYTE *signature, const char *method, const char *url, co
{
char *encoded_url = mir_urlEncode(url);
char *encoded_parameters = mir_urlEncode(parameters);
- char signature_base[1024];
- mir_snprintf(signature_base, "%s%s%s", method, encoded_url, encoded_parameters);
+ char signature_base[1024] = {0};
+ mir_snprintf(signature_base, "%s&%s&%s", method, encoded_url, encoded_parameters);
mir_free(encoded_url);
mir_free(encoded_parameters);
mir_hmac_sha256(signature, (BYTE*)session_key, mir_strlen(session_key), (BYTE*)signature_base, mir_strlen(signature_base));
}
-void fill_session_url(char *buf, size_t bufSize, char *token, char *secret, time_t &hosttime, const char *password, bool encryption = true)
+void fill_session_url(char *buf, size_t bufSize, char *token, char *secret, time_t &hosttime, const char *password, bool encryption)
{
/*
AIM_SESSION_URL?query_string?sig_sha256=signature
*/
- char query_string[1024];
- query_string[0] = 0;
+ char query_string[1024] = {0};
construct_query_string(query_string, token, hosttime, encryption);
BYTE session_key[MIR_SHA256_HASH_SIZE], signature[MIR_SHA256_HASH_SIZE];
@@ -386,8 +386,7 @@ void CAimProto::aim_connection_clientlogin(void)
mir_strcpy(headers[0].szValue, "application/x-www-form-urlencoded; charset=UTF-8");
req.headers = headers;
req.headersCount = 1;
- char buf[1024];
- buf[0] = 0;
+ char buf[1024] = {0};
char *password = getStringA(AIM_KEY_PW);
mir_free(m_username);
m_username = getStringA(AIM_KEY_SN);
@@ -414,9 +413,7 @@ void CAimProto::aim_connection_clientlogin(void)
mir_free(password);
return;
}
- char token[512], secret[512]; //TODO: find efficient buf size
- token[0] = 0;
- secret[0] = 0;
+ char token[1024] = { 0 }, secret[512] = {0}; //TODO: find efficient buf size
time_t hosttime;
if(!parse_clientlogin_response(resp, headers, token, secret, hosttime))
{
@@ -435,8 +432,7 @@ void CAimProto::aim_connection_clientlogin(void)
req.dataLength = 0;
//req.headersCount = 1;
req.headersCount = 0; //additional headers disabled
- char url[2048];
- url[0] = 0;
+ char url[2048] = {0};
fill_session_url(url, sizeof(url), token, secret, hosttime, password, encryption);
mir_free(password);
req.szUrl = url;
@@ -455,10 +451,7 @@ void CAimProto::aim_connection_clientlogin(void)
broadcast_status(ID_STATUS_OFFLINE);
return;
}
- char bos_host[128], cookie[1024], tls_cert_name[128]; //TODO: find efficient buf size
- bos_host[0] = 0;
- cookie[0] = 0;
- tls_cert_name[0] = 0;
+ char bos_host[128] = { 0 }, cookie[1024] = { 0 }, tls_cert_name[128] = {0}; //TODO: find efficient buf size
unsigned short bos_port = 0;
if(!parse_start_socar_session_response(resp->pData, bos_host, bos_port, cookie, tls_cert_name, encryption))
{
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index c8618cdf6f..8277b4596f 100755
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -762,9 +762,10 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CheckDlgButton(hwndDlg, IDC_CLIENTLOGIN, ppro->getByte(AIM_KEY_CLIENTLOGIN, 1) ? BST_CHECKED : BST_UNCHECKED);//use clientlogin
{
HWND dssl = GetDlgItem(hwndDlg, IDC_DSSL);
- EnableWindow(dssl, ppro->getByte(AIM_KEY_CLIENTLOGIN, 1) ? true : false);
- CheckDlgButton(hwndDlg, IDC_DSSL, BST_CHECKED);
- ppro->setByte(AIM_KEY_DSSL, IsDlgButtonChecked(hwndDlg, IDC_DSSL) != 0);
+ bool clientlogin = ppro->getByte(AIM_KEY_CLIENTLOGIN, 1);
+ EnableWindow(dssl, clientlogin);
+ if(!clientlogin)
+ CheckDlgButton(hwndDlg, IDC_DSSL, BST_CHECKED);
}
CheckDlgButton(hwndDlg, IDC_FSC, ppro->getByte(AIM_KEY_FSC, 0) ? BST_CHECKED : BST_UNCHECKED);//Force Single Client
}
@@ -772,12 +773,6 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case IDC_DSSL:
- {
- SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
- SetDlgItemInt(hwndDlg, IDC_PN, AIM_DEFAULT_PORT, FALSE);
- }
- break;
case IDC_SVRRESET:
@@ -798,7 +793,6 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
HWND dssl = GetDlgItem(hwndDlg, IDC_DSSL);
EnableWindow(dssl, true);
- CheckDlgButton(hwndDlg, IDC_DSSL, BST_UNCHECKED);
}
else
{