commit 94c3f4f7c63eecd3ba161da4897fb7e9ca7e6b6a Author: Tomás Touceda chiiph@torproject.org Date: Sat Jun 9 13:04:06 2012 -0300
Improve handling of ControlPort and SocksPort settings --- src/vidalia/config/AdvancedPage.cpp | 3 ++- src/vidalia/config/TorSettings.cpp | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/vidalia/config/AdvancedPage.cpp b/src/vidalia/config/AdvancedPage.cpp index 0c538c7..51214a4 100644 --- a/src/vidalia/config/AdvancedPage.cpp +++ b/src/vidalia/config/AdvancedPage.cpp @@ -458,7 +458,8 @@ AdvancedPage::toggleAuto(bool) ui.lineControlAddress->setVisible(!ui.chkAuto->isChecked()); ui.label->setVisible(!ui.chkAuto->isChecked()); ui.lineControlPort->setVisible(!ui.chkAuto->isChecked()); - ui.lineControlPort->setText("9051"); + if (ui.lineControlPort->text() == "0") + ui.lineControlPort->setText("9051"); }
void diff --git a/src/vidalia/config/TorSettings.cpp b/src/vidalia/config/TorSettings.cpp index bf9d48e..df56b12 100644 --- a/src/vidalia/config/TorSettings.cpp +++ b/src/vidalia/config/TorSettings.cpp @@ -108,12 +108,9 @@ TorSettings::apply(QString *errmsg) { Torrc *torrc = Vidalia::torrc();
- torrc->clear(QStringList() - << TOR_ARG_SOCKSPORT - << SETTING_CONTROL_PORT); - torrc->setValue(SETTING_DATA_DIRECTORY, volatileValue(SETTING_DATA_DIRECTORY).toString());
+ torrc->clear(QStringList() << SETTING_SOCKS_PORT); if(volatileValue(SETTING_AUTOCONTROL).toBool()) { torrc->setValue(SETTING_CONTROL_PORT, "auto"); torrc->setValue(SETTING_SOCKS_PORT, "auto"); @@ -121,14 +118,23 @@ TorSettings::apply(QString *errmsg) } else { QString socks = volatileValue(SETTING_SOCKS_PORT).toString(); QString control = volatileValue(SETTING_CONTROL_PORT).toString(); + + if (socks == "0") + socks = "9050"; + { - with_torrc_value(SETTING_SOCKS_PORT) - socks = ret.at(0); + with_torrc_value(SETTING_SOCKS_PORT) { + if (ret.at(0) != "auto") + socks = ret.at(0); + } } { - with_torrc_value(SETTING_CONTROL_PORT) - control = ret.at(0); + with_torrc_value(SETTING_CONTROL_PORT) { + if (ret.at(0) != "auto") + control = ret.at(0); + } } + torrc->setValue(SETTING_SOCKS_PORT, socks); torrc->setValue(SETTING_CONTROL_PORT, control); }
tor-commits@lists.torproject.org