diff options
| -rwxr-xr-x | protocols/AimOscar/res/aim.rc | 43 | ||||
| -rwxr-xr-x | protocols/AimOscar/src/connection.cpp | 16 | ||||
| -rwxr-xr-x | protocols/AimOscar/src/ui.cpp | 34 | ||||
| -rwxr-xr-x | protocols/AimOscar/src/utility.cpp | 41 | 
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();
 +
 +		}
  	}
  }
 | 
