[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [vidalia/alpha] Add a way to use +LOADCONF control command



commit f38fa3133b37d8614213ba93c9d5c0d52725c829
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Fri Feb 3 17:21:17 2012 -0300

    Add a way to use +LOADCONF control command
    
    It will be used to apply the new torrc settings
---
 src/torcontrol/TorControl.cpp |   11 +++++++++++
 src/torcontrol/TorControl.h   |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/torcontrol/TorControl.cpp b/src/torcontrol/TorControl.cpp
index e95f9c7..efa5dfc 100644
--- a/src/torcontrol/TorControl.cpp
+++ b/src/torcontrol/TorControl.cpp
@@ -893,6 +893,17 @@ TorControl::getConf(const QString &key, QString *errmsg)
   return map.value(key);
 }
 
+/** Loads the contents as if they were read from disk as the torrc */
+bool
+TorControl::loadConf(const QString &contents, QString *errmsg)
+{
+  ControlCommand cmd("+LOADCONF");
+  ControlReply reply;
+  
+  cmd.addArgument(contents + ".");
+  return send(cmd, reply, errmsg);
+}
+
 /** Sends a GETCONF message to Tor with the single key and returns a QString
  * containing the value returned by Tor */
 QString
diff --git a/src/torcontrol/TorControl.h b/src/torcontrol/TorControl.h
index c16758c..3541c86 100644
--- a/src/torcontrol/TorControl.h
+++ b/src/torcontrol/TorControl.h
@@ -157,6 +157,8 @@ public:
    * QVariant containing the value returned by Tor. Returns a default
    * constructed QVariant on failure. */
   QVariant getConf(const QString &key, QString *errmsg = 0);
+  /** Loads the contents as if they were read from disk as the torrc */
+  bool loadConf(const QString &contents, QString *errmsg = 0);
   /** Sends a GETCONF message to Tor with the single key and returns a QString
    * containing the value returned by Tor */
   QString getHiddenServiceConf(const QString &key, QString *errmsg = 0);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits