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

[tor-commits] [vidalia/alpha] Add the possibility to consult the ControlReply after a SETCONF



commit 03a56b386626b056fe808021fc3f89bc62d9fc8c
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Fri Feb 3 17:25:50 2012 -0300

    Add the possibility to consult the ControlReply after a SETCONF
    
    This will be used to identify when an error occurs with SETCONF, whether it
    is a 553 error or any other kind. If it's a 553, then the option is not
    wrong but tor can't apply that change while it is running. Otherwise, it's
    an error in the option and it should be treated as such.
---
 src/torcontrol/TorControl.cpp |   15 +++++++++------
 src/torcontrol/TorControl.h   |    6 +++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/torcontrol/TorControl.cpp b/src/torcontrol/TorControl.cpp
index efa5dfc..77cd567 100644
--- a/src/torcontrol/TorControl.cpp
+++ b/src/torcontrol/TorControl.cpp
@@ -719,7 +719,7 @@ TorControl::setEvents(QString *errmsg)
 /** Sets each configuration key in <b>map</b> to the value associated
  * with its key. */
 bool
-TorControl::setConf(QHash<QString,QString> map, QString *errmsg)
+TorControl::setConf(QHash<QString,QString> map, QString *errmsg, ControlReply *reply)
 {
   ControlCommand cmd("SETCONF");
 
@@ -739,25 +739,28 @@ TorControl::setConf(QHash<QString,QString> map, QString *errmsg)
         cmd.addArgument(key);
     }
   }
-  return send(cmd, errmsg);
+
+  if(not reply)
+    reply = new ControlReply();
+  return send(cmd, *reply, errmsg);
 }
 
 /** Sets a single configuration key to the given value. */
 bool
-TorControl::setConf(QString key, QString value, QString *errmsg)
+TorControl::setConf(QString key, QString value, QString *errmsg, ControlReply *reply)
 {
   QHash<QString,QString> map;
   map.insert(key, value);
-  return setConf(map, errmsg);
+  return setConf(map, errmsg, reply);
 }
 
 /** Sets a single configuration string that is formatted <key=escaped value>.*/
 bool
-TorControl::setConf(QString keyAndValue, QString *errmsg)
+TorControl::setConf(QString keyAndValue, QString *errmsg, ControlReply *reply)
 {
   QHash<QString,QString> map;
   map.insert(keyAndValue, "");
-  return setConf(map, errmsg);
+  return setConf(map, errmsg, reply);
 }
 
 /** Gets values for a set of configuration keys, each of which has a single
diff --git a/src/torcontrol/TorControl.h b/src/torcontrol/TorControl.h
index 3541c86..6a58b71 100644
--- a/src/torcontrol/TorControl.h
+++ b/src/torcontrol/TorControl.h
@@ -134,11 +134,11 @@ public:
   bool setEvents(QString *errmsg = 0);
 
   /** Sets each configuration key in <b>map</b> to the value associated with its key. */
-  bool setConf(QHash<QString,QString> map, QString *errmsg = 0);
+  bool setConf(QHash<QString,QString> map, QString *errmsg = 0, ControlReply *reply = 0);
   /** Sets a single configuration key to the given value. */
-  bool setConf(QString key, QString value, QString *errmsg = 0);
+  bool setConf(QString key, QString value, QString *errmsg = 0, ControlReply *reply = 0);
   /** Sets a single configuration string that is formatted <key=escaped value>. */
-  bool setConf(QString keyAndValue, QString *errmsg = 0);
+  bool setConf(QString keyAndValue, QString *errmsg = 0, ControlReply *reply = 0);
   /** Gets values for a set of configuration keys, each of which has a single
    * value. */
   bool getConf(QHash<QString,QString> &map, QString *errmsg = 0);



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