Bug 292428 - Make auto-away checking work per-network, and be configurable for the same.

ChatZilla only.
r=silver
p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch)
This commit is contained in:
silver%warwickcompsoc.co.uk 2006-03-05 01:24:26 +00:00
Родитель dfd654b704
Коммит 63671f0e26
5 изменённых файлов: 45 добавлений и 34 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -666,19 +666,11 @@ function onNotifyTimeout()
}
}
var lastWhoCheckTime = new Date();
var lastWhoCheckChannel = null;
function onWhoTimeout()
{
lastWhoCheckTime = new Date();
var checkNext = (lastWhoCheckChannel == null);
for (var n in client.networks)
{
var net = client.networks[n];
if (net.isConnected())
function checkWho()
{
var checkNext = (net.lastWhoCheckChannel == null);
for (var c in net.primServ.channels)
{
var chan = net.primServ.channels[c];
@ -688,20 +680,30 @@ function onWhoTimeout()
{
net.primServ.LIGHTWEIGHT_WHO = true;
net.primServ.sendData("WHO " + chan.encodedName + "\n");
lastWhoCheckChannel = chan;
net.lastWhoCheckChannel = chan;
net.lastWhoCheckTime = Date.now();
return;
}
if (chan == lastWhoCheckChannel)
if (chan == net.lastWhoCheckChannel)
checkNext = true;
}
}
}
if (lastWhoCheckChannel)
if (net.lastWhoCheckChannel)
{
lastWhoCheckChannel = null;
onWhoTimeout();
net.lastWhoCheckChannel = null;
checkWho();
}
};
for (var n in client.networks)
{
var net = client.networks[n];
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 */

Просмотреть файл

@ -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"],

Просмотреть файл

@ -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 }];

Просмотреть файл

@ -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 "<name> = <command-list>". 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