[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/alpha] Add ExitNode handling in TorSettings
commit 1aaa15bb51c608518c022ae1b9ad8d1f7343a75c
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date: Sat Jun 9 13:02:09 2012 -0300
Add ExitNode handling in TorSettings
Even if we are not using this in the AdvancedPage, we need to set the
volatileValue.
---
src/vidalia/config/AdvancedPage.cpp | 3 +++
src/vidalia/config/TorSettings.cpp | 28 ++++++++++++++++++++++++++++
src/vidalia/config/TorSettings.h | 5 +++++
3 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/src/vidalia/config/AdvancedPage.cpp b/src/vidalia/config/AdvancedPage.cpp
index 8e617fd..0c538c7 100644
--- a/src/vidalia/config/AdvancedPage.cpp
+++ b/src/vidalia/config/AdvancedPage.cpp
@@ -269,6 +269,9 @@ AdvancedPage::load()
ui.chkEnablePanic->setChecked(settings.allowPanic());
ui.linePanicPath->setText(settings.panicPath());
+
+ /** We need to keep the ExitNodes settings, even if we don't use it here */
+ _settings->setExitNodes(_settings->exitNodes());
}
/** Called when the user selects a different authentication method from the
diff --git a/src/vidalia/config/TorSettings.cpp b/src/vidalia/config/TorSettings.cpp
index b7da39a..bf9d48e 100644
--- a/src/vidalia/config/TorSettings.cpp
+++ b/src/vidalia/config/TorSettings.cpp
@@ -48,6 +48,7 @@
#define SETTING_BOOTSTRAP_FROM "BootstrapFrom"
#define SETTING_AUTOCONTROL "AutoControl"
#define SETTING_DISABLE_NETWORK "DisableNetwork"
+#define SETTING_EXITNODES "ExitNodes"
/** Default to using hashed password authentication */
#define DEFAULT_AUTH_METHOD PasswordAuth
@@ -161,6 +162,14 @@ TorSettings::apply(QString *errmsg)
torrc->setValue(SETTING_DISABLE_NETWORK,
volatileValue(SETTING_DISABLE_NETWORK).toBool() ? "1" : "0");
+ QString exitNodes = volatileValue(SETTING_EXITNODES).toString();
+
+ if (exitNodes.isEmpty()) {
+ torrc->clear(QStringList() << SETTING_EXITNODES);
+ } else {
+ torrc->setValue(SETTING_EXITNODES, exitNodes);
+ }
+
return torrc->apply(Vidalia::torControl(), errmsg);
}
@@ -572,3 +581,22 @@ TorSettings::setAutoControlPort(const bool autoControl)
{
setVolatileValue(SETTING_AUTOCONTROL, autoControl);
}
+
+
+/** Returns the selected exit nodes */
+QStringList
+TorSettings::exitNodes() const
+{
+ QStringList exitNodes;
+ with_torrc_value(SETTING_EXITNODES) {
+ exitNodes = ret.at(0).split(",");
+ }
+ return exitNodes;
+}
+
+/** Sets the exit nodes to the specified list */
+void
+TorSettings::setExitNodes(const QStringList &exitNodes)
+{
+ setVolatileValue(SETTING_EXITNODES, exitNodes.join(","));
+}
diff --git a/src/vidalia/config/TorSettings.h b/src/vidalia/config/TorSettings.h
index 6feabe7..a8c6e06 100644
--- a/src/vidalia/config/TorSettings.h
+++ b/src/vidalia/config/TorSettings.h
@@ -149,6 +149,11 @@ public:
/** Sets the location of the bootstrap torrc file */
void setBootstrapFrom(const QString &from);
+ /** Returns the selected exit nodes */
+ QStringList exitNodes() const;
+ /** Sets the exit nodes to the specified list */
+ void setExitNodes(const QStringList &exitNodes);
+
private:
/** Returns the AuthenticationMethod enum value for the string
* description of the authentication method given in <b>authMethod</b>. */
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits