*** empty log message ***

svn path=/trunk/boinc/; revision=4445
This commit is contained in:
Rom Walton 2004-10-27 03:17:40 +00:00
parent ac571776de
commit 051249189e
6 changed files with 164 additions and 54 deletions

View File

@ -69,7 +69,7 @@ bool CDlgOptions::Create( wxWindow* parent, wxWindowID id, const wxString& capti
m_SOCKSAddressCtrl = NULL;
m_SOCKSPortCtrl = NULL;
m_SOCKSUsernameCtrl = NULL;
m_SOCKPasswordCtrl = NULL;
m_SOCKSPasswordCtrl = NULL;
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
@ -219,7 +219,7 @@ void CDlgOptions::CreateControls()
wxTextCtrl* itemTextCtrl38 = new wxTextCtrl;
itemTextCtrl38->Create( itemPanel23, ID_SOCKSPASSWORDCTRL, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
m_SOCKPasswordCtrl = itemTextCtrl38;
m_SOCKSPasswordCtrl = itemTextCtrl38;
itemFlexGridSizer34->Add(itemTextCtrl38, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemNotebook3->AddPage(itemPanel23, _("SOCKS Proxy"));
@ -255,28 +255,104 @@ void CDlgOptions::OnNotebookUpdate( wxUpdateUIEvent& event )
void CDlgOptions::OnEnableHTTPProxyCtrlClick( wxCommandEvent& event )
{
// Insert custom code here
if ( event.IsChecked() )
{
m_HTTPAddressCtrl->Enable(true);
m_HTTPPortCtrl->Enable(true);
m_HTTPUsernameCtrl->Enable(true);
m_HTTPPasswordCtrl->Enable(true);
}
else
{
m_HTTPAddressCtrl->Enable(false);
m_HTTPPortCtrl->Enable(false);
m_HTTPUsernameCtrl->Enable(false);
m_HTTPPasswordCtrl->Enable(false);
}
event.Skip();
}
void CDlgOptions::OnEnableHTTPProxyCtrlUpdate( wxUpdateUIEvent& event )
{
// Insert custom code here
if ( m_bProxySectionConfigured )
{
m_EnableHTTPProxyCtrl->Enable(true);
if ( m_EnableHTTPProxyCtrl->IsChecked() )
{
m_HTTPAddressCtrl->Enable(true);
m_HTTPPortCtrl->Enable(true);
m_HTTPUsernameCtrl->Enable(true);
m_HTTPPasswordCtrl->Enable(true);
}
else
{
m_HTTPAddressCtrl->Enable(false);
m_HTTPPortCtrl->Enable(false);
m_HTTPUsernameCtrl->Enable(false);
m_HTTPPasswordCtrl->Enable(false);
}
}
else
{
m_EnableHTTPProxyCtrl->Enable(false);
m_HTTPAddressCtrl->Enable(false);
m_HTTPPortCtrl->Enable(false);
m_HTTPUsernameCtrl->Enable(false);
m_HTTPPasswordCtrl->Enable(false);
}
event.Skip();
}
void CDlgOptions::OnEnableSOCKSProxyCtrlClick( wxCommandEvent& event )
{
// Insert custom code here
if ( event.IsChecked() )
{
m_SOCKSAddressCtrl->Enable(true);
m_SOCKSPortCtrl->Enable(true);
m_SOCKSUsernameCtrl->Enable(true);
m_SOCKSPasswordCtrl->Enable(true);
}
else
{
m_SOCKSAddressCtrl->Enable(false);
m_SOCKSPortCtrl->Enable(false);
m_SOCKSUsernameCtrl->Enable(false);
m_SOCKSPasswordCtrl->Enable(false);
}
event.Skip();
}
void CDlgOptions::OnEnableSOCKSProxyCtrlUpdate( wxUpdateUIEvent& event )
{
// Insert custom code here
if ( m_bProxySectionConfigured )
{
m_EnableSOCKSProxyCtrl->Enable(true);
if ( m_EnableSOCKSProxyCtrl->IsChecked() )
{
m_SOCKSAddressCtrl->Enable(true);
m_SOCKSPortCtrl->Enable(true);
m_SOCKSUsernameCtrl->Enable(true);
m_SOCKSPasswordCtrl->Enable(true);
}
else
{
m_SOCKSAddressCtrl->Enable(false);
m_SOCKSPortCtrl->Enable(false);
m_SOCKSUsernameCtrl->Enable(false);
m_SOCKSPasswordCtrl->Enable(false);
}
}
else
{
m_EnableSOCKSProxyCtrl->Enable(false);
m_SOCKSAddressCtrl->Enable(false);
m_SOCKSPortCtrl->Enable(false);
m_SOCKSUsernameCtrl->Enable(false);
m_SOCKSPasswordCtrl->Enable(false);
}
event.Skip();
}

View File

@ -102,7 +102,7 @@ public:
wxTextCtrl* m_SOCKSAddressCtrl;
wxTextCtrl* m_SOCKSPortCtrl;
wxTextCtrl* m_SOCKSUsernameCtrl;
wxTextCtrl* m_SOCKPasswordCtrl;
wxTextCtrl* m_SOCKSPasswordCtrl;
};
#endif

View File

@ -1411,20 +1411,14 @@ wxInt32 CMainDocument::GetProxyConfiguration()
wxInt32 CMainDocument::GetProxyHTTPProxyEnabled( bool& bEnabled )
{
bEnabled = proxy_info.use_http_authentication;
return 0;
}
wxInt32 CMainDocument::GetProxyHTTPAuthenticationEnabled( bool& bEnabled )
{
bEnabled = proxy_info.use_http_authentication;
bEnabled = proxy_info.use_http_proxy;
return 0;
}
wxInt32 CMainDocument::GetProxyHTTPServerName( wxString& strServerName )
{
strServerName.Clear();
strServerName = proxy_info.http_server_name.c_str();
return 0;
}
@ -1439,6 +1433,7 @@ wxInt32 CMainDocument::GetProxyHTTPServerPort( wxInt32& iPortNumber )
wxInt32 CMainDocument::GetProxyHTTPUserName( wxString& strUserName )
{
strUserName.Clear();
strUserName = proxy_info.http_user_name.c_str();
return 0;
}
@ -1446,6 +1441,7 @@ wxInt32 CMainDocument::GetProxyHTTPUserName( wxString& strUserName )
wxInt32 CMainDocument::GetProxyHTTPPassword( wxString& strPassword )
{
strPassword.Clear();
strPassword = proxy_info.http_user_passwd.c_str();
return 0;
}
@ -1458,15 +1454,9 @@ wxInt32 CMainDocument::GetProxySOCKSProxyEnabled( bool& bEnabled )
}
wxInt32 CMainDocument::GetProxySOCKSVersion( wxInt32& iVersion )
{
iVersion = proxy_info.socks_version;
return 0;
}
wxInt32 CMainDocument::GetProxySOCKSServerName( wxString& strServerName )
{
strServerName.Clear();
strServerName = proxy_info.socks_server_name.c_str();
return 0;
}
@ -1481,6 +1471,7 @@ wxInt32 CMainDocument::GetProxySOCKSServerPort( wxInt32& iPortNumber )
wxInt32 CMainDocument::GetProxySOCKSUserName( wxString& strUserName )
{
strUserName.Clear();
strUserName = proxy_info.socks5_user_name.c_str();
return 0;
}
@ -1488,6 +1479,7 @@ wxInt32 CMainDocument::GetProxySOCKSUserName( wxString& strUserName )
wxInt32 CMainDocument::GetProxySOCKSPassword( wxString& strPassword )
{
strPassword.Clear();
strPassword = proxy_info.socks5_user_passwd.c_str();
return 0;
}
@ -1497,7 +1489,7 @@ wxInt32 CMainDocument::SetProxyConfiguration()
{
wxInt32 retval = 0;
retval = rpc.set_proxy_settings(proxy_info);
retval = rpc.set_proxy_settings( proxy_info );
if (retval)
{
wxLogTrace("CMainDocument::SetProxyInfo - Set Proxy Info Failed '%d'", retval);
@ -1510,14 +1502,7 @@ wxInt32 CMainDocument::SetProxyConfiguration()
wxInt32 CMainDocument::SetProxyHTTPProxyEnabled( const bool bEnabled )
{
proxy_info.use_http_authentication = bEnabled;
return 0;
}
wxInt32 CMainDocument::SetProxyHTTPAuthenticationEnabled( const bool bEnabled )
{
proxy_info.use_http_authentication = bEnabled;
proxy_info.use_http_proxy = bEnabled;
return 0;
}
@ -1557,13 +1542,6 @@ wxInt32 CMainDocument::SetProxySOCKSProxyEnabled( const bool bEnabled )
}
wxInt32 CMainDocument::SetProxySOCKSVersion( const wxInt32 iVersion )
{
proxy_info.socks_version = iVersion;
return 0;
}
wxInt32 CMainDocument::SetProxySOCKSServerName( const wxString& strServerName )
{
proxy_info.socks_server_name = strServerName.c_str();

View File

@ -246,13 +246,11 @@ public:
wxInt32 GetProxyConfiguration();
wxInt32 GetProxyHTTPProxyEnabled( bool& bEnabled );
wxInt32 GetProxyHTTPAuthenticationEnabled( bool& bEnabled );
wxInt32 GetProxyHTTPServerName( wxString& strServerName );
wxInt32 GetProxyHTTPServerPort( wxInt32& iPortNumber );
wxInt32 GetProxyHTTPUserName( wxString& strUserName );
wxInt32 GetProxyHTTPPassword( wxString& strPassword );
wxInt32 GetProxySOCKSProxyEnabled( bool& bEnabled );
wxInt32 GetProxySOCKSVersion( wxInt32& iVersion );
wxInt32 GetProxySOCKSServerName( wxString& strServerName );
wxInt32 GetProxySOCKSServerPort( wxInt32& iPortNumber );
wxInt32 GetProxySOCKSUserName( wxString& strUserName );
@ -260,13 +258,11 @@ public:
wxInt32 SetProxyConfiguration();
wxInt32 SetProxyHTTPProxyEnabled( const bool bEnabled );
wxInt32 SetProxyHTTPAuthenticationEnabled( const bool bEnabled );
wxInt32 SetProxyHTTPServerName( const wxString& strServerName );
wxInt32 SetProxyHTTPServerPort( const wxInt32 iPortNumber );
wxInt32 SetProxyHTTPUserName( const wxString& strUserName );
wxInt32 SetProxyHTTPPassword( const wxString& strPassword );
wxInt32 SetProxySOCKSProxyEnabled( const bool bEnabled );
wxInt32 SetProxySOCKSVersion( const wxInt32 iVersion );
wxInt32 SetProxySOCKSServerName( const wxString& strServerName );
wxInt32 SetProxySOCKSServerPort( const wxInt32 iPortNumber );
wxInt32 SetProxySOCKSUserName( const wxString& strUserName );

View File

@ -531,18 +531,78 @@ void CMainFrame::OnToolsOptions( wxCommandEvent& WXUNUSED(event) )
CMainDocument* pDoc = wxGetApp().GetDocument();
CDlgOptions* pDlg = new CDlgOptions(this);
wxInt32 iAnswer = 0;
bool bProxyInformationConfigured = false;
bool bBuffer = false;
wxInt32 iBuffer = 0;
wxString strBuffer = wxEmptyString;
wxASSERT(NULL != pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
wxASSERT(NULL != pDlg);
iAnswer = pDlg->ShowModal();
if ( wxOK == iAnswer )
bProxyInformationConfigured = ( 0 == pDoc->GetProxyConfiguration() );
if ( bProxyInformationConfigured )
{
pDlg->m_bProxySectionConfigured = true;
if ( 0 == pDoc->GetProxyHTTPProxyEnabled( bBuffer ) )
pDlg->m_EnableHTTPProxyCtrl->SetValue( bBuffer );
if ( 0 == pDoc->GetProxyHTTPServerName( strBuffer ) )
pDlg->m_HTTPAddressCtrl->SetValue( strBuffer );
if ( 0 == pDoc->GetProxyHTTPServerPort( iBuffer ) )
{
strBuffer.Printf( wxT("%d"), iBuffer );
pDlg->m_HTTPPortCtrl->SetValue( strBuffer );
}
if ( 0 == pDoc->GetProxyHTTPUserName( strBuffer ) )
pDlg->m_HTTPUsernameCtrl->SetValue( strBuffer );
if ( 0 == pDoc->GetProxyHTTPPassword( strBuffer ) )
pDlg->m_HTTPPasswordCtrl->SetValue( strBuffer );
if ( 0 == pDoc->GetProxySOCKSProxyEnabled( bBuffer ) )
pDlg->m_EnableSOCKSProxyCtrl->SetValue( bBuffer );
if ( 0 == pDoc->GetProxySOCKSServerName( strBuffer ) )
pDlg->m_SOCKSAddressCtrl->SetValue( strBuffer );
if ( 0 == pDoc->GetProxySOCKSServerPort( iBuffer ) )
{
strBuffer.Printf( wxT("%d"), iBuffer );
pDlg->m_SOCKSPortCtrl->SetValue( strBuffer );
}
if ( 0 == pDoc->GetProxySOCKSUserName( strBuffer ) )
pDlg->m_SOCKSUsernameCtrl->SetValue( strBuffer );
if ( 0 == pDoc->GetProxySOCKSPassword( strBuffer ) )
pDlg->m_SOCKSPasswordCtrl->SetValue( strBuffer );
}
iAnswer = pDlg->ShowModal();
if ( wxID_OK == iAnswer )
{
bBuffer = pDlg->m_EnableHTTPProxyCtrl->GetValue();
pDoc->SetProxyHTTPProxyEnabled( bBuffer );
strBuffer = pDlg->m_HTTPAddressCtrl->GetValue();
pDoc->SetProxyHTTPServerName( strBuffer );
strBuffer = pDlg->m_HTTPPortCtrl->GetValue();
strBuffer.ToLong( (long*)&iBuffer );
pDoc->SetProxyHTTPServerPort( iBuffer );
strBuffer = pDlg->m_HTTPUsernameCtrl->GetValue();
pDoc->SetProxyHTTPUserName( strBuffer );
strBuffer = pDlg->m_HTTPPasswordCtrl->GetValue();
pDoc->SetProxyHTTPPassword( strBuffer );
bBuffer = pDlg->m_EnableHTTPProxyCtrl->GetValue();
pDoc->SetProxySOCKSProxyEnabled( bBuffer );
strBuffer = pDlg->m_SOCKSAddressCtrl->GetValue();
pDoc->SetProxySOCKSServerName( strBuffer );
strBuffer = pDlg->m_SOCKSPortCtrl->GetValue();
strBuffer.ToLong( (long*)&iBuffer );
pDoc->SetProxySOCKSServerPort( iBuffer );
strBuffer = pDlg->m_SOCKSUsernameCtrl->GetValue();
pDoc->SetProxySOCKSUserName( strBuffer );
strBuffer = pDlg->m_SOCKSPasswordCtrl->GetValue();
pDoc->SetProxySOCKSPassword( strBuffer );
pDoc->SetProxyConfiguration();
}
if (pDlg)
pDlg->Destroy();

View File

@ -1254,30 +1254,30 @@ int RPC_CLIENT::run_benchmarks() {
}
int RPC_CLIENT::set_proxy_settings(PROXY_INFO& pi) {
char buf[256];
char buf[1024];
RPC rpc(this);
sprintf(buf,
"<set_proxy_settings>\n%s%s"
" <proxy_info>\n"
" <socks_server_name>%s</socks_server_name>\n"
" <socks_server_port>%d</socks_server_port>\n"
" <http_server_name>%s</http_server_name>\n"
" <http_server_port>%d</http_server_port>\n"
" <http_user_name>%d</http_user_name>\n"
" <http_user_passwd>%d</http_user_passwd>\n"
" <socks5_user_name>%d</socks5_user_name>\n"
" <socks5_user_passwd>%d</socks5_user_passwd>\n"
" <http_user_name>%s</http_user_name>\n"
" <http_user_passwd>%s</http_user_passwd>\n"
" <socks_server_name>%s</socks_server_name>\n"
" <socks_server_port>%d</socks_server_port>\n"
" <socks5_user_name>%s</socks5_user_name>\n"
" <socks5_user_passwd>%s</socks5_user_passwd>\n"
" </proxy_info>\n"
"</set_proxy_settings>\n",
pi.use_http_proxy?" <use_http_proxy/>\n":"",
pi.use_socks_proxy?" <use_socks_proxy/>\n":"",
pi.socks_server_name.c_str(),
pi.socks_server_port,
pi.http_server_name.c_str(),
pi.http_server_port,
pi.http_user_name.c_str(),
pi.http_user_passwd.c_str(),
pi.socks_server_name.c_str(),
pi.socks_server_port,
pi.socks5_user_name.c_str(),
pi.socks5_user_passwd.c_str()
);