[or-cvs] r19064: {torbutton} Add socks version option for Bug 931. (in torbutton/trunk/src: chrome/content defaults/preferences)

mikeperry at seul.org mikeperry at seul.org
Tue Mar 17 04:23:56 UTC 2009


Author: mikeperry
Date: 2009-03-17 00:23:55 -0400 (Tue, 17 Mar 2009)
New Revision: 19064

Modified:
   torbutton/trunk/src/chrome/content/preferences.js
   torbutton/trunk/src/chrome/content/preferences.xul
   torbutton/trunk/src/chrome/content/torbutton_util.js
   torbutton/trunk/src/defaults/preferences/preferences.js
Log:

Add socks version option for Bug 931.



Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js	2009-03-17 02:40:23 UTC (rev 19063)
+++ torbutton/trunk/src/chrome/content/preferences.js	2009-03-17 04:23:55 UTC (rev 19064)
@@ -65,6 +65,7 @@
         doc.getElementById('torbutton_gopherPort').disabled = true;
         doc.getElementById('torbutton_socksHost').disabled = true;
         doc.getElementById('torbutton_socksPort').disabled = true;
+        doc.getElementById('torbutton_socksGroup').disabled = true;
     } else {
         doc.getElementById('torbutton_httpProxy').disabled = false;
         doc.getElementById('torbutton_httpPort').disabled = false;
@@ -76,6 +77,7 @@
         doc.getElementById('torbutton_gopherPort').disabled = false;
         doc.getElementById('torbutton_socksHost').disabled = false;
         doc.getElementById('torbutton_socksPort').disabled = false;
+        doc.getElementById('torbutton_socksGroup').disabled = false;
         /* Do not reset these on every document update..
         doc.getElementById('torbutton_httpProxy').value    = o_customprefs.getCharPref('http_proxy');
         doc.getElementById('torbutton_httpPort').value     = o_customprefs.getIntPref('http_port');
@@ -129,6 +131,13 @@
     doc.getElementById('torbutton_gopherPort').value   = o_torprefs.getIntPref('gopher_port');
     doc.getElementById('torbutton_socksHost').value    = o_torprefs.getCharPref('socks_host');
     doc.getElementById('torbutton_socksPort').value    = o_torprefs.getIntPref('socks_port');
+    if(o_torprefs.getIntPref('socks_version') == 4) {
+        doc.getElementById('torbutton_socksGroup').selectedItem =
+            doc.getElementById('torbutton_socksv4');    
+    } else {
+        doc.getElementById('torbutton_socksGroup').selectedItem =
+            doc.getElementById('torbutton_socksv5');    
+    }
     // doc.getElementById('torbutton_warnUponExcludedSite').checked = o_torprefs.getBoolPref('prompt_before_visiting_excluded_sites');
 
     doc.getElementById('torbutton_disablePlugins').checked = o_torprefs.getBoolPref('no_tor_plugins');
@@ -313,7 +322,17 @@
     o_torprefs.setCharPref('socks_host',      doc.getElementById('torbutton_socksHost').value);
     o_torprefs.setIntPref('socks_port',       doc.getElementById('torbutton_socksPort').value);
 
+    if(doc.getElementById('torbutton_socksGroup').selectedItem ==
+            doc.getElementById('torbutton_socksv4')) {
+        o_torprefs.setIntPref('socks_version', 4); 
+    } else if(doc.getElementById('torbutton_socksGroup').selectedItem ==
+            doc.getElementById('torbutton_socksv5')) {
+        o_torprefs.setIntPref('socks_version', 5); 
+    }
+
     if (doc.getElementById('torbutton_settingsMethod').value == 'custom') {
+        // XXX: Is this even needed anymore? We don't read the
+        // custom prefs at all it seems..
         o_customprefs.setCharPref('http_proxy',      doc.getElementById('torbutton_httpProxy').value);
         o_customprefs.setIntPref('http_port',        doc.getElementById('torbutton_httpPort').value);
         o_customprefs.setCharPref('https_proxy',     doc.getElementById('torbutton_httpsProxy').value);
@@ -324,6 +343,14 @@
         o_customprefs.setIntPref('gopher_port',      doc.getElementById('torbutton_gopherPort').value);
         o_customprefs.setCharPref('socks_host',      doc.getElementById('torbutton_socksHost').value);
         o_customprefs.setIntPref('socks_port',       doc.getElementById('torbutton_socksPort').value);
+
+        if(doc.getElementById('torbutton_socksGroup').selectedItem ==
+                doc.getElementById('torbutton_socksv4')) {
+            o_customprefs.setIntPref('socks_version', 4); 
+        } else if(doc.getElementById('torbutton_socksGroup').selectedItem ==
+                doc.getElementById('torbutton_socksv5')) {
+            o_customprefs.setIntPref('socks_version', 5); 
+        }
     }
     // o_torprefs.setBoolPref('prompt_before_visiting_excluded_sites', doc.getElementById('torbutton_warnUponExcludedSite').checked);
 

Modified: torbutton/trunk/src/chrome/content/preferences.xul
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.xul	2009-03-17 02:40:23 UTC (rev 19063)
+++ torbutton/trunk/src/chrome/content/preferences.xul	2009-03-17 04:23:55 UTC (rev 19064)
@@ -95,6 +95,19 @@
                             <textbox id="torbutton_socksPort" size="5"/>
                         </hbox>
                     </row>
+                    <row align="center">
+                     <hbox align="center" pack="end">
+                      <spacer flex="1"/>
+                     </hbox>
+                      <radiogroup align="center" orient="horizontal" id="torbutton_socksGroup">
+                          <radio id="torbutton_socksv4"
+                                label="&torbutton.prefs.socks_vfour;" 
+                                oncommand="torbutton_prefs_set_field_attributes(document)"/>
+                          <radio id="torbutton_socksv5" 
+                                label="&torbutton.prefs.socks_vfive;" 
+                                oncommand="torbutton_prefs_set_field_attributes(document)"/>
+                      </radiogroup>
+                    </row>
                 </rows>
             </grid>
         </radiogroup>

Modified: torbutton/trunk/src/chrome/content/torbutton_util.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton_util.js	2009-03-17 02:40:23 UTC (rev 19063)
+++ torbutton/trunk/src/chrome/content/torbutton_util.js	2009-03-17 04:23:55 UTC (rev 19064)
@@ -125,7 +125,7 @@
          torbutton_log(1, "socks proxy") &&
          (liveprefs.getIntPref("socks_port")    == torprefs.getIntPref('socks_port'))    &&
          torbutton_log(1, "socks port") &&
-         (liveprefs.getIntPref("socks_version") == 5)              &&
+         (liveprefs.getIntPref("socks_version") == torprefs.getIntPref('socks_version')) &&
          torbutton_log(1, "socks version") &&
          (liveprefs.getBoolPref("share_proxy_settings") == false)   &&
          torbutton_log(1, "share proxy settins") &&
@@ -158,7 +158,7 @@
   liveprefs.setIntPref('gopher_port',   torprefs.getIntPref('gopher_port'));
   liveprefs.setCharPref('socks',        torprefs.getCharPref('socks_host'));
   liveprefs.setIntPref('socks_port',    torprefs.getIntPref('socks_port'));
-  liveprefs.setIntPref('socks_version', 5);
+  liveprefs.setIntPref('socks_version', torprefs.getIntPref('socks_version'));
   liveprefs.setBoolPref('share_proxy_settings', false);
   if (torbutton_check_socks_remote_dns()) {
       liveprefs.setBoolPref('socks_remote_dns', true);

Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js	2009-03-17 02:40:23 UTC (rev 19063)
+++ torbutton/trunk/src/defaults/preferences/preferences.js	2009-03-17 04:23:55 UTC (rev 19064)
@@ -21,6 +21,7 @@
 pref("extensions.torbutton.gopher_port",0);
 pref("extensions.torbutton.socks_host","");
 pref("extensions.torbutton.socks_port",0);
+pref("extensions.torbutton.socks_version",5);
 pref("extensions.torbutton.locked_mode",false);
 pref("extensions.torbutton.test_url","https://check.torproject.org/?TorButton=true");
 pref("extensions.torbutton.test_failed",false);
@@ -37,6 +38,7 @@
 pref("extensions.torbutton.custom.gopher_port",0);
 pref("extensions.torbutton.custom.socks_host","");
 pref("extensions.torbutton.custom.socks_port",0);
+pref("extensions.torbutton.custom.socks_version",5);
 
 // saved prefs:
 pref("extensions.torbutton.saved.type", 0);



More information about the tor-commits mailing list