Bug 955667 - Unhandled IRC message 263: LIST refused, r=clokep.
authoraleth <aleth@instantbird.org>
Fri, 18 Oct 2013 07:09:44 -0400
changeset 17309 0396145c4329b82381f90b9acab90d103f0583a6
parent 17308 8c0c4bbab2fc057a0544f0fe61ae5f0a22719b91
child 17310 a2e3a113185da50bb18c44d533a46e179a31ca49
push id1151
push userbugzilla@standard8.plus.com
push dateMon, 03 Feb 2014 22:50:32 +0000
treeherdercomm-aurora@267d8e9143d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs955667
Bug 955667 - Unhandled IRC message 263: LIST refused, r=clokep.
chat/protocols/irc/irc.js
chat/protocols/irc/ircBase.jsm
chat/protocols/irc/ircUtils.jsm
--- a/chat/protocols/irc/irc.js
+++ b/chat/protocols/irc/irc.js
@@ -6,18 +6,16 @@ const {classes: Cc, interfaces: Ci, resu
 
 Cu.import("resource:///modules/imXPCOMUtils.jsm");
 Cu.import("resource:///modules/imServices.jsm");
 Cu.import("resource:///modules/ircUtils.jsm");
 Cu.import("resource:///modules/ircHandlers.jsm");
 Cu.import("resource:///modules/jsProtoHelper.jsm");
 Cu.import("resource:///modules/socket.jsm");
 
-const kListRefreshInterval = 12 * 60 * 60 * 1000; // 12 hours.
-
 /*
  * Parses a raw IRC message into an object (see section 2.3 of RFC 2812). This
  * returns an object with the following fields:
  *   rawMessage The initial message string received without any processing.
  *   command    A string that is the command or response code.
  *   params     An array of strings for the parameters. The last parameter is
  *              stripped of its : prefix.
  * If the message is from a user:
--- a/chat/protocols/irc/ircBase.jsm
+++ b/chat/protocols/irc/ircBase.jsm
@@ -607,18 +607,28 @@ var ircBase = {
       return serverMessage(this, aMessage, true);
     },
 
     /*
      * Try again.
      */
     "263": function(aMessage) { // RPL_TRYAGAIN
       // <command> :Please wait a while and try again.
-      // TODO setTimeout for a minute or so and try again?
-      return false;
+      if (aMessage.params[1] == "LIST" && this._pendingList) {
+        // We may receive this from servers which rate-limit LIST if the
+        // server believes us to be asking for LIST data too soon after the
+        // previous request.
+        // Tidy up as we won't be receiving any more channels.
+        this._sendRemainingRoomInfo();
+        // Fake the last LIST time so that we may try again in one hour.
+        const kHour = 60 * 60 * 1000;
+        this._lastListTime = Date.now() - kListRefreshInterval + kHour;
+        return true;
+      }
+      return serverMessage(this, aMessage);
     },
 
     "265": function(aMessage) { // nonstandard
       // :Current Local Users: <integer>  Max: <integer>
       return serverMessage(this, aMessage);
     },
     "266": function(aMessage) { // nonstandard
       // :Current Global Users: <integer>  Max: <integer>
--- a/chat/protocols/irc/ircUtils.jsm
+++ b/chat/protocols/irc/ircUtils.jsm
@@ -1,28 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const EXPORTED_SYMBOLS = ["_", "ctcpFormatToText", "ctcpFormatToHTML",
-                          "conversationErrorMessage"];
+                          "conversationErrorMessage", "kListRefreshInterval"];
 
 const {classes: Cc, interfaces: Ci} = Components;
 
 Components.utils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", function()
   l10nHelper("chrome://chat/locale/irc.properties")
 );
 
 XPCOMUtils.defineLazyGetter(this, "TXTToHTML", function() {
   let cs = Cc["@mozilla.org/txttohtmlconv;1"].getService(Ci.mozITXTToHTMLConv);
   return function(aTXT) cs.scanTXT(aTXT, cs.kEntities);
 });
 
+// The timespan after which we consider LIST roomInfo to be stale.
+const kListRefreshInterval = 12 * 60 * 60 * 1000; // 12 hours.
+
 /*
  * The supported formatting control characters, as described in
  * http://www.invlogic.com/irc/ctcp.html#3.11
  * If a string is given, it will replace the control character; if null is
  * given, the current HTML tag stack will be closed; if a function is given,
  * it expects two parameters:
  *  aStack  The ordered list of open HTML tags.
  *  aInput  The current input string.