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

[vidalia-svn] r3480: Add methods for getting and setting WarnPlaintextPorts and R (vidalia/trunk/src/vidalia/config)



Author: edmanm
Date: 2009-01-30 00:20:24 -0500 (Fri, 30 Jan 2009)
New Revision: 3480

Modified:
   vidalia/trunk/src/vidalia/config/torsettings.cpp
   vidalia/trunk/src/vidalia/config/torsettings.h
Log:
Add methods for getting and setting WarnPlaintextPorts and
RejectPlaintextPorts.


Modified: vidalia/trunk/src/vidalia/config/torsettings.cpp
===================================================================
--- vidalia/trunk/src/vidalia/config/torsettings.cpp	2009-01-30 03:05:13 UTC (rev 3479)
+++ vidalia/trunk/src/vidalia/config/torsettings.cpp	2009-01-30 05:20:24 UTC (rev 3480)
@@ -38,6 +38,8 @@
 #define SETTING_AUTH_METHOD         "AuthenticationMethod"
 #define SETTING_CONTROL_PASSWORD    "ControlPassword"
 #define SETTING_USE_RANDOM_PASSWORD "UseRandomPassword"
+#define SETTING_WARN_PLAINTEXT_PORTS    "WarnPlaintextPorts"
+#define SETTING_REJECT_PLAINTEXT_PORTS  "RejectPlaintextPorts"
 
 /** Default to using hashed password authentication */
 #define DEFAULT_AUTH_METHOD     PasswordAuth
@@ -75,6 +77,9 @@
   setDefault(SETTING_DATA_DIRECTORY, "");
   setDefault(SETTING_CONTROL_PASSWORD, "");
   setDefault(SETTING_USE_RANDOM_PASSWORD, true);
+  setDefault(SETTING_WARN_PLAINTEXT_PORTS, QList<QVariant>() << 23 << 109 
+                                                             << 110 << 143);
+  setDefault(SETTING_REJECT_PLAINTEXT_PORTS, QList<QVariant>());
 }
 
 /** Applies any changes to Tor's control port or authentication settings. */
@@ -256,6 +261,60 @@
   setValue(SETTING_AUTH_METHOD, toString(method));
 }
 
+/** Returns the current list of ports that will cause Tor to issue a warning
+ * when the user tries to connect to one of them. */
+QList<quint16>
+TorSettings::getWarnPlaintextPorts() const
+{
+  QList<quint16> out;
+  QList<QVariant> ports;
+
+  ports = value(SETTING_WARN_PLAINTEXT_PORTS).toList();
+  foreach (QVariant port, ports) {
+    out << port.toUInt();
+  }
+  return out;
+}
+
+/** Sets the list of ports that will cause Tor to issue a warning when the
+ * user tries to connect to one of them. */
+void
+TorSettings::setWarnPlaintextPorts(const QList<quint16> &ports)
+{
+  QList<QVariant> warnList;
+  foreach (quint16 port, ports) {
+    warnList << QVariant(port);
+  }
+  setValue(SETTING_WARN_PLAINTEXT_PORTS, warnList);
+}
+
+/** Returns the current list of ports that will cause Tor to reject the
+ * connection when the user tries to connect to one of them. */
+QList<quint16>
+TorSettings::getRejectPlaintextPorts() const
+{
+  QList<quint16> out;
+  QList<QVariant> ports;
+
+  ports = value(SETTING_REJECT_PLAINTEXT_PORTS).toList();
+  foreach (QVariant port, ports) {
+    out << port.toUInt();
+  }
+  return out;
+}
+
+/** Sets the list of ports that will cause Tor to reject the connection
+ * when the user tries to connect to one of them. */
+void
+TorSettings::setRejectPlaintextPorts(const QList<quint16> &ports)
+{
+  QList<QVariant> rejectList;
+  foreach (quint16 port, ports) {
+    rejectList << QVariant(port);
+  }
+  setValue(SETTING_REJECT_PLAINTEXT_PORTS, rejectList);
+}
+
 /** Returns the string description of the authentication method specified by
  * <b>method</b>. The authentication method string is stored in Vidalia's
  * configuration file. */

Modified: vidalia/trunk/src/vidalia/config/torsettings.h
===================================================================
--- vidalia/trunk/src/vidalia/config/torsettings.h	2009-01-30 03:05:13 UTC (rev 3479)
+++ vidalia/trunk/src/vidalia/config/torsettings.h	2009-01-30 05:20:24 UTC (rev 3480)
@@ -86,6 +86,20 @@
   /** Sets the authentication method used when starting Tor to <b>method</b>.*/
   void setAuthenticationMethod(AuthenticationMethod method);
 
+  /** Returns the current list of ports that will cause Tor to issue a warning
+   * when the user tries to connect to one of them. */
+  QList<quint16> getWarnPlaintextPorts() const;
+  /** Sets the list of ports that will cause Tor to issue a warning when the
+   * user tries to connect to one of them. */
+  void setWarnPlaintextPorts(const QList<quint16> &ports);
+
+  /** Returns the current list of ports that will cause Tor to reject the
+   * connection when the user tries to connect to one of them. */
+  QList<quint16> getRejectPlaintextPorts() const;
+  /** Sets the list of ports that will cause Tor to reject the connection
+   * when the user tries to connect to one of them. */
+  void setRejectPlaintextPorts(const QList<quint16> &ports);
+
   /** Generates a random control password consisting of PASSWORD_LEN
    * characters. */
   static QString randomPassword();