Ticket #8976: filezilla_svn6189_proxy_per_site_v2.patch
File filezilla_svn6189_proxy_per_site_v2.patch, 30.0 KB (added by , 10 years ago) |
---|
-
src/engine/ControlSocket.cpp
diff -Nur filezilla.orig/src/engine/ControlSocket.cpp filezilla/src/engine/ControlSocket.cpp
old new 1096 1096 { 1097 1097 wxString host; 1098 1098 unsigned int port = 0; 1099 int proxyType = 0; 1100 wxString proxyHost; 1101 unsigned int proxyPort; 1102 wxString proxyUser; 1103 wxString proxyPass; 1099 1104 1100 const int proxy_type = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE); 1101 if (proxy_type > CProxySocket::unknown && proxy_type < CProxySocket::proxytype_count && !m_pCurrentServer->GetBypassProxy()) { 1105 if (m_pCurrentServer->GetProxyType() > CProxySocket::unknown && 1106 m_pCurrentServer->GetProxyType() < CProxySocket::proxytype_count && 1107 m_pCurrentServer->GetProxyHost() != _T("")) { 1108 proxyType = m_pCurrentServer->GetProxyType(); 1109 proxyHost = m_pCurrentServer->GetProxyHost(); 1110 proxyPort = m_pCurrentServer->GetProxyPort(); 1111 proxyUser = m_pCurrentServer->GetProxyUser(); 1112 proxyPass = m_pCurrentServer->GetProxyPass(); 1113 } 1114 else if (!m_pCurrentServer->GetBypassProxy()) { 1115 proxyType = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE); 1116 proxyHost = m_pEngine->GetOptions().GetOption(OPTION_PROXY_HOST); 1117 proxyPort = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_PORT); 1118 proxyUser = m_pEngine->GetOptions().GetOption(OPTION_PROXY_USER); 1119 proxyPass = m_pEngine->GetOptions().GetOption(OPTION_PROXY_PASS); 1120 } 1121 if (proxyType > CProxySocket::unknown && proxyType < CProxySocket::proxytype_count) { 1102 1122 LogMessage(MessageType::Status, _("Connecting to %s through proxy"), m_pCurrentServer->FormatHost()); 1103 1123 1104 host = m_pEngine->GetOptions().GetOption(OPTION_PROXY_HOST);1105 port = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_PORT);1124 host = proxyHost; 1125 port = proxyPort; 1106 1126 1107 1127 delete m_pBackend; 1108 1128 m_pProxyBackend = new CProxySocket(this, m_pSocket, this); 1109 1129 m_pBackend = m_pProxyBackend; 1110 int res = m_pProxyBackend->Handshake((enum CProxySocket::ProxyType)proxy _type,1130 int res = m_pProxyBackend->Handshake((enum CProxySocket::ProxyType)proxyType, 1111 1131 m_pCurrentServer->GetHost(), m_pCurrentServer->GetPort(), 1112 m_pEngine->GetOptions().GetOption(OPTION_PROXY_USER),1113 m_pEngine->GetOptions().GetOption(OPTION_PROXY_PASS));1132 proxyUser, 1133 proxyPass); 1114 1134 1115 1135 if (res != EINPROGRESS) { 1116 1136 LogMessage(MessageType::Error, _("Could not start proxy handshake: %s"), CSocket::GetErrorDescription(res)); -
src/engine/ftpcontrolsocket.cpp
diff -Nur filezilla.orig/src/engine/ftpcontrolsocket.cpp filezilla/src/engine/ftpcontrolsocket.cpp
old new 4262 4262 4263 4263 // Do not use FTP proxy if generic proxy is set 4264 4264 int generic_proxy_type = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE); 4265 if ((generic_proxy_type <= CProxySocket::unknown || generic_proxy_type >= CProxySocket::proxytype_count) && 4265 if ((server.GetProxyType() <= CProxySocket::unknown || server.GetProxyType() >= CProxySocket::proxytype_count || server.GetProxyHost() == _T("")) && 4266 (generic_proxy_type <= CProxySocket::unknown || generic_proxy_type >= CProxySocket::proxytype_count) && 4266 4267 (pData->ftp_proxy_type = m_pEngine->GetOptions().GetOptionVal(OPTION_FTP_PROXY_TYPE)) && !server.GetBypassProxy()) 4267 4268 { 4268 4269 pData->host = m_pEngine->GetOptions().GetOption(OPTION_FTP_PROXY_HOST); -
src/engine/server.cpp
diff -Nur filezilla.orig/src/engine/server.cpp filezilla/src/engine/server.cpp
old new 286 286 m_timezoneOffset = op.m_timezoneOffset; 287 287 m_pasvMode = op.m_pasvMode; 288 288 m_maximumMultipleConnections = op.m_maximumMultipleConnections; 289 m_proxyType = op.m_proxyType; 290 m_proxyHost = op.m_proxyHost; 291 m_proxyPort = op.m_proxyPort; 292 m_proxyUser = op.m_proxyUser; 293 m_proxyPass = op.m_proxyPass; 289 294 m_encodingType = op.m_encodingType; 290 295 m_customEncoding = op.m_customEncoding; 291 296 m_postLoginCommands = op.m_postLoginCommands; … … 329 334 return false; 330 335 else if (m_pasvMode != op.m_pasvMode) 331 336 return false; 337 else if (m_proxyType != op.m_proxyType) 338 return false; 339 else if (m_proxyHost != op.m_proxyHost) 340 return false; 341 else if (m_proxyPort != op.m_proxyPort) 342 return false; 343 else if (m_proxyUser != op.m_proxyUser) 344 return false; 345 else if (m_proxyPass != op.m_proxyPass) 346 return false; 332 347 else if (m_encodingType != op.m_encodingType) 333 348 return false; 334 349 else if (m_encodingType == ENCODING_CUSTOM) … … 415 430 else if (m_pasvMode > op.m_pasvMode) 416 431 return false; 417 432 433 if (m_proxyType < op.m_proxyType) 434 return true; 435 else if (m_proxyType > op.m_proxyType) 436 return false; 437 if (m_proxyHost < op.m_proxyHost) 438 return true; 439 else if (m_proxyHost > op.m_proxyHost) 440 return false; 441 if (m_proxyPort < op.m_proxyPort) 442 return true; 443 else if (m_proxyPort > op.m_proxyPort) 444 return false; 445 if (m_proxyUser < op.m_proxyUser) 446 return true; 447 else if (m_proxyUser > op.m_proxyUser) 448 return false; 449 if (m_proxyPass < op.m_proxyPass) 450 return true; 451 else if (m_proxyPass > op.m_proxyPass) 452 return false; 453 418 454 if (m_encodingType < op.m_encodingType) 419 455 return true; 420 456 else if (m_encodingType > op.m_encodingType) … … 468 504 return false; 469 505 else if (m_pasvMode != op.m_pasvMode) 470 506 return false; 507 else if (m_proxyType != op.m_proxyType) 508 return false; 509 else if (m_proxyHost != op.m_proxyHost) 510 return false; 511 else if (m_proxyPort != op.m_proxyPort) 512 return false; 513 else if (m_proxyUser != op.m_proxyUser) 514 return false; 515 else if (m_proxyPass != op.m_proxyPass) 516 return false; 471 517 else if (m_encodingType != op.m_encodingType) 472 518 return false; 473 519 else if (m_encodingType == ENCODING_CUSTOM) { … … 612 658 return m_maximumMultipleConnections; 613 659 } 614 660 661 int CServer::GetProxyType() const 662 { 663 return m_proxyType; 664 } 665 666 void CServer::SetProxyType(int type) 667 { 668 m_proxyType = type; 669 } 670 671 wxString CServer::GetProxyHost() const 672 { 673 return m_proxyHost; 674 } 675 676 bool CServer::SetProxyHost(wxString host) 677 { 678 m_proxyHost = host; 679 return true; 680 } 681 682 unsigned int CServer::GetProxyPort() const 683 { 684 return m_proxyPort; 685 } 686 687 bool CServer::SetProxyPort(unsigned int port) 688 { 689 if (port < 1 || port > 65535) 690 return false; 691 m_proxyPort = port; 692 return true; 693 } 694 695 wxString CServer::GetProxyUser() const 696 { 697 return m_proxyUser; 698 } 699 700 bool CServer::SetProxyUser(wxString user) 701 { 702 m_proxyUser = user; 703 return true; 704 } 705 706 wxString CServer::GetProxyPass() const 707 { 708 return m_proxyPass; 709 } 710 711 bool CServer::SetProxyPass(wxString pass) 712 { 713 m_proxyPass = pass; 714 return true; 715 } 716 615 717 wxString CServer::FormatHost(bool always_omit_port /*=false*/) const 616 718 { 617 719 wxString host = m_host; … … 660 762 m_timezoneOffset = 0; 661 763 m_pasvMode = MODE_DEFAULT; 662 764 m_maximumMultipleConnections = 0; 765 m_proxyType = 0; 766 m_proxyHost = _T(""); 767 m_proxyPort = 8080; 768 m_proxyUser = _T(""); 769 m_proxyPass = _T(""); 663 770 m_encodingType = ENCODING_AUTO; 664 771 m_customEncoding.clear(); 665 772 m_bypassProxy = false; -
src/engine/sftpcontrolsocket.cpp
diff -Nur filezilla.orig/src/engine/sftpcontrolsocket.cpp filezilla/src/engine/sftpcontrolsocket.cpp
old new 448 448 switch (pData->opState) 449 449 { 450 450 case connect_init: 451 if (m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE) && !m_pCurrentServer->GetBypassProxy()) 451 if ((m_pCurrentServer->GetProxyType() && m_pCurrentServer->GetProxyHost() != _T("")) || 452 (m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE) && !m_pCurrentServer->GetBypassProxy())) 452 453 pData->opState = connect_proxy; 453 454 else if (pData->pKeyFiles) 454 455 pData->opState = connect_keys; … … 502 503 { 503 504 case connect_proxy: 504 505 { 506 int proxyType; 507 wxString proxyHost; 508 unsigned int proxyPort; 509 wxString proxyUser; 510 wxString proxyPass; 511 512 if (m_pCurrentServer->GetProxyType() && m_pCurrentServer->GetProxyHost() != _T("")) { 513 proxyType = m_pCurrentServer->GetProxyType(); 514 proxyHost = m_pCurrentServer->GetProxyHost(); 515 proxyPort = m_pCurrentServer->GetProxyPort(); 516 proxyUser = m_pCurrentServer->GetProxyUser(); 517 proxyPass = m_pCurrentServer->GetProxyPass(); 518 } 519 else { 520 proxyType = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE); 521 proxyHost = m_pEngine->GetOptions().GetOption(OPTION_PROXY_HOST); 522 proxyPort = m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_PORT); 523 proxyUser = m_pEngine->GetOptions().GetOption(OPTION_PROXY_USER); 524 proxyPass = m_pEngine->GetOptions().GetOption(OPTION_PROXY_PASS); 525 } 526 505 527 int type; 506 528 switch (m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_TYPE)) 507 529 { … … 521 543 } 522 544 523 545 wxString cmd = wxString::Format(_T("proxy %d \"%s\" %d"), type, 524 m_pEngine->GetOptions().GetOption(OPTION_PROXY_HOST),525 m_pEngine->GetOptions().GetOptionVal(OPTION_PROXY_PORT));526 wxString user = m_pEngine->GetOptions().GetOption(OPTION_PROXY_USER);546 proxyHost.c_str(), 547 proxyPort); 548 wxString user = proxyUser; 527 549 if (!user.empty()) 528 550 cmd += _T(" \"") + user + _T("\""); 529 551 530 552 wxString show = cmd; 531 553 532 wxString pass = m_pEngine->GetOptions().GetOption(OPTION_PROXY_PASS);554 wxString pass = proxyPass; 533 555 if (!pass.empty()) 534 556 { 535 557 cmd += _T(" \"") + pass + _T("\""); -
src/include/server.h
diff -Nur filezilla.orig/src/include/server.h filezilla/src/include/server.h
old new 107 107 void SetPasvMode(PasvMode pasvMode); 108 108 void MaximumMultipleConnections(int maximum); 109 109 110 int GetProxyType() const; 111 void SetProxyType(int type); 112 wxString GetProxyHost() const; 113 bool SetProxyHost(wxString host); 114 unsigned int GetProxyPort() const; 115 bool SetProxyPort(unsigned int port); 116 wxString GetProxyUser() const; 117 bool SetProxyUser(wxString user); 118 wxString GetProxyPass() const; 119 bool SetProxyPass(wxString pass); 120 110 121 wxString FormatHost(bool always_omit_port = false) const; 111 122 wxString FormatServer(const bool always_include_prefix = false) const; 112 123 … … 158 169 int m_timezoneOffset; 159 170 PasvMode m_pasvMode; 160 171 int m_maximumMultipleConnections; 172 int m_proxyType; 173 wxString m_proxyHost; 174 unsigned int m_proxyPort; 175 wxString m_proxyUser; 176 wxString m_proxyPass; 161 177 CharsetEncoding m_encodingType; 162 178 wxString m_customEncoding; 163 179 wxString m_name; -
src/interface/queue_storage.cpp
diff -Nur filezilla.orig/src/interface/queue_storage.cpp filezilla/src/interface/queue_storage.cpp
old new 48 48 encoding, 49 49 bypass_proxy, 50 50 post_login_commands, 51 name 51 name, 52 proxy_type, 53 proxy_host, 54 proxy_port, 55 proxy_user, 56 proxy_pass 52 57 }; 53 58 } 54 59 … … 68 73 { _T("encoding"), text, 0 }, 69 74 { _T("bypass_proxy"), integer, 0 }, 70 75 { _T("post_login_commands"), text, 0 }, 71 { _T("name"), text, 0 } 76 { _T("name"), text, 0 }, 77 { _T("proxy_type"), integer, 0 }, 78 { _T("proxy_host"), text, 0 }, 79 { _T("proxy_port"), integer, 0 }, 80 { _T("proxy_user"), text, 0 }, 81 { _T("proxy_pass"), text, 0 } 72 82 }; 73 83 74 84 namespace file_table_column_names … … 295 305 if (sqlite3_exec(db_, "PRAGMA user_version", int_callback, &version, 0) != SQLITE_OK) 296 306 return false; 297 307 298 if (version < 1) 299 return sqlite3_exec(db_, "PRAGMA user_version = 1", 0, 0, 0) == SQLITE_OK; 308 if (version < 2) 309 { 310 if (sqlite3_exec(db_, "ALTER TABLE servers ADD COLUMN proxy_type integer", 0, 0, 0) != SQLITE_OK) 311 { 312 } 313 if (sqlite3_exec(db_, "ALTER TABLE servers ADD COLUMN proxy_host text", 0, 0, 0) != SQLITE_OK) 314 { 315 } 316 if (sqlite3_exec(db_, "ALTER TABLE servers ADD COLUMN proxy_port integer", 0, 0, 0) != SQLITE_OK) 317 { 318 } 319 if (sqlite3_exec(db_, "ALTER TABLE servers ADD COLUMN proxy_user text", 0, 0, 0) != SQLITE_OK) 320 { 321 } 322 if (sqlite3_exec(db_, "ALTER TABLE servers ADD COLUMN proxy_pass text", 0, 0, 0) != SQLITE_OK) 323 { 324 } 325 if (sqlite3_exec(db_, "UPDATE TABLE servers SET proxy_type = 0", 0, 0, 0) != SQLITE_OK) 326 { 327 } 328 return sqlite3_exec(db_, "PRAGMA user_version = 2", 0, 0, 0) == SQLITE_OK; 329 } 300 330 301 331 return true; 302 332 } … … 645 675 } 646 676 Bind(insertServerQuery_, server_table_column_names::max_connections, server.MaximumMultipleConnections()); 647 677 678 Bind(insertServerQuery_, server_table_column_names::proxy_type, static_cast<int>(server.GetProxyType())); 679 if (server.GetProxyType() == 0) 680 { 681 BindNull(insertServerQuery_, server_table_column_names::proxy_host); 682 BindNull(insertServerQuery_, server_table_column_names::proxy_port); 683 BindNull(insertServerQuery_, server_table_column_names::proxy_user); 684 BindNull(insertServerQuery_, server_table_column_names::proxy_pass); 685 } 686 else 687 { 688 Bind(insertServerQuery_, server_table_column_names::proxy_host, server.GetProxyHost()); 689 Bind(insertServerQuery_, server_table_column_names::proxy_port, static_cast<int>(server.GetProxyPort())); 690 Bind(insertServerQuery_, server_table_column_names::proxy_user, server.GetProxyUser()); 691 Bind(insertServerQuery_, server_table_column_names::proxy_pass, server.GetProxyPass()); 692 } 693 648 694 switch (server.GetEncodingType()) 649 695 { 650 696 default: … … 912 958 return INVALID_DATA; 913 959 server.MaximumMultipleConnections(maximumMultipleConnections); 914 960 961 int proxyType = GetColumnInt(selectServersQuery_, server_table_column_names::proxy_type); 962 server.SetProxyType(proxyType); 963 if (proxyType > 0) 964 { 965 wxString proxyHost = GetColumnText(selectServersQuery_, server_table_column_names::proxy_host); 966 if (!server.SetProxyHost(proxyHost)) 967 return INVALID_DATA; 968 int proxyPort = GetColumnInt(selectServersQuery_, server_table_column_names::proxy_port); 969 if (!server.SetProxyPort(proxyPort)) 970 return INVALID_DATA; 971 wxString proxyUser = GetColumnText(selectServersQuery_, server_table_column_names::proxy_user); 972 if (!server.SetProxyUser(proxyUser)) 973 return INVALID_DATA; 974 wxString proxyPass = GetColumnText(selectServersQuery_, server_table_column_names::proxy_pass); 975 if (!server.SetProxyPass(proxyPass)) 976 return INVALID_DATA; 977 } 978 915 979 wxString encodingType = GetColumnText(selectServersQuery_, server_table_column_names::encoding); 916 980 if (encodingType.empty() || encodingType == _T("Auto")) 917 981 server.SetEncodingType(ENCODING_AUTO); -
src/interface/resources/xrc/sitemanager.xrc
diff -Nur filezilla.orig/src/interface/resources/xrc/sitemanager.xrc filezilla/src/interface/resources/xrc/sitemanager.xrc
old new 445 445 </object> 446 446 </object> 447 447 <object class="notebookpage"> 448 <label>Generic proxy</label> 449 <object class="wxPanel"> 450 <object class="wxBoxSizer"> 451 <orient>wxVERTICAL</orient> 452 <object class="sizeritem"> 453 <object class="wxStaticBoxSizer"> 454 <label>Generic proxy</label> 455 <orient>wxHORIZONTAL</orient> 456 <object class="sizeritem"> 457 <object class="wxFlexGridSizer"> 458 <cols>1</cols> 459 <vgap>5</vgap> 460 <object class="sizeritem"> 461 <object class="wxStaticText"> 462 <label>Type of generic proxy:</label> 463 </object> 464 </object> 465 <object class="sizeritem"> 466 <object class="wxRadioButton" name="ID_PROXYTYPE_NONE"> 467 <label>&None</label> 468 </object> 469 </object> 470 <object class="sizeritem"> 471 <object class="wxRadioButton" name="ID_PROXYTYPE_HTTP"> 472 <label>&HTTP/1.1 using CONNECT method</label> 473 </object> 474 </object> 475 <object class="sizeritem"> 476 <object class="wxRadioButton" name="ID_PROXYTYPE_SOCKS4"> 477 <label>SOC&KS 4</label> 478 </object> 479 </object> 480 <object class="sizeritem"> 481 <object class="wxRadioButton" name="ID_PROXYTYPE_SOCKS5"> 482 <label>&SOCKS 5</label> 483 </object> 484 </object> 485 <object class="sizeritem"> 486 <object class="wxFlexGridSizer"> 487 <cols>2</cols> 488 <object class="sizeritem"> 489 <object class="wxStaticText"> 490 <label>P&roxy host:</label> 491 </object> 492 <flag>wxALIGN_CENTRE_VERTICAL</flag> 493 </object> 494 <object class="sizeritem"> 495 <object class="wxTextCtrl" name="ID_PROXY_HOST"/> 496 <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag> 497 </object> 498 <object class="sizeritem"> 499 <object class="wxStaticText"> 500 <label>Proxy &port:</label> 501 </object> 502 <flag>wxALIGN_CENTRE_VERTICAL</flag> 503 </object> 504 <object class="sizeritem"> 505 <object class="wxTextCtrl" name="ID_PROXY_PORT"> 506 <size>50,-1</size> 507 </object> 508 <flag>wxALIGN_CENTRE_VERTICAL</flag> 509 </object> 510 <object class="sizeritem"> 511 <object class="wxStaticText"> 512 <label>Proxy &user:</label> 513 </object> 514 <flag>wxALIGN_CENTRE_VERTICAL</flag> 515 </object> 516 <object class="sizeritem"> 517 <object class="wxTextCtrl" name="ID_PROXY_USER"/> 518 <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag> 519 </object> 520 <object class="sizeritem"> 521 <object class="wxStaticText"> 522 <label>Pro&xy password:</label> 523 </object> 524 <flag>wxALIGN_CENTRE_VERTICAL</flag> 525 </object> 526 <object class="sizeritem"> 527 <object class="wxTextCtrl" name="ID_PROXY_PASS"> 528 <style>wxTE_PASSWORD</style> 529 </object> 530 <flag>wxALIGN_CENTRE_VERTICAL|wxGROW</flag> 531 </object> 532 <vgap>5</vgap> 533 <hgap>5</hgap> 534 <growablecols>1</growablecols> 535 </object> 536 <flag>wxGROW</flag> 537 </object> 538 <growablecols>0</growablecols> 539 <object class="sizeritem"> 540 <object class="wxStaticText"> 541 <label>Note: Using a generic proxy forces passive mode on FTP connections.</label> 542 </object> 543 </object> 544 </object> 545 <option>1</option> 546 <flag>wxBOTTOM|wxLEFT|wxRIGHT|wxGROW</flag> 547 <border>5</border> 548 </object> 549 </object> 550 <option>1</option> 551 <flag>wxGROW</flag> 552 </object> 553 </object> 554 </object> 555 </object> 556 <object class="notebookpage"> 448 557 <label>Charset</label> 449 558 <object class="wxPanel"> 450 559 <object class="wxBoxSizer"> -
src/interface/sitemanager_dialog.cpp
diff -Nur filezilla.orig/src/interface/sitemanager_dialog.cpp filezilla/src/interface/sitemanager_dialog.cpp
old new 35 35 EVT_BUTTON(XRCID("ID_BROWSE"), CSiteManagerDialog::OnRemoteDirBrowse) 36 36 EVT_TREE_ITEM_ACTIVATED(XRCID("ID_SITETREE"), CSiteManagerDialog::OnItemActivated) 37 37 EVT_CHECKBOX(XRCID("ID_LIMITMULTIPLE"), CSiteManagerDialog::OnLimitMultipleConnectionsChanged) 38 EVT_RADIOBUTTON(XRCID("ID_PROXYTYPE_NONE"), CSiteManagerDialog::OnProxyChange) 39 EVT_RADIOBUTTON(XRCID("ID_PROXYTYPE_HTTP"), CSiteManagerDialog::OnProxyChange) 40 EVT_RADIOBUTTON(XRCID("ID_PROXYTYPE_SOCKS5"), CSiteManagerDialog::OnProxyChange) 41 EVT_RADIOBUTTON(XRCID("ID_PROXYTYPE_SOCKS4"), CSiteManagerDialog::OnProxyChange) 38 42 EVT_RADIOBUTTON(XRCID("ID_CHARSET_AUTO"), CSiteManagerDialog::OnCharsetChange) 39 43 EVT_RADIOBUTTON(XRCID("ID_CHARSET_UTF8"), CSiteManagerDialog::OnCharsetChange) 40 44 EVT_RADIOBUTTON(XRCID("ID_CHARSET_CUSTOM"), CSiteManagerDialog::OnCharsetChange) … … 417 421 XRCCTRL(*this, "ID_TRANSFERMODE_ACTIVE", wxRadioButton)->Update(); 418 422 XRCCTRL(*this, "ID_TRANSFERMODE_PASSIVE", wxRadioButton)->Update(); 419 423 424 XRCCTRL(*this, "ID_PROXYTYPE_NONE", wxRadioButton)->Update(); 425 XRCCTRL(*this, "ID_PROXYTYPE_HTTP", wxRadioButton)->Update(); 426 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS5", wxRadioButton)->Update(); 427 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS4", wxRadioButton)->Update(); 428 420 429 wxTreeItemId item = pTree->GetSelection(); 421 430 if (!item.IsOk()) 422 431 pTree->SafeSelectItem(m_ownSites); … … 1401 1410 else 1402 1411 server.m_server.MaximumMultipleConnections(0); 1403 1412 1413 if (XRCCTRL(*this, "ID_PROXYTYPE_HTTP", wxRadioButton)->GetValue()) 1414 server.m_server.SetProxyType(1); 1415 else if (XRCCTRL(*this, "ID_PROXYTYPE_SOCKS5", wxRadioButton)->GetValue()) 1416 server.m_server.SetProxyType(2); 1417 else if (XRCCTRL(*this, "ID_PROXYTYPE_SOCKS4", wxRadioButton)->GetValue()) 1418 server.m_server.SetProxyType(3); 1419 else 1420 server.m_server.SetProxyType(0); 1421 server.m_server.SetProxyHost(XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->GetValue()); 1422 unsigned long proxyPort; 1423 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->GetValue().ToULong(&proxyPort); 1424 server.m_server.SetProxyPort(proxyPort); 1425 server.m_server.SetProxyUser(XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->GetValue()); 1426 server.m_server.SetProxyPass(XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->GetValue()); 1427 1404 1428 if (XRCCTRL(*this, "ID_CHARSET_UTF8", wxRadioButton)->GetValue()) 1405 1429 server.m_server.SetEncodingType(ENCODING_UTF8); 1406 1430 else if (XRCCTRL(*this, "ID_CHARSET_CUSTOM", wxRadioButton)->GetValue()) … … 1649 1673 XRCCTRL(*this, "ID_MAXMULTIPLE", wxSpinCtrl)->SetValue(1); 1650 1674 } 1651 1675 1676 int type = site_data->m_server.GetProxyType(); 1677 if (type == 1) 1678 { 1679 XRCCTRL(*this, "ID_PROXYTYPE_HTTP", wxRadioButton)->SetValue(true); 1680 XRCCTRL(*this, "ID_BYPASSPROXY", wxCheckBox)->Enable(false); 1681 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->Enable(true); 1682 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->Enable(true); 1683 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->Enable(true); 1684 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->Enable(true); 1685 } 1686 else if (type == 2) 1687 { 1688 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS5", wxRadioButton)->SetValue(true); 1689 XRCCTRL(*this, "ID_BYPASSPROXY", wxCheckBox)->Enable(false); 1690 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->Enable(true); 1691 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->Enable(true); 1692 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->Enable(true); 1693 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->Enable(true); 1694 } 1695 else if (type == 3) 1696 { 1697 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS4", wxRadioButton)->SetValue(true); 1698 XRCCTRL(*this, "ID_BYPASSPROXY", wxCheckBox)->Enable(false); 1699 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->Enable(true); 1700 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->Enable(true); 1701 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->Enable(false); 1702 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->Enable(false); 1703 } 1704 else 1705 { 1706 XRCCTRL(*this, "ID_PROXYTYPE_NONE", wxRadioButton)->SetValue(true); 1707 XRCCTRL(*this, "ID_BYPASSPROXY", wxCheckBox)->Enable(true); 1708 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->Enable(false); 1709 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->Enable(false); 1710 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->Enable(false); 1711 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->Enable(false); 1712 } 1713 XRCCTRL(*this, "ID_PROXYTYPE_HTTP", wxWindow)->Enable(!predefined); 1714 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS5", wxWindow)->Enable(!predefined); 1715 XRCCTRL(*this, "ID_PROXYTYPE_SOCKS4", wxWindow)->Enable(!predefined); 1716 XRCCTRL(*this, "ID_PROXYTYPE_NONE", wxWindow)->Enable(!predefined); 1717 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->SetValue(site_data->m_server.GetProxyHost()); 1718 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), (unsigned int)site_data->m_server.GetProxyPort())); 1719 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->SetValue(site_data->m_server.GetProxyUser()); 1720 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->SetValue(site_data->m_server.GetProxyPass()); 1721 1652 1722 switch (site_data->m_server.GetEncodingType()) 1653 1723 { 1654 1724 default: … … 1715 1785 XRCCTRL(*this, "ID_ENCODING", wxTextCtrl)->Enable(checked); 1716 1786 } 1717 1787 1788 void CSiteManagerDialog::OnProxyChange(wxCommandEvent& event) 1789 { 1790 bool enabled = XRCCTRL(*this, "ID_PROXYTYPE_NONE", wxRadioButton)->GetValue() == 0; 1791 bool enabled_auth = XRCCTRL(*this, "ID_PROXYTYPE_SOCKS4", wxRadioButton)->GetValue() == 0; 1792 1793 XRCCTRL(*this, "ID_BYPASSPROXY", wxCheckBox)->Enable(!enabled); 1794 XRCCTRL(*this, "ID_PROXY_HOST", wxTextCtrl)->Enable(enabled); 1795 XRCCTRL(*this, "ID_PROXY_PORT", wxTextCtrl)->Enable(enabled); 1796 XRCCTRL(*this, "ID_PROXY_USER", wxTextCtrl)->Enable(enabled && enabled_auth); 1797 XRCCTRL(*this, "ID_PROXY_PASS", wxTextCtrl)->Enable(enabled && enabled_auth); 1798 } 1799 1718 1800 void CSiteManagerDialog::OnProtocolSelChanged(wxCommandEvent& event) 1719 1801 { 1720 1802 wxChoice* pProtocol = XRCCTRL(*this, "ID_PROTOCOL", wxChoice); -
src/interface/sitemanager_dialog.h
diff -Nur filezilla.orig/src/interface/sitemanager_dialog.h filezilla/src/interface/sitemanager_dialog.h
old new 80 80 void OnItemActivated(wxTreeEvent& event); 81 81 void OnLimitMultipleConnectionsChanged(wxCommandEvent& event); 82 82 void OnCharsetChange(wxCommandEvent& event); 83 void OnProxyChange(wxCommandEvent& event); 83 84 void OnProtocolSelChanged(wxCommandEvent& event); 84 85 void OnBeginDrag(wxTreeEvent& event); 85 86 void OnChar(wxKeyEvent& event); -
src/interface/xmlfunctions.cpp
diff -Nur filezilla.orig/src/interface/xmlfunctions.cpp filezilla/src/interface/xmlfunctions.cpp
old new 550 550 int maximumMultipleConnections = GetTextElementInt(node, "MaximumMultipleConnections"); 551 551 server.MaximumMultipleConnections(maximumMultipleConnections); 552 552 553 int proxyType = GetTextElementInt(node, "ProxyType"); 554 server.SetProxyType(proxyType); 555 wxString proxyHost = GetTextElement(node, "ProxyHost"); 556 server.SetProxyHost(proxyHost); 557 int proxyPort = GetTextElementInt(node, "ProxyPort"); 558 if (proxyPort < 1 || proxyPort > 65535) 559 proxyPort = 8080; 560 server.SetProxyPort(proxyPort); 561 wxString proxyUser = GetTextElement(node, "ProxyUser"); 562 server.SetProxyUser(proxyUser); 563 wxString proxyPass = GetTextElement(node, "ProxyPass"); 564 server.SetProxyPass(proxyPass); 565 553 566 wxString encodingType = GetTextElement(node, "EncodingType"); 554 567 if (encodingType == _T("Auto")) 555 568 server.SetEncodingType(ENCODING_AUTO); … … 645 658 } 646 659 AddTextElement(node, "MaximumMultipleConnections", server.MaximumMultipleConnections()); 647 660 661 AddTextElement(node, "ProxyType", server.GetProxyType()); 662 AddTextElement(node, "ProxyHost", server.GetProxyHost()); 663 AddTextElement(node, "ProxyPort", server.GetProxyPort()); 664 AddTextElement(node, "ProxyUser", server.GetProxyUser()); 665 AddTextElement(node, "ProxyPass", server.GetProxyPass()); 666 648 667 switch (server.GetEncodingType()) 649 668 { 650 669 case ENCODING_AUTO: