[tor-commits] [tor-messenger-build/master] Use onion addresses for known XMPP servers (#13855)

sukhbir at torproject.org sukhbir at torproject.org
Fri May 8 14:28:14 UTC 2015


commit b1c51f30108667a017bdb620dbdd39c59373ad60
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Fri May 8 10:26:03 2015 -0400

    Use onion addresses for known XMPP servers (#13855)
    
    For known XMPP servers that allow for access via a hidden service, Tor
    Messenger will set the server to the onion address automatically.
---
 projects/instantbird/config           |    2 +-
 projects/instantbird/xmpp-onion.patch |  107 +++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/projects/instantbird/config b/projects/instantbird/config
index 4fd4585..06c4cbe 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -59,7 +59,6 @@ input_files:
   - filename: spi-cacert.der
   - filename: preferences.patch
   - filename: irc.patch
-  - filename: xmpp.patch
   - filename: gtalk-resource.patch
   - filename: top-protocols.patch
   - filename: disable-links.patch
@@ -70,6 +69,7 @@ input_files:
   - filename: cert_override.txt
   - filename: ctcp-time.patch
   - filename: ctcp-ping.patch
+  - filename: xmpp-onion.patch
   - filename: version.patch
   - filename: branding/name.patch
   - filename: branding/default.png
diff --git a/projects/instantbird/xmpp-onion.patch b/projects/instantbird/xmpp-onion.patch
new file mode 100644
index 0000000..46a1a76
--- /dev/null
+++ b/projects/instantbird/xmpp-onion.patch
@@ -0,0 +1,107 @@
+From 6bd2fc6cbc618e8fcd38411854da2527556e0114 Mon Sep 17 00:00:00 2001
+From: Sukhbir Singh <sukhbir at torproject.org>
+Date: Fri, 8 May 2015 10:19:31 -0400
+Subject: [PATCH] Use onion addresses for known XMPP servers (#13855)
+
+---
+ im/content/accountWizard.js  | 35 ++++++++++++++++++++++++++++++++++-
+ im/content/accountWizard.xul |  5 +++--
+ 2 files changed, 37 insertions(+), 3 deletions(-)
+
+diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js
+index 707f1c7..e763165 100644
+--- a/im/content/accountWizard.js
++++ b/im/content/accountWizard.js
+@@ -7,6 +7,14 @@ Cu.import("resource:///modules/imServices.jsm");
+ 
+ const PREF_EXTENSIONS_GETMOREPROTOCOLSURL = "extensions.getMoreProtocolsURL";
+ 
++// Borrowed and inspired by xmpp-client.
++const kServerOnions = {
++  "riseup.net":                "4cjw6cwpeaeppfqz.onion",
++  "jabber.ccc.de":             "okj7xc6j2szr2y75.onion",
++  "jabber.otr.im":             "5rgdtlawqkcplz75.onion",
++  "jabber.calyxinstitute.org": "ijeeynrc6x2uy5ob.onion",
++}
++
+ var accountWizard = {
+   onload: function aw_onload() {
+     let topProtoList = document.getElementById("topprotolist");
+@@ -105,6 +113,21 @@ var accountWizard = {
+     return textbox;
+   },
+ 
++  insertOnionAddress: function aw_insertOnionAddress() {
++    // Currently, we only use onion addresses for XMPP.
++    if (this.proto.id == "prpl-jabber") {
++      // If the value of the domain is one for which there exists a
++      // hidden service, replace the address with the onion address.
++      let jabberDomain = document.getElementById("username-split-0");
++      if (jabberDomain.value in kServerOnions) {
++        this.onionAddress = kServerOnions[jabberDomain.value];
++      }
++      else {
++        this.onionAddress = "";
++      }
++    }
++  },
++
+   showUsernamePage: function aw_showUsernamePage() {
+     let proto = this.proto.id;
+     if ("userNameBoxes" in this && this.userNameProto == proto) {
+@@ -160,11 +183,20 @@ var accountWizard = {
+     document.getElementById("accountusername").next = next;
+   },
+ 
++  setOnionAddress: function aw_setOnionAddress() {
++    if (this.proto.id == "prpl-jabber") {
++      document.getElementById("prpl-jabber-server").value = this.onionAddress;
++    }
++  },
++
+   showAdvanced: function aw_showAdvanced() {
+     // ensure we don't destroy user data if it's not necessary
+     let id = this.proto.id;
+-    if ("protoSpecOptId" in this && this.protoSpecOptId == id)
++    if ("protoSpecOptId" in this && this.protoSpecOptId == id) {
++      // But we should still set the onion address, if it exists.
++      this.setOnionAddress();
+       return;
++    }
+     this.protoSpecOptId = id;
+ 
+ /* FIXME
+@@ -172,6 +204,7 @@ var accountWizard = {
+       !this.proto.newMailNotification;
+ */
+     this.populateProtoSpecificBox();
++    this.setOnionAddress();
+ 
+     let proxyVisible = this.proto.usePurpleProxy;
+     if (proxyVisible) {
+diff --git a/im/content/accountWizard.xul b/im/content/accountWizard.xul
+index 5fa5b82..89f88fe 100644
+--- a/im/content/accountWizard.xul
++++ b/im/content/accountWizard.xul
+@@ -59,7 +59,8 @@
+               label="&accountUsernameTitle.label;"
+               onpageshow="accountWizard.showUsernamePage();"
+               onpagehide="accountWizard.hideUsernamePage();"
+-              onpagerewound="return accountWizard.rewindFromUsernamePage();">
++              onpagerewound="return accountWizard.rewindFromUsernamePage();"
++              onpageadvanced="return accountWizard.insertOnionAddress();">
+     <description id="usernameInfo"/>
+     <separator/>
+     <vbox id="userNameBox"/>
+@@ -98,7 +99,7 @@
+     <checkbox id="newMailNotification"
+               label="&accountAdvanced.newMailNotification.label;" hidden="true"/>
+ 
+-    <groupbox id="protoSpecificGroupbox" class="collapsable" closed="true"
++    <groupbox id="protoSpecificGroupbox" class="collapsable" closed="false"
+               onkeypress="accountWizard.onGroupboxKeypress(event)">
+       <caption id="protoSpecificCaption"
+                onclick="accountWizard.toggleGroupbox('protoSpecificGroupbox')"/>
+-- 
+2.1.4
+



More information about the tor-commits mailing list