diff --git a/extensions/irc/js/lib/irc.js b/extensions/irc/js/lib/irc.js index ea524d734a38..5d7e68e21ac5 100644 --- a/extensions/irc/js/lib/irc.js +++ b/extensions/irc/js/lib/irc.js @@ -1172,7 +1172,7 @@ function serv_ppline(e) ev.data = lines[i].replace(/\r/g, ""); if (ev.data) { - if (ev.data.match(/^(?::[^ ]+ )?32[123] /i)) + if (ev.data.match(/^(?::[^ ]+ )?(?:32[123]|352|315) /i)) this.parent.eventPump.addBulkEvent(ev); else this.parent.eventPump.addEvent(ev); diff --git a/extensions/irc/xul/content/handlers.js b/extensions/irc/xul/content/handlers.js index 6def61c8ff42..640636b0fd8a 100644 --- a/extensions/irc/xul/content/handlers.js +++ b/extensions/irc/xul/content/handlers.js @@ -666,42 +666,44 @@ function onNotifyTimeout() } } -var lastWhoCheckTime = new Date(); -var lastWhoCheckChannel = null; - function onWhoTimeout() { - lastWhoCheckTime = new Date(); - var checkNext = (lastWhoCheckChannel == null); + function checkWho() + { + var checkNext = (net.lastWhoCheckChannel == null); + for (var c in net.primServ.channels) + { + var chan = net.primServ.channels[c]; + + if (checkNext && chan.active && + chan.getUsersLength() < client.prefs["autoAwayCap"]) + { + net.primServ.LIGHTWEIGHT_WHO = true; + net.primServ.sendData("WHO " + chan.encodedName + "\n"); + net.lastWhoCheckChannel = chan; + net.lastWhoCheckTime = Date.now(); + return; + } + + if (chan == net.lastWhoCheckChannel) + checkNext = true; + } + if (net.lastWhoCheckChannel) + { + net.lastWhoCheckChannel = null; + checkWho(); + } + }; for (var n in client.networks) { var net = client.networks[n]; - if (net.isConnected()) - { - for (var c in net.primServ.channels) - { - var chan = net.primServ.channels[c]; - - if (checkNext && chan.active && - chan.getUsersLength() < client.prefs["autoAwayCap"]) - { - net.primServ.LIGHTWEIGHT_WHO = true; - net.primServ.sendData("WHO " + chan.encodedName + "\n"); - lastWhoCheckChannel = chan; - return; - } - - if (chan == lastWhoCheckChannel) - checkNext = true; - } - } - } - - if (lastWhoCheckChannel) - { - lastWhoCheckChannel = null; - onWhoTimeout(); + var period = net.prefs["autoAwayPeriod"]; + // The time since the last check, with a 5s error margin to + // stop us from not checking because the timer fired a tad early: + var waited = Date.now() - net.lastWhoCheckTime + 5000; + if (net.isConnected() && (period != 0) && (period * 60000 < waited)) + checkWho(); } } @@ -969,6 +971,8 @@ function my_unknown (e) this.display(toUnicode(e.params.join(" "), this), e.code.toUpperCase()); } +CIRCNetwork.prototype.lastWhoCheckChannel = null; +CIRCNetwork.prototype.lastWhoCheckTime = 0; CIRCNetwork.prototype.on001 = /* Welcome! */ CIRCNetwork.prototype.on002 = /* your host is */ CIRCNetwork.prototype.on003 = /* server born-on date */ diff --git a/extensions/irc/xul/content/prefs.js b/extensions/irc/xul/content/prefs.js index 4acf80b8d7b0..478657a2f777 100644 --- a/extensions/irc/xul/content/prefs.js +++ b/extensions/irc/xul/content/prefs.js @@ -127,6 +127,7 @@ function initPrefs() ["activityFlashDelay", 200, "global"], ["aliases", [], "lists.aliases"], ["autoAwayCap", 300, "global"], + ["autoAwayPeriod", 2, "appearance.misc"], ["autoRejoin", false, ".connect"], ["awayNick", "", ".ident"], ["bugURL", "https://bugzilla.mozilla.org/show_bug.cgi?id=%s", @@ -406,6 +407,7 @@ function getNetworkPrefManager(network) var prefs = [ + ["autoAwayPeriod", defer, "appearance.misc"], ["autoRejoin", defer, ".connect"], ["away", "", "hidden"], ["awayNick", defer, ".ident"], diff --git a/extensions/irc/xul/content/static.js b/extensions/irc/xul/content/static.js index f16b8a45f736..6236db9fd811 100644 --- a/extensions/irc/xul/content/static.js +++ b/extensions/irc/xul/content/static.js @@ -43,7 +43,7 @@ const __cz_version = "0.9.71"; const __cz_condition = "green"; const __cz_suffix = ""; const __cz_guid = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2"; -const __cz_locale = "0.9.71.0"; +const __cz_locale = "0.9.71.1"; var warn; var ASSERT; @@ -85,7 +85,9 @@ client.MAX_MSG_PER_ROW = 3; /* default number of messages to collapse into a 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 */ -client.AWAY_TIMEOUT = 2 * 60 * 1000; /* update away status every 2 mins */ + +// Check every minute which networks have away statuses that need an update. +client.AWAY_TIMEOUT = 60 * 1000; client.SLOPPY_NETWORKS = true; /* true if msgs from a network can be displayed * on the current object if it is related to @@ -354,6 +356,7 @@ function initStatic() client.logFile = null; setInterval("onNotifyTimeout()", client.NOTIFY_TIMEOUT); + // Call every minute, will check only the networks necessary. setInterval("onWhoTimeout()", client.AWAY_TIMEOUT); client.awayMsgs = [{ message: MSG_AWAY_DEFAULT }]; diff --git a/extensions/irc/xul/locale/en-US/chatzilla.properties b/extensions/irc/xul/locale/en-US/chatzilla.properties index 9a9828c162d2..7637775001fc 100644 --- a/extensions/irc/xul/locale/en-US/chatzilla.properties +++ b/extensions/irc/xul/locale/en-US/chatzilla.properties @@ -69,7 +69,7 @@ # ### End of notes ### -locale.version = 0.9.71.0 +locale.version = 0.9.71.1 locale.error = You are using ChatZilla %1$S, which requires the locale version %2$S. The currently selected locale, %3$S, is version %4$S, and therefore there may be problems running ChatZilla.\n\nIt is strongly advised that you update or remove the ChatZilla locale in question. # Misc @@ -1302,6 +1302,8 @@ pref.aliases.label = Command aliases pref.aliases.help = Allows you to make shortcuts to various commands or sequences of commands. Each item is of the form " = ". The command-list is a list of commands (without the leading "/") along with their parameters, each separated by ";". The name of the alias will automatically be turned into a command when Chatzilla starts. pref.autoAwayCap.label = Auto away-check user limit pref.autoAwayCap.help = ChatZilla automatically checks which users are here and which are away in each channel you are a member of, however, this causes significant lag on larger channels. Any channel bigger than this limit won't be checked. +pref.autoAwayPeriod.label = Auto away-check period length +pref.autoAwayPeriod.help = ChatZilla automatically checks which users are here and which are away in each channel you are a member of. This specifies how many minutes should pass between checks. pref.autoperform.label = Auto-perform pref.autoperform.help = When connecting to a server, you might want to send some commands automatically. Simply enter each command in this list (without the leading "/"), with parameters, and Chatzilla will do it all for you. The commands are run in the order listed. pref.autoRejoin.label = Rejoin when kicked