summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprotocols/AimOscar/res/aim.rc8
-rwxr-xr-x[-rw-r--r--]protocols/AimOscar/src/connection.cpp101
-rwxr-xr-x[-rw-r--r--]protocols/AimOscar/src/proto.h1
-rwxr-xr-x[-rw-r--r--]protocols/AimOscar/src/resource.h6
-rwxr-xr-xprotocols/AimOscar/src/stdafx.h11
-rwxr-xr-xprotocols/AimOscar/src/ui.cpp11
6 files changed, 127 insertions, 11 deletions
diff --git a/protocols/AimOscar/res/aim.rc b/protocols/AimOscar/res/aim.rc
index af3f07a46c..60e9e331fb 100755
--- a/protocols/AimOscar/res/aim.rc
+++ b/protocols/AimOscar/res/aim.rc
@@ -77,14 +77,16 @@ BEGIN
CONTROL "Instant Idle on Login",IDC_II,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,18,131,15
CONTROL "Force Proxy File Transfers",IDC_FP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,31,130,11
CONTROL "Masquerade as a Sidekick/Hiptop User",IDC_HF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,42,135,13
- CTEXT "* Some changes will take effect the next time you connect to the AIM network",IDC_MASQ,171,169,115,28,NOT WS_VISIBLE
- GROUPBOX "Connection",IDC_STATIC,154,89,142,71
+ CTEXT "* Some changes will take effect the next time you connect to the AIM network",IDC_MASQ,166,174,115,28,NOT WS_VISIBLE
+ GROUPBOX "Connection",IDC_STATIC,154,89,142,80
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 "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,146,129,10
+ 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
END
IDD_INFO DIALOGEX 0, 0, 227, 165
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 0a09c6d86c..ed0ae25292 100644..100755
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -140,6 +140,107 @@ void CAimProto::aim_connection_authorization(void)
debugLogA("Connection Authorization Thread Ending: End of Thread");
}
+void fill_post_request(char *buf)
+{
+ //TODO: fill post data
+ /*
+ devId=dev_key&f=xml&pwd=urlencoded_password&s=urlencoded_screenname
+ */
+ //mir_urlEncode()
+}
+
+bool parse_clientlogin_response(char *buf, size_t len, char *token, char *secret, time_t &hosttime)
+{
+ //TODO: validate response
+ //TODO: return false on errors
+ //TODO: extract token, secret, hosttime from response
+ return true;
+}
+
+void fill_login_url(char *buf, char *token, char *secret, time_t &hosttime)
+{
+ //TODO: construct url for get request
+ /*
+ a=urlencoded_token&distId=0x00000611&f=xml&k=dev_key&ts=hosttime&useTLS=bool_encryption
+ */
+
+}
+
+bool parse_start_socar_session_response(char *response, size_t response_len, char *bos_host, unsigned short bos_port, char *cookie, char *tls_cert_name)
+{
+ //TODO: extract bos_host, bos_port, cookie, tls_cert_name
+ return true;
+}
+
+void CAimProto::aim_connection_clientlogin(void)
+{
+ NETLIBHTTPREQUEST req = {0};
+ req.cbSize = sizeof(req);
+ req.flags = NLHRF_SSL;
+ req.requestType = REQUEST_POST;
+ req.szUrl = AIM_LOGIN_URL;
+ char buf[1024];
+ fill_post_request(buf);
+ req.pData = buf;
+ req.dataLength = (int)strlen(buf);
+
+ NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ if(!resp)
+ {
+ //TODO: handle error
+ return;
+ }
+ if(!resp->dataLength)
+ {
+ //TODO: handle error
+ return;
+ }
+ char token[512], secret[512]; //TODO: find efficient buf size
+ time_t hosttime;
+ if(!parse_clientlogin_response(resp->pData, resp->dataLength, token, secret, hosttime))
+ {
+ //TODO: handle error
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+ return;
+ }
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+ //reuse NETLIBHTTPREQUEST
+ req.requestType = REQUEST_GET;
+ req.pData = NULL;
+ req.dataLength = 0;
+ char url[1024];
+ fill_login_url(url, token, secret, hosttime);
+ req.szUrl = url;
+ resp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ if(!resp)
+ {
+ //TODO: handle error
+ return;
+ }
+ if(!resp->dataLength)
+ {
+ //TODO: handle error
+ return;
+ }
+ char bos_host[128], cookie[1024], tls_cert_name[128]; //TODO: find efficient buf size
+ unsigned short bos_port = 0;
+ if(!parse_start_socar_session_response(resp->pData, resp->dataLength, bos_host, bos_port, cookie, tls_cert_name))
+ {
+ //TODO: handle error
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+ return;
+ }
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, (WPARAM)0, (LPARAM)&resp);
+
+ mir_free(COOKIE);
+ COOKIE = mir_strdup(cookie); //TODO: check if it's null terminated
+ COOKIE_LENGTH = (int)mir_strlen(cookie);
+
+ //TODO: connect to bos server
+
+
+}
+
void __cdecl CAimProto::aim_protocol_negotiation(void*)
{
HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hServerConn, 2048 * 8);
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h
index 10e49759a5..7afb407100 100644..100755
--- a/protocols/AimOscar/src/proto.h
+++ b/protocols/AimOscar/src/proto.h
@@ -291,6 +291,7 @@ struct CAimProto : public PROTO<CAimProto>
// connection.cpp
void aim_connection_authorization( void );
+ void aim_connection_clientlogin( void );
void __cdecl aim_protocol_negotiation( void* );
void __cdecl aim_mail_negotiation( void* );
diff --git a/protocols/AimOscar/src/resource.h b/protocols/AimOscar/src/resource.h
index 2b9ad87095..c123194d8e 100644..100755
--- a/protocols/AimOscar/src/resource.h
+++ b/protocols/AimOscar/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by aim.rc
+// Used by X:\install\git\miranda\miranda_ng_svn\protocols\AimOscar\res\aim.rc
//
#define IDC_SAVECHANGES 3
#define IDC_CONFIRM 4
@@ -84,6 +84,8 @@
#define IDC_EDITSCR 174
#define IDC_ADDSCR 175
#define IDC_ROOMNAME 176
+#define IDC_CHECK1 178
+#define IDC_CLIENTLOGIN 178
#define IDC_SN 1030
#define IDC_NK 1040
#define IDC_PW 1050
@@ -117,7 +119,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 41
#define _APS_NEXT_COMMAND_VALUE 40002
-#define _APS_NEXT_CONTROL_VALUE 178
+#define _APS_NEXT_CONTROL_VALUE 179
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/AimOscar/src/stdafx.h b/protocols/AimOscar/src/stdafx.h
index fa500f9a2e..3bd2c89403 100755
--- a/protocols/AimOscar/src/stdafx.h
+++ b/protocols/AimOscar/src/stdafx.h
@@ -128,6 +128,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define AIM_KEY_MG "ManageGroups"
#define AIM_KEY_DA "DisableAvatars"
#define AIM_KEY_DSSL "DisableSSL"
+#define AIM_KEY_CLIENTLOGIN "UseClientLogin"
#define AIM_KEY_FSC "ForceSingleClient"
#define OTH_KEY_SM "StatusMsg"
@@ -161,11 +162,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define AIM_KEY_BLS "IsBlast"
#define AIM_KEY_NIL "IsNotInList"
-#define AIM_DEFAULT_SERVER "slogin.oscar.aol.com"
-#define AIM_DEFAULT_SERVER_NS "login.oscar.aol.com"
+#define AIM_LOGIN_URL "https://api.screenname.aol.com/auth/clientLogin"
+#define AIM_SESSION_URL "https://api.oscar.aol.com/aim/startOSCARSession"
+#define AIM_DEFAULT_CLIENT_KEY "ma15d7JTxbmVG-RP" //this one from libpurple, i am not able to create one, sorry guys
+
+#define AIM_DEFAULT_SERVER "login.oscar.aol.com"
+//#define AIM_DEFAULT_SERVER_SSL "slogin.oscar.aol.com"
#define AIM_PROXY_SERVER "ars.oscar.aol.com"
#define AIM_DEFAULT_PORT 5190
-#define AIM_DEFAULT_SSL_PORT 5190
+//#define AIM_DEFAULT_SSL_PORT 5190
//Some Defaults for various things
#define DEFAULT_KEEPALIVE_TIMER 39 // secs
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index ea69cdfa8d..a9b60fb863 100755
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -743,7 +743,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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_NS);
+ else SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE);
@@ -761,6 +761,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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_FSC, ppro->getByte(AIM_KEY_FSC, 0) ? BST_CHECKED : BST_UNCHECKED);//Force Single Client
}
break;
@@ -772,7 +773,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
/* 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_NS);
+ SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, AIM_DEFAULT_PORT, FALSE);
}
break;
@@ -780,7 +781,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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_NS);
+ SetDlgItemTextA(hwndDlg, IDC_HN, AIM_DEFAULT_SERVER);
SetDlgItemInt(hwndDlg, IDC_PN, ppro->get_default_port(), FALSE);
break;
@@ -847,6 +848,10 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ppro->setByte(AIM_KEY_DSSL, 1);
//Disable SSL
+ //use "clientlogin"
+ ppro->setByte(AIM_KEY_CLIENTLOGIN, IsDlgButtonChecked(hwndDlg, IDC_CLIENTLOGIN) != 0);
+ //use "clientlogin"
+
//Force Single Login
ppro->setByte(AIM_KEY_FSC, IsDlgButtonChecked(hwndDlg, IDC_FSC) != 0);
//Force Single Login