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

[vidalia-svn] r3459: Add a method for getting the unparsed text for a router desc (vidalia/branches/marble/src/torcontrol)



Author: edmanm
Date: 2009-01-19 01:44:56 -0500 (Mon, 19 Jan 2009)
New Revision: 3459

Modified:
   vidalia/branches/marble/src/torcontrol/torcontrol.cpp
   vidalia/branches/marble/src/torcontrol/torcontrol.h
Log:

Add a method for getting the unparsed text for a router descriptor.


Modified: vidalia/branches/marble/src/torcontrol/torcontrol.cpp
===================================================================
--- vidalia/branches/marble/src/torcontrol/torcontrol.cpp	2009-01-19 06:43:09 UTC (rev 3458)
+++ vidalia/branches/marble/src/torcontrol/torcontrol.cpp	2009-01-19 06:44:56 UTC (rev 3459)
@@ -879,14 +879,23 @@
   return resetConf(QStringList() << key, errmsg);
 }
 
+/** Returns an unparsed router descriptor for the router whose fingerprint
+ * matches <b>id</b>. The returned text can later be parsed by the
+ * RouterDescriptor class. If <b>id</b> is invalid, then an empty
+ * QStringList is returned. */
+QStringList
+TorControl::getRouterDescriptorText(const QString &id, QString *errmsg)
+{
+  return getInfo("desc/id/" + id, errmsg).toStringList();
+}
+
 /** Returns the descriptor for the router whose fingerprint matches
  * <b>id</b>. If <b>id</b> is invalid or the router's descriptor cannot
  * be parsed, then an invalid RouterDescriptor is returned. */
 RouterDescriptor
 TorControl::getRouterDescriptor(const QString &id, QString *errmsg)
 {
-  QStringList descriptor = getInfo("desc/id/" + id, errmsg).toStringList();
-  return RouterDescriptor(descriptor);
+  return RouterDescriptor(getRouterDescriptorText(id, errmsg));
 }
 
 /** Returns the status of the router whose fingerprint matches <b>id</b>. If

Modified: vidalia/branches/marble/src/torcontrol/torcontrol.h
===================================================================
--- vidalia/branches/marble/src/torcontrol/torcontrol.h	2009-01-19 06:43:09 UTC (rev 3458)
+++ vidalia/branches/marble/src/torcontrol/torcontrol.h	2009-01-19 06:44:56 UTC (rev 3459)
@@ -165,6 +165,11 @@
   /** Tells Tor to reset a configuration key back to its default value. */
   bool resetConf(QString key, QString *errmsg = 0);
 
+  /** Returns an unparsed router descriptor for the router whose fingerprint
+   * matches <b>id</b>. The returned text can later be parsed by the
+   * RouterDescriptor class. If <b>id</b> is invalid, then an empty
+   * QStringList is returned. */
+  QStringList getRouterDescriptorText(const QString &id, QString *errmsg = 0);
   /** Returns the descriptor for the router whose fingerprint matches
    * <b>id</b>. If <b>id</b> is invalid or the router's descriptor cannot be
    * parsed, then an invalid RouterDescriptor is returned. */