[tor-commits] [tor-messenger-build/master] Add patch for trac 17552

arlo at torproject.org arlo at torproject.org
Sat Nov 7 02:03:35 UTC 2015


commit efe3391fe4a4ffa136d6fa3e9c229b16a0a04dee
Author: Arlo Breault <arlolra at gmail.com>
Date:   Fri Nov 6 18:02:56 2015 -0800

    Add patch for trac 17552
    
     * Instantbird throwing on XMPP non-MUC message stanzas w/ subject
---
 ChangeLog                             |    1 +
 projects/instantbird/config           |    1 +
 projects/instantbird/trac-17552.patch |   92 +++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 66430f2..1ec0ae1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Tor Messenger 0.1.0b4 --
      * Bug 17539: Pass username when interpolating resent string
    * Bug 17492: Include default bridges configuration
    * Use tor and the pluggable transports from tor-browser 5.0.4
+   * Bug 17552: Instantbird throwing on XMPP non-MUC message stanzas w/ subject
 
 Tor Messenger 0.1.0b3 -- October 30 2015
  * Windows
diff --git a/projects/instantbird/config b/projects/instantbird/config
index 4993c8c..f9bfdb7 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -71,6 +71,7 @@ input_files:
   - filename: xmppRegister.js
   - filename: xmppRegister.xul
   - filename: xmpp-gtalk-resource.patch
+  - filename: trac-17552.patch
   - filename: version.patch
   - filename: search-context-menu.patch
   - filename: search-preferences-xul.patch
diff --git a/projects/instantbird/trac-17552.patch b/projects/instantbird/trac-17552.patch
new file mode 100644
index 0000000..f4ff411
--- /dev/null
+++ b/projects/instantbird/trac-17552.patch
@@ -0,0 +1,92 @@
+# HG changeset patch
+# User Arlo Breault <arlolra at gmail.com>
+# Date 1446859847 28800
+#      Fri Nov 06 17:30:47 2015 -0800
+# Node ID b9b0e61d9a2d5092d45b309feb4ae526ae00519c
+# Parent  073468887b0faecb810a6e4463a2806924fead81
+Ensure isMuc when attempting a subject change
+
+diff --git a/chat/protocols/xmpp/xmpp.jsm b/chat/protocols/xmpp/xmpp.jsm
+--- a/chat/protocols/xmpp/xmpp.jsm
++++ b/chat/protocols/xmpp/xmpp.jsm
+@@ -1718,16 +1718,17 @@ var XMPPAccountPrototype = {
+ 
+       return null;
+   },
+ 
+   /* Called when a message stanza is received */
+   onMessageStanza: function(aStanza) {
+     let from = aStanza.attributes["from"];
+     let norm = this.normalize(from);
++    let isMuc = this._mucs.has(norm);
+ 
+     let type = aStanza.attributes["type"];
+     let x = aStanza.getElement(["x"]);
+     let body;
+     let b = aStanza.getElement(["body"]);
+     if (b) {
+       // If there's a <body> child we have more than just typing notifications.
+       // Prefer HTML (in <html><body>) and use plain text (<body>) as fallback.
+@@ -1738,17 +1739,21 @@ var XMPPAccountPrototype = {
+         // Even if the message is in plain text, the prplIMessage
+         // should contain a string that's correctly escaped for
+         // insertion in an HTML document.
+         body = TXTToHTML(b.innerText);
+       }
+     }
+ 
+     let subject = aStanza.getElement(["subject"]);
+-    if (subject) {
++    // Ignore subject when !isMuc. We're being permissive about subject changes
++    // in the comment below, so we need to be careful about where that makes
++    // sense. Psi+'s OTR plugin includes a subject and body in its message
++    // stanzas.
++    if (subject && isMuc) {
+       // XEP-0045 (7.2.16): Check for a subject element in the stanza and update
+       // the topic if it exists.
+       // We are breaking the spec because only a message that contains a
+       // <subject/> but no <body/> element shall be considered a subject change
+       // for MUC, but we ignore that to be compatible with ejabberd versions
+       // before 15.06.
+       let muc = this._mucs.get(norm);
+       let nick = this._parseJID(from).resource;
+@@ -1763,18 +1768,18 @@ var XMPPAccountPrototype = {
+       let delay = aStanza.getElement(["delay"]);
+       if (delay && delay.uri == Stanza.NS.delay) {
+         if (delay.attributes["stamp"])
+           date = new Date(delay.attributes["stamp"]);
+       }
+       if (date && isNaN(date))
+         date = undefined;
+       if (type == "groupchat" ||
+-          (type == "error" && this._mucs.has(norm) && !this._conv.has(from))) {
+-        if (!this._mucs.has(norm)) {
++          (type == "error" && isMuc && !this._conv.has(from))) {
++        if (!isMuc) {
+           this.WARN("Received a groupchat message for unknown MUC " + norm);
+           return;
+         }
+         let muc = this._mucs.get(norm);
+         muc.incomingMessage(body, aStanza, date);
+         return;
+       }
+ 
+@@ -1840,17 +1845,17 @@ var XMPPAccountPrototype = {
+     if (state) {
+       this.DEBUG(state);
+       if (state == "composing")
+         typingState = Ci.prplIConvIM.TYPING;
+       else if (state == "paused")
+         typingState = Ci.prplIConvIM.TYPED;
+     }
+     let convName = norm;
+-    if (this._mucs.has(norm))
++    if (isMuc)
+       convName = from;
+     let conv = this._conv.get(convName);
+     if (!conv)
+       return;
+     conv.updateTyping(typingState, conv.shortName);
+     conv.supportChatStateNotifications = !!state;
+   },
+ 



More information about the tor-commits mailing list