Bug 955667 - Unhandled IRC message 263: LIST refused, r=clokep.
--- 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.