[tor-commits] [tor-messenger-build/master] Update XMPP in-band registration handling

sukhbir at torproject.org sukhbir at torproject.org
Tue Jun 30 08:00:55 UTC 2015


commit 1942bb45928dc421740d83e02cf93d6f5425224f
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Tue Jun 30 04:00:46 2015 -0400

    Update XMPP in-band registration handling
---
 projects/instantbird/branding/credits.patch        |   22 ++++++++++++++++++++
 .../instantbird/xmpp-inband-registration.patch     |   15 ++++++++-----
 projects/instantbird/xmppRegister.js               |    4 ++++
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/projects/instantbird/branding/credits.patch b/projects/instantbird/branding/credits.patch
index 26d09a4..108bb86 100644
--- a/projects/instantbird/branding/credits.patch
+++ b/projects/instantbird/branding/credits.patch
@@ -71,3 +71,25 @@ diff --git a/im/locales/en-US/chrome/instantbird/aboutDialog.dtd b/im/locales/en
  <!-- Use the ©rightYear; entity to place the current year. -->
 -<!ENTITY copyrightText2         "©2007-©rightYear; Contributors. This program is free software; you can redistribute it and/or modify it under the terms of the GNU GPL license version 2.0 or later.">
 +<!ENTITY copyrightText2         "©©rightYear; Contributors. This program is free software; you can redistribute it and/or modify it under the terms of the GNU GPL license version 2.0 or later.">
+diff --git a/im/content/aboutDialog.xul b/im/content/aboutDialog.xul
+--- a/im/content/aboutDialog.xul
++++ b/im/content/aboutDialog.xul
+@@ -9,17 +9,17 @@
+ <?xul-overlay href="chrome://instantbird/content/menus.xul"?>
+ #endif
+ 
+ <!DOCTYPE window [
+ <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
+ %brandDTD;
+ <!ENTITY % aboutDialogDTD SYSTEM "chrome://instantbird/locale/aboutDialog.dtd" >
+ %aboutDialogDTD;
+-<!ENTITY copyrightYear "2014">
++<!ENTITY copyrightYear "2015">
+ #ifdef XP_MACOSX
+  <!ENTITY % instantbirdDTD SYSTEM "chrome://instantbird/locale/instantbird.dtd">
+  %instantbirdDTD;
+ #endif
+ ]>
+ 
+ <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+         id="aboutDialog"
diff --git a/projects/instantbird/xmpp-inband-registration.patch b/projects/instantbird/xmpp-inband-registration.patch
index 73c838c..d8feebb 100644
--- a/projects/instantbird/xmpp-inband-registration.patch
+++ b/projects/instantbird/xmpp-inband-registration.patch
@@ -80,7 +80,7 @@ diff --git a/chat/protocols/xmpp/xmpp-session.jsm b/chat/protocols/xmpp/xmpp-ses
        return;
      let now = Date.now();
      if (aJustSentSomething)
-@@ -265,28 +268,95 @@ XMPPSession.prototype = {
+@@ -265,28 +268,98 @@ XMPPSession.prototype = {
                       _("connection.error.startTLSNotSupported"));
          return;
        }
@@ -119,14 +119,17 @@ diff --git a/chat/protocols/xmpp/xmpp-session.jsm b/chat/protocols/xmpp/xmpp-ses
 +        let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
 +                   .getService(Ci.nsIWindowWatcher);
 +        let win = ww.openWindow(null, registerWindow, "",
-+                                "centerscreen,chrome,modal,minimizable=no", registerStanza);
++                                "centerscreen,chrome,modal,
++                                resizable=yes,minimizable=no", registerStanza);
 +      } else {
 +        this.onError(null, _("connection.error.noRegistrationSupport"));
 +      }
 +
 +      // If the user cancelled the form, we should stop the registration.
-+      if (this.nodes["cancel"])
++      if (this.nodes["cancel"]) {
 +        this.onError(null, _("connection.error.registrationCancel"));
++        return;
++      }
 +
 +      let xml = '<?xml version="1.0"?>';
 +      let fieldNodes = [];
@@ -179,7 +182,7 @@ diff --git a/chat/protocols/xmpp/xmpp-session.jsm b/chat/protocols/xmpp/xmpp-ses
 diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js
 --- a/im/content/accountWizard.js
 +++ b/im/content/accountWizard.js
-@@ -106,16 +106,20 @@ var accountWizard = {
+@@ -106,16 +106,22 @@ var accountWizard = {
    },
  
    showUsernamePage: function aw_showUsernamePage() {
@@ -191,6 +194,8 @@ diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js
 +    
 +    if (this.proto.id == "prpl-jabber") {
 +      document.getElementById("registerXMPP").hidden = false;
++    } else {
++      document.getElementById("registerXMPP").hidden = true;
 +    }
  
      let bundle = document.getElementById("accountsBundle");
@@ -200,7 +205,7 @@ diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js
        usernameInfo =
          bundle.getFormattedString("accountUsernameInfoWithDescription",
                                    [emptyText, this.proto.name]);
-@@ -412,16 +416,18 @@ var accountWizard = {
+@@ -412,16 +418,18 @@ var accountWizard = {
    createAccount: function aw_createAccount() {
      let acc = Services.accounts.createAccount(this.username, this.proto.id);
      if (!this.proto.noPassword && this.password)
diff --git a/projects/instantbird/xmppRegister.js b/projects/instantbird/xmppRegister.js
index 052fa6c..6983ad1 100644
--- a/projects/instantbird/xmppRegister.js
+++ b/projects/instantbird/xmppRegister.js
@@ -29,6 +29,10 @@ let registerAccount = {
     this.rows = document.getElementById("register-rows");
 
     this.nodes = XMPPSession.prototype.nodes;
+    // Clear the existing elements from previous registrations.
+    for (let elem in this.nodes)
+      delete this.nodes[elem];
+
     this.registerStanza = window.arguments[0].wrappedJSObject;
     this.dataStanza = this.registerStanza.getElement(["x"]);
 



More information about the tor-commits mailing list