diff --git a/mozilla/extensions/irc/js/lib/irc.js b/mozilla/extensions/irc/js/lib/irc.js index bf2861b190f..17bbca3793d 100644 --- a/mozilla/extensions/irc/js/lib/irc.js +++ b/mozilla/extensions/irc/js/lib/irc.js @@ -488,6 +488,7 @@ function CIRCServer (parent, hostname, port, isSecure, password) s.supports = null; s.channelTypes = null; s.channelModes = null; + s.channelCount = -1; s.userModes = null; s.maxLineLength = 400; @@ -1588,6 +1589,15 @@ function serv_251(e) e.set = "network"; } +/* channels */ +CIRCServer.prototype.on254 = +function serv_254(e) +{ + this.channelCount = e.params[2]; + e.destObject = this.parent; + e.set = "network"; +} + /* user away message */ CIRCServer.prototype.on301 = function serv_301(e) diff --git a/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties b/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties index 77e477c85ed..c89e8e83360 100644 --- a/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties +++ b/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties @@ -1181,6 +1181,7 @@ msg.nick.prompt = Enter a nickname to use: msg.list.rerouted = List reply will appear on the ``%S'' view. msg.list.end = Displayed %S of %S channels. +msg.list.chancount = This server has %S channels. Listing them all will probably take a long time, and may lead to ChatZilla becoming unresponsive or being disconnected by the server. [[List Channels][List all channels][%S]] msg.who.end = End of WHO results for ``%S'', %S user(s) found. msg.who.match = User %S, (%S@%S) ``%S'' (%S), member of %S, is connected to , %S hop(s). diff --git a/mozilla/extensions/irc/xul/content/commands.js b/mozilla/extensions/irc/xul/content/commands.js index 12cafec5a8d..21a0e89660c 100644 --- a/mozilla/extensions/irc/xul/content/commands.js +++ b/mozilla/extensions/irc/xul/content/commands.js @@ -2038,7 +2038,19 @@ function cmdMotif(e) function cmdList(e) { if (!e.channelName) + { e.channelName = ""; + var c = e.server.channelCount; + if ((c > client.SAFE_LIST_COUNT) && !("listWarned" in e.network)) + { + client.munger.getRule(".inline-buttons").enabled = true; + display(getMsg(MSG_LIST_CHANCOUNT, [c, "list"]), MT_WARN); + client.munger.getRule(".inline-buttons").enabled = false; + e.network.listWarned = true; + return; + } + } + e.network.list(e.channelName); } @@ -2086,6 +2098,16 @@ function cmdRlist(e) display(MSG_ERR_INVALID_REGEX, MT_ERROR); return; } + + var c = e.server.channelCount; + if ((c > client.SAFE_LIST_COUNT) && !("listWarned" in e.network)) + { + client.munger.getRule(".inline-buttons").enabled = true; + display(getMsg(MSG_LIST_CHANCOUNT, [c, "rlist " + e.regexp]), MT_WARN); + client.munger.getRule(".inline-buttons").enabled = false; + e.network.listWarned = true; + return; + } e.network.list(re); } diff --git a/mozilla/extensions/irc/xul/content/static.js b/mozilla/extensions/irc/xul/content/static.js index 083946cf83a..d171ec83b20 100644 --- a/mozilla/extensions/irc/xul/content/static.js +++ b/mozilla/extensions/irc/xul/content/static.js @@ -79,10 +79,6 @@ client.MAX_NICK_DISPLAY = 14; /* longest word to show in display before abbreviating */ client.MAX_WORD_DISPLAY = 20; -client.MAX_MSG_PER_ROW = 3; /* default number of messages to collapse into a - * single row, max. */ -client.INITIAL_COLSPAN = 5; /* MAX_MSG_PER_ROW cannot grow to greater than - * one half INITIAL_COLSPAN + 1. */ client.NOTIFY_TIMEOUT = 5 * 60 * 1000; /* update notify list every 5 minutes */ // Check every minute which networks have away statuses that need an update. @@ -95,14 +91,13 @@ client.SLOPPY_NETWORKS = true; /* true if msgs from a network can be displayed * is on the network that the results came from) */ client.DOUBLETAB_TIME = 500; -client.IMAGEDIR = "chrome://chatzilla/skin/images/"; client.HIDE_CODES = true; /* true if you'd prefer to show numeric response * codes as some default value (ie, "===") */ -/* true if the browser widget shouldn't be allowed to take focus. windows, and - * probably the mac, need to be able to give focus to the browser widget for - * copy to work properly. */ -client.NO_BROWSER_FOCUS = (navigator.platform.search(/mac|win/i) == -1); client.DEFAULT_RESPONSE_CODE = "==="; + +/* Maximum number of channels we'll try to list without complaining */ +client.SAFE_LIST_COUNT = 500; + /* Minimum number of users above or below the conference limit the user count * must go, before it is changed. This allows the user count to fluctuate * around the limit without continously going on and off.