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

[vidalia-svn] r2626: Finally some functionality: text box to enter strict entry n (vidalia/branches/exit-country/src/vidalia/config)



Author: cviecco
Date: 2008-05-30 13:34:03 -0400 (Fri, 30 May 2008)
New Revision: 2626

Modified:
   vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp
   vidalia/branches/exit-country/src/vidalia/config/networkoutpage.h
   vidalia/branches/exit-country/src/vidalia/config/networkoutpage.ui
   vidalia/branches/exit-country/src/vidalia/config/networksettings.cpp
   vidalia/branches/exit-country/src/vidalia/config/networksettings.h
Log:
Finally some functionality: text box to enter strict entry node list, works ok against 0.2.1.0-alpha-dev (r14827).

networkoutpage.ui -> fixed class used (was using original class), added checkbox and textentry.
networksettings.h, networksettings.cpp ->
         Added two function families: use node policy and get/set exitnodes
networkoutpage.h -> fixed class used (was using original class). Added functionality
         to handle the ui changes.


Modified: vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp	2008-05-30 12:10:49 UTC (rev 2625)
+++ vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp	2008-05-30 17:34:03 UTC (rev 2626)
@@ -16,11 +16,13 @@
 
 #include <vidalia.h>
 #include "networkoutpage.h"
+#include <networksettings.h>
 
 
+
 /** Default Constructor */
 NetworkoutPage::NetworkoutPage(QWidget *parent)
-: ConfigPage(parent, tr("Appearance"))
+: ConfigPage(parent, tr("Networkout"))
 {
   /* Invoke Designer-generated object setup routine */
   ui.setupUi(this);
@@ -48,6 +50,8 @@
 bool
 NetworkoutPage::save(QString &errmsg)
 {
+  NetworkSettings settings(Vidalia::torControl());
+
   Q_UNUSED(errmsg);
   QString languageCode =
     LanguageSupport::languageCode(ui.cmboLanguage->currentText());
@@ -57,6 +61,12 @@
  
   /* Set to new style */
   Vidalia::setStyle(ui.cmboStyle->currentText());
+
+ 
+  settings.setUseNodePolicy(ui.chkNodePolicy->isChecked());
+  /*Need to add validation?*/
+  settings.setExitNodeList(ui.lineEditExitNodes->text().split(",", QString::SkipEmptyParts) );    
+
   return true;
 }
   
@@ -64,10 +74,17 @@
 void
 NetworkoutPage::load()
 {
+  
+  NetworkSettings settings(Vidalia::torControl());
+
   int index = ui.cmboLanguage->findData(_settings->getLanguageCode());
   ui.cmboLanguage->setCurrentIndex(index);
   
   index = ui.cmboStyle->findData(Vidalia::style().toLower());
   ui.cmboStyle->setCurrentIndex(index);
+  
+  QStringList exit_nodes = settings.getExitNodeList();
+  ui.lineEditExitNodes->setText(exit_nodes.join(","));
+
 }
 

Modified: vidalia/branches/exit-country/src/vidalia/config/networkoutpage.h
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networkoutpage.h	2008-05-30 12:10:49 UTC (rev 2625)
+++ vidalia/branches/exit-country/src/vidalia/config/networkoutpage.h	2008-05-30 17:34:03 UTC (rev 2626)
@@ -24,7 +24,7 @@
 #include <languagesupport.h>
 
 #include "configpage.h"
-#include "ui_appearancepage.h"
+#include "ui_networkoutpage.h"
 
 class NetworkoutPage : public ConfigPage
 {
@@ -40,12 +40,13 @@
   /** Loads the settings for this page */
   void load();
   
+  
 private:
   /** A VidaliaSettings object used for saving/loading settings */
   VidaliaSettings* _settings;
 
   /** Qt Designer generated object */
-  Ui::AppearancePage ui;
+  Ui::NetworkoutPage ui;
 };
 
 #endif

Modified: vidalia/branches/exit-country/src/vidalia/config/networkoutpage.ui
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networkoutpage.ui	2008-05-30 12:10:49 UTC (rev 2625)
+++ vidalia/branches/exit-country/src/vidalia/config/networkoutpage.ui	2008-05-30 17:34:03 UTC (rev 2626)
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>NetworkoutPage</class>
  <widget class="QWidget" name="AppearancePage" >
   <property name="geometry" >
@@ -15,148 +12,211 @@
   <property name="contextMenuPolicy" >
    <enum>Qt::NoContextMenu</enum>
   </property>
-  <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
+  <widget class="QGroupBox" name="grpLanguage" >
+   <property name="geometry" >
+    <rect>
+     <x>9</x>
+     <y>9</y>
+     <width>476</width>
+     <height>92</height>
+    </rect>
    </property>
-   <property name="spacing" >
-    <number>6</number>
+   <property name="contextMenuPolicy" >
+    <enum>Qt::NoContextMenu</enum>
    </property>
-   <item>
-    <widget class="QGroupBox" name="grpLanguage" >
-     <property name="contextMenuPolicy" >
-      <enum>Qt::NoContextMenu</enum>
-     </property>
-     <property name="title" >
-      <string>Language</string>
-     </property>
-     <layout class="QGridLayout" >
-      <property name="margin" >
-       <number>9</number>
+   <property name="title" >
+    <string>Language</string>
+   </property>
+   <layout class="QGridLayout" >
+    <property name="leftMargin" >
+     <number>9</number>
+    </property>
+    <property name="topMargin" >
+     <number>9</number>
+    </property>
+    <property name="rightMargin" >
+     <number>9</number>
+    </property>
+    <property name="bottomMargin" >
+     <number>9</number>
+    </property>
+    <property name="horizontalSpacing" >
+     <number>6</number>
+    </property>
+    <property name="verticalSpacing" >
+     <number>6</number>
+    </property>
+    <item row="1" column="0" >
+     <widget class="QComboBox" name="cmboLanguage" >
+      <property name="minimumSize" >
+       <size>
+        <width>150</width>
+        <height>0</height>
+       </size>
       </property>
-      <property name="spacing" >
-       <number>6</number>
+      <property name="contextMenuPolicy" >
+       <enum>Qt::NoContextMenu</enum>
       </property>
-      <item row="1" column="0" >
-       <widget class="QComboBox" name="cmboLanguage" >
-        <property name="minimumSize" >
-         <size>
-          <width>150</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="contextMenuPolicy" >
-         <enum>Qt::NoContextMenu</enum>
-        </property>
-        <property name="toolTip" >
-         <string>Choose the language used in Vidalia</string>
-        </property>
-        <property name="editable" >
-         <bool>false</bool>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>24</width>
-          <height>16</height>
-         </size>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1" >
-       <spacer>
-        <property name="orientation" >
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" >
-         <size>
-          <width>300</width>
-          <height>16</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="0" column="0" colspan="2" >
-       <widget class="QLabel" name="label" >
-        <property name="contextMenuPolicy" >
-         <enum>Qt::NoContextMenu</enum>
-        </property>
-        <property name="text" >
-         <string>Changes to language will only take effect after restarting Vidalia!</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="grpStyle" >
-     <property name="contextMenuPolicy" >
-      <enum>Qt::NoContextMenu</enum>
-     </property>
-     <property name="toolTip" >
-      <string/>
-     </property>
-     <property name="title" >
-      <string>Style</string>
-     </property>
-     <layout class="QGridLayout" >
-      <property name="margin" >
-       <number>9</number>
+      <property name="toolTip" >
+       <string>Choose the language used in Vidalia</string>
       </property>
-      <property name="spacing" >
-       <number>6</number>
+      <property name="editable" >
+       <bool>false</bool>
       </property>
-      <item row="0" column="1" >
-       <spacer>
-        <property name="orientation" >
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" >
-         <size>
-          <width>40</width>
-          <height>20</height>
-         </size>
-        </property>
-       </spacer>
-      </item>
-      <item row="0" column="0" >
-       <widget class="QComboBox" name="cmboStyle" >
-        <property name="minimumSize" >
-         <size>
-          <width>150</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="contextMenuPolicy" >
-         <enum>Qt::NoContextMenu</enum>
-        </property>
-        <property name="toolTip" >
-         <string>Choose Vidalia's interface style</string>
-        </property>
-        <property name="editable" >
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>476</width>
-       <height>161</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
+      <property name="iconSize" >
+       <size>
+        <width>24</width>
+        <height>16</height>
+       </size>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="1" >
+     <spacer>
+      <property name="orientation" >
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" >
+       <size>
+        <width>300</width>
+        <height>16</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item row="0" column="0" colspan="2" >
+     <widget class="QLabel" name="label" >
+      <property name="contextMenuPolicy" >
+       <enum>Qt::NoContextMenu</enum>
+      </property>
+      <property name="text" >
+       <string>Changes to language will only take effect after restarting Vidalia!</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QGroupBox" name="grpStyle" >
+   <property name="geometry" >
+    <rect>
+     <x>9</x>
+     <y>107</y>
+     <width>476</width>
+     <height>68</height>
+    </rect>
+   </property>
+   <property name="contextMenuPolicy" >
+    <enum>Qt::NoContextMenu</enum>
+   </property>
+   <property name="toolTip" >
+    <string/>
+   </property>
+   <property name="title" >
+    <string>Style</string>
+   </property>
+   <layout class="QGridLayout" >
+    <property name="leftMargin" >
+     <number>9</number>
+    </property>
+    <property name="topMargin" >
+     <number>9</number>
+    </property>
+    <property name="rightMargin" >
+     <number>9</number>
+    </property>
+    <property name="bottomMargin" >
+     <number>9</number>
+    </property>
+    <property name="horizontalSpacing" >
+     <number>6</number>
+    </property>
+    <property name="verticalSpacing" >
+     <number>6</number>
+    </property>
+    <item row="0" column="1" >
+     <spacer>
+      <property name="orientation" >
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" >
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item row="0" column="0" >
+     <widget class="QComboBox" name="cmboStyle" >
+      <property name="minimumSize" >
+       <size>
+        <width>150</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="contextMenuPolicy" >
+       <enum>Qt::NoContextMenu</enum>
+      </property>
+      <property name="toolTip" >
+       <string>Choose Vidalia's interface style</string>
+      </property>
+      <property name="editable" >
+       <bool>false</bool>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QCheckBox" name="chkNodePolicy" >
+   <property name="geometry" >
+    <rect>
+     <x>10</x>
+     <y>180</y>
+     <width>405</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <property name="text" >
+    <string>Enable Vidalia Node Policy Management (Will reduce your anonymity)</string>
+   </property>
+  </widget>
+  <widget class="QGroupBox" name="grpExitNodeSettings" >
+   <property name="geometry" >
+    <rect>
+     <x>10</x>
+     <y>200</y>
+     <width>471</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="title" >
+    <string>Exit Node Selection Policy</string>
+   </property>
+   <widget class="QLineEdit" name="lineEditExitNodes" >
+    <property name="geometry" >
+     <rect>
+      <x>90</x>
+      <y>30</y>
+      <width>361</width>
+      <height>27</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2" >
+    <property name="geometry" >
+     <rect>
+      <x>20</x>
+      <y>30</y>
+      <width>71</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text" >
+     <string>Exit Nodes</string>
+    </property>
+   </widget>
+  </widget>
  </widget>
- <pixmapfunction></pixmapfunction>
  <resources/>
  <connections/>
 </ui>

Modified: vidalia/branches/exit-country/src/vidalia/config/networksettings.cpp
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networksettings.cpp	2008-05-30 12:10:49 UTC (rev 2625)
+++ vidalia/branches/exit-country/src/vidalia/config/networksettings.cpp	2008-05-30 17:34:03 UTC (rev 2626)
@@ -29,6 +29,8 @@
 #define SETTING_UPDATE_BRIDGES      "UpdateBridgesFromAuthority"
 #define SETTING_TUNNEL_DIR_CONNS    "TunnelDirConns"
 #define SETTING_PREFER_TUNNELED_DIR_CONNS "PreferTunneledDirConns"
+#define SETTING_USE_NODE_POLICY      "UseNodePolicy"
+#define SETTING_EXIT_NODE_LIST       "ExitNode"
 
 
 /** Default constructor */
@@ -47,6 +49,9 @@
   setDefault(SETTING_TUNNEL_DIR_CONNS,  true);
   setDefault(SETTING_REACHABLE_ADDRESSES,
     QStringList() << "*:80" << "*:443");
+  setDefault(SETTING_USE_NODE_POLICY ,  false);
+  setDefault(SETTING_EXIT_NODE_LIST, 
+    QStringList() << "blutmagie" << "chaoscomputerclub23");
 }
 
 /** Applies the current network configuration settings to Tor. If
@@ -60,8 +65,14 @@
 
   conf.insert(SETTING_REACHABLE_ADDRESSES,
     (getFascistFirewall() ? 
-      localValue(SETTING_REACHABLE_ADDRESSES).toStringList().join(",") : ""));
-  
+      localValue(SETTING_REACHABLE_ADDRESSES).toStringList().join(",") : "")); 
+ 
+  if(getUseNodePolicy()){
+    conf.insert(SETTING_EXIT_NODE_LIST,
+        localValue(SETTING_EXIT_NODE_LIST).toStringList().join(","));
+    conf.insert("StrictExitNodes","1");
+  }
+
   conf.insert(SETTING_HTTP_PROXY,
     (getUseHttpProxy() ? localValue(SETTING_HTTP_PROXY).toString() : ""));
   conf.insert(SETTING_HTTP_PROXY_AUTH,
@@ -99,6 +110,9 @@
       conf.insert(SETTING_UPDATE_BRIDGES, "0");
     }
   }
+  
+
+
   return torControl()->setConf(conf, errmsg);
 }
 
@@ -295,3 +309,33 @@
   return value(SETTING_TUNNEL_DIR_CONNS).toBool();
 }
 
+
+/** Returns true if Tor should use network policies for its nodes
+ * network. */
+bool 
+NetworkSettings::getUseNodePolicy(){
+  return value(SETTING_USE_NODE_POLICY).toBool();
+}
+
+/** Sets to <b>useNodePolicy</b> whether Tor should try
+ to use node policies to access the newtowk. */
+void 
+NetworkSettings::setUseNodePolicy(bool useNodePolicy){
+  setValue(SETTING_USE_NODE_POLICY, useNodePolicy);
+}
+
+/** Returns a list of bridge nodes Tor should use. */
+QStringList
+NetworkSettings::getExitNodeList()
+{
+  return value(SETTING_EXIT_NODE_LIST).toStringList();
+}
+
+/** Sets to <b>bridgeList</b> the list of bridge nodes Tor should use. */
+void
+NetworkSettings::setExitNodeList(const QStringList &exitNodeList)
+{
+  setValue(SETTING_EXIT_NODE_LIST, exitNodeList);
+}
+
+

Modified: vidalia/branches/exit-country/src/vidalia/config/networksettings.h
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networksettings.h	2008-05-30 12:10:49 UTC (rev 2625)
+++ vidalia/branches/exit-country/src/vidalia/config/networksettings.h	2008-05-30 17:34:03 UTC (rev 2626)
@@ -113,6 +113,20 @@
   /** Returns true if Tor is configured to try to tunnel its directory
    * connections through a one-hop circuit. */
   bool getTunnelDirConns();
+
+  /** Returns true if Tor should use network policies for its nodes
+   * network. */
+  bool getUseNodePolicy();
+  /** Sets to <b>useNodePolicy</b> whether Tor should try
+   to use node policies to access the newtowk. */
+  void setUseNodePolicy(bool useNodePolicy);
+
+
+  /** Returns a list of bridge nodes Tor should use. */
+  QStringList getExitNodeList();
+  /** Sets to <b>bridgeList</b> the list of bridge nodes Tor should use. */
+  void setExitNodeList(const QStringList &exitNodeList);
+
 };
 
 #endif