summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gluzsky <sss123next@list.ru>2016-04-08 01:25:53 +0000
committerAlexander Gluzsky <sss123next@list.ru>2016-04-08 01:25:53 +0000
commit699805f92b46fe6e3282672e89e693e20125497a (patch)
tree78955bfa6fa109e20136cfc7d4f33483771ca9a4
parent45795f0e01be0f51ac647cac4e7c35463f39636a (diff)
aim:
"clientlogin": code is turned on by default old authorization mechanizm is kept for some time, it can be used only without encryption //TODO: testing is required, i does not have working aim account to test it, so i have tested only first stage of authorization where i can bypass login:password validation git-svn-id: http://svn.miranda-ng.org/main/trunk@16608 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rwxr-xr-xprotocols/AimOscar/res/aim.rc43
-rwxr-xr-xprotocols/AimOscar/src/connection.cpp16
-rwxr-xr-xprotocols/AimOscar/src/ui.cpp34
-rwxr-xr-xprotocols/AimOscar/src/utility.cpp41
4 files changed, 105 insertions, 29 deletions
diff --git a/protocols/AimOscar/res/aim.rc b/protocols/AimOscar/res/aim.rc
index 60e9e331fb..f2ab7caaa4 100755
--- a/protocols/AimOscar/res/aim.rc
+++ b/protocols/AimOscar/res/aim.rc
@@ -82,11 +82,11 @@ BEGIN
EDITTEXT IDC_PN,207,119,37,13,ES_AUTOHSCROLL
LTEXT "Port:",IDC_STATIC,158,121,44,12
PUSHBUTTON "Reset",IDC_SVRRESET,254,118,35,14
- CONTROL "Disable SSL",IDC_DSSL,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,157,135,85,10
+ CONTROL "Disable SSL",IDC_DSSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,135,85,10
CONTROL "Manage Server Groups",IDC_MG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,194,138,13
CONTROL "Force Single Client",IDC_FSC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,155,129,10
CONTROL "Use ""clientlogin"" (recommended)",IDC_CLIENTLOGIN,
- "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,157,145,119,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,145,119,10
END
IDD_INFO DIALOGEX 0, 0, 227, 165
@@ -298,33 +298,72 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_AIM ICON "oscar.ico"
+
IDI_ADD ICON "add.ico"
+
IDI_ICQ ICON "icq.ico"
+
IDI_AOL ICON "aol.ico"
+
IDI_HIPTOP ICON "hiptop.ico"
+
IDI_BOT ICON "bot.ico"
+
IDI_ADMIN ICON "admin.ico"
+
IDI_CONFIRMED ICON "confirmed.ico"
+
IDI_UNCONFIRMED ICON "unconfirmed.ico"
+
IDI_AWAY ICON "away.ico"
+
IDI_IDLE ICON "idle.ico"
+
IDI_PROFILE ICON "profile.ico"
+
IDI_MAIL ICON "inbox.ico"
+
IDI_BOLD ICON "bold.ico"
+
IDI_NBOLD ICON "nbold.ico"
+
IDI_NITALIC ICON "nitalic.ico"
+
IDI_ITALIC ICON "italic.ico"
+
IDI_NUNDERLINE ICON "nunderline.ico"
+
IDI_UNDERLINE ICON "underline.ico"
+
IDI_NSUPERSCRIPT ICON "nsuperscript.ico"
+
IDI_NSUBSCRIPT ICON "nsubscript.ico"
+
IDI_FOREGROUNDCOLOR ICON "foregroundcolor.ico"
+
IDI_BACKGROUNDCOLOR ICON "backgroundcolor.ico"
+
IDI_NNORMALSCRIPT ICON "nnormalscript.ico"
+
IDI_NORMALSCRIPT ICON "normalscript.ico"
+
IDI_SUBSCRIPT ICON "subscript.ico"
+
IDI_SUPERSCRIPT ICON "superscript.ico"
+
IDI_BLOCK ICON "block.ico"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_AIM AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 600f4cbcc9..921a09c10e 100755
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -382,25 +382,34 @@ void CAimProto::aim_connection_clientlogin(void)
req.flags = NLHRF_SSL;
req.requestType = REQUEST_POST;
req.szUrl = AIM_LOGIN_URL;
+ NETLIBHTTPHEADER headers[1];
+ headers[0].szName = "Content-Type";
+ headers[0].szValue = "application/x-www-form-urlencoded; charset=UTF-8";
+ req.headers = headers;
+ req.headersCount = 1;
char buf[1024];
buf[0] = 0;
char *password = getStringA(AIM_KEY_PW);
+ mir_free(m_username);
+ m_username = getStringA(AIM_KEY_SN);
fill_post_request(buf, password, m_username);
req.pData = buf;
req.dataLength = (int)strlen(buf);
- bool encryption = true; //TODO: make this configurable
+ bool encryption = !getByte(AIM_KEY_DSSL, 0); //TODO: make this configurable
NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if(!resp)
{
//TODO: handle error
+ broadcast_status(ID_STATUS_OFFLINE);
mir_free(password);
return;
}
if(!resp->dataLength)
{
//TODO: handle error
+ broadcast_status(ID_STATUS_OFFLINE);
mir_free(password);
return;
}
@@ -412,6 +421,7 @@ void CAimProto::aim_connection_clientlogin(void)
{
//TODO: handle error
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+ broadcast_status(ID_STATUS_OFFLINE);
mir_free(password);
return;
}
@@ -429,11 +439,13 @@ void CAimProto::aim_connection_clientlogin(void)
if(!resp)
{
//TODO: handle error
+ broadcast_status(ID_STATUS_OFFLINE);
return;
}
if(!resp->dataLength)
{
//TODO: handle error
+ broadcast_status(ID_STATUS_OFFLINE);
return;
}
char bos_host[128], cookie[1024], tls_cert_name[128]; //TODO: find efficient buf size
@@ -445,6 +457,7 @@ void CAimProto::aim_connection_clientlogin(void)
{
//TODO: handle error
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+ broadcast_status(ID_STATUS_OFFLINE);
return;
}
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
@@ -453,6 +466,7 @@ void CAimProto::aim_connection_clientlogin(void)
if(!m_hServerConn)
{
//TODO: handle error
+ broadcast_status(ID_STATUS_OFFLINE);
return;
}
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index a9b60fb863..c8618cdf6f 100755
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -742,7 +742,6 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE);
@@ -759,9 +758,14 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CheckDlgButton(hwndDlg, IDC_CM, ppro->getByte(AIM_KEY_CM, 0) ? BST_CHECKED : BST_UNCHECKED);//Check Mail
CheckDlgButton(hwndDlg, IDC_MG, ppro->getByte(AIM_KEY_MG, 1) ? BST_CHECKED : BST_UNCHECKED);//Manage Groups
CheckDlgButton(hwndDlg, IDC_DA, ppro->getByte(AIM_KEY_DA, 0) ? BST_CHECKED : BST_UNCHECKED);//Disable Avatars
- //CheckDlgButton(hwndDlg, IDC_DSSL, ppro->getByte(AIM_KEY_DSSL, 0) ? BST_CHECKED : BST_UNCHECKED);//Disable SSL
- CheckDlgButton(hwndDlg, IDC_DSSL, BST_CHECKED);//Disable SSL
- CheckDlgButton(hwndDlg, IDC_CLIENTLOGIN, ppro->getByte(AIM_KEY_CLIENTLOGIN, 0) ? BST_CHECKED : BST_UNCHECKED);//use clientlogin
+ CheckDlgButton(hwndDlg, IDC_DSSL, ppro->getByte(AIM_KEY_DSSL, 0) ? BST_CHECKED : BST_UNCHECKED);//Disable SSL
+ 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);
+ }
CheckDlgButton(hwndDlg, IDC_FSC, ppro->getByte(AIM_KEY_FSC, 0) ? BST_CHECKED : BST_UNCHECKED);//Force Single Client
}
break;
@@ -770,17 +774,13 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (LOWORD(wParam)) {
case IDC_DSSL:
{
-/* bool dssl = IsDlgButtonChecked(hwndDlg, IDC_DSSL) != 0;
- SetDlgItemTextA(hwndDlg, IDC_HN, dssl ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER);
- SetDlgItemInt(hwndDlg, IDC_PN, dssl ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT, FALSE);*/
SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, AIM_DEFAULT_PORT, FALSE);
}
break;
+
case IDC_SVRRESET:
-/* SetDlgItemTextA(hwndDlg, IDC_HN,
- IsDlgButtonChecked(hwndDlg, IDC_DSSL) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER); */
SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE);
break;
@@ -794,6 +794,18 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return 0;
break;
}
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIENTLOGIN))
+ {
+ HWND dssl = GetDlgItem(hwndDlg, IDC_DSSL);
+ EnableWindow(dssl, true);
+ CheckDlgButton(hwndDlg, IDC_DSSL, BST_UNCHECKED);
+ }
+ else
+ {
+ HWND dssl = GetDlgItem(hwndDlg, IDC_DSSL);
+ EnableWindow(dssl, false);
+ CheckDlgButton(hwndDlg, IDC_DSSL, BST_CHECKED);
+ }
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -844,8 +856,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//Disable Avatar
//Disable SSL
- //ppro->setByte(AIM_KEY_DSSL, IsDlgButtonChecked(hwndDlg, IDC_DSSL) != 0);
- ppro->setByte(AIM_KEY_DSSL, 1);
+ ppro->setByte(AIM_KEY_DSSL, IsDlgButtonChecked(hwndDlg, IDC_DSSL) != 0);
//Disable SSL
//use "clientlogin"
@@ -862,7 +873,6 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//PN
int port = GetDlgItemInt(hwndDlg, IDC_PN, NULL, FALSE);
- //if (port > 0 && port != (ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT))
if (port > 0 && port != AIM_DEFAULT_PORT)
ppro->setWord(AIM_KEY_PN, (WORD)port);
else
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 4ba0cc56c5..b6c6822db6 100755
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -99,26 +99,39 @@ void CAimProto::start_connection(void*)
return;
}
- //bool use_ssl = !getByte(AIM_KEY_DSSL, 0);
- bool use_ssl = false;
- char* login_url = getStringA(AIM_KEY_HN);
- //if (login_url == NULL) login_url = mir_strdup(use_ssl ? AIM_DEFAULT_SERVER : AIM_DEFAULT_SERVER_NS);
- if (login_url == NULL) login_url = mir_strdup(AIM_DEFAULT_SERVER);
+ bool use_clientlogin = getByte(AIM_KEY_CLIENTLOGIN, 0);
+
+ if (!use_clientlogin)
+ {
+
+ char* login_url = getStringA(AIM_KEY_HN);
+ //if (login_url == NULL) login_url = mir_strdup(use_ssl ? AIM_DEFAULT_SERVER : AIM_DEFAULT_SERVER_NS);
+
+
+ if (login_url == NULL) login_url = mir_strdup(AIM_DEFAULT_SERVER);
+
- m_hServerConn = aim_connect(login_url, get_default_port(), use_ssl, login_url);
- mir_free(login_url);
+ m_hServerConn = aim_connect(login_url, get_default_port(), false, login_url); //ssl does not work anymore with old authorization algo
- m_pref1_flags = 0x77ffff;
- m_pref1_set_flags = 0x77ffff;
- mir_free(m_pref2_flags); m_pref2_flags = NULL; m_pref2_len = 0;
- mir_free(m_pref2_set_flags); m_pref2_set_flags = NULL; m_pref2_set_len = 0;
+ mir_free(login_url);
- if (m_hServerConn)
- aim_connection_authorization();
+ m_pref1_flags = 0x77ffff;
+ m_pref1_set_flags = 0x77ffff;
+ mir_free(m_pref2_flags); m_pref2_flags = NULL; m_pref2_len = 0;
+ mir_free(m_pref2_set_flags); m_pref2_set_flags = NULL; m_pref2_set_len = 0;
+
+ if (m_hServerConn)
+ aim_connection_authorization();
+ else
+ broadcast_status(ID_STATUS_OFFLINE);
+ }
else
- broadcast_status(ID_STATUS_OFFLINE);
+ {
+ aim_connection_clientlogin();
+
+ }
}
}