Bug 113227 - make /list not cause chatzilla to time out or freeze mozilla

(also bump version)
chatzilla only
r=rginda
a=asa
This commit is contained in:
samuel%sieb.net 2002-11-02 06:16:14 +00:00
Родитель 2386360cbe
Коммит 4cba6d682c
4 изменённых файлов: 127 добавлений и 8 удалений

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

@ -58,7 +58,7 @@ function addCommands(commandObject)
add ("join", "onInputJoin");
add ("kick", "onInputKick");
add ("leave", "onInputLeave");
add ("list", "onInputSimpleCommand");
add ("list", "onInputList");
add ("me", "onInputMe");
add ("msg", "onInputMsg");
add ("name", "onInputName");
@ -73,6 +73,7 @@ function addCommands(commandObject)
add ("query", "onInputQuery");
add ("quit", "onInputExit");
add ("quote", "onInputQuote");
add ("rlist", "onInputRlist");
add ("server", "onInputServer");
add ("squery", "onInputSquery");
add ("stalk", "onInputStalk");

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

@ -1133,7 +1133,7 @@ function cli_iscommand (e)
else
{
client.currentObject.display (getMsg("onInputSimpleCommandMsg",
e.command),"WARNING");
e.command), "WARNING");
return false;
}
}
@ -1162,7 +1162,7 @@ function cli_isquery (e)
else
{
client.currentObject.display (getMsg("onInputSimpleCommandMsg",
e.command),"WARNING");
e.command), "WARNING");
return false;
}
}
@ -1710,6 +1710,51 @@ function cli_ime (e)
return true;
}
client.onInputList =
function cli_ilist (e)
{
var o = getObjectDetails(client.currentObject);
if ("network" in o)
{
o.network.list = new Array();
o.network.list.regexp = null;
}
return client.onInputSimpleCommand(e);
}
client.onInputRlist =
function cli_irlist (e)
{
var o = getObjectDetails(client.currentObject);
if (!("server" in o))
{
client.currentObject.display (getMsg("onInputSimpleCommandMsg",
"list"), "WARNING");
return false;
}
o.network.list = new Array();
var ary = e.inputData.match (/^\s*("([^"]*)"|([^\s]*))/);
try
{
if (ary[2])
o.network.list.regexp = new RegExp(ary[2], "i");
else if (ary[3])
o.network.list.regexp = new RegExp(ary[3], "i");
else
return false;
}
catch(error)
{
client.currentObject.display (getMsg("cli_irlistMsg", e.inputData,
error),
"ERROR");
return false;
}
o.server.sendData ("list\n");
return true;
}
client.onInputQuery =
function cli_iquery (e)
{
@ -2688,22 +2733,90 @@ function my_303 (e)
CIRCNetwork.prototype.on321 = /* LIST reply header */
function my_321 (e)
{
function checkEndList (network)
{
if (network.list.count == network.list.lastLength)
{
network.on323();
}
else
{
network.list.lastLength = network.list.count;
network.list.endTimeout =
setTimeout(checkEndList, 1500, network);
}
}
function outputList (network)
{
const CHUNK_SIZE = 5;
var list = network.list;
if (list.length > list.displayed)
{
var start = list.displayed;
var end = list.length;
if (end - start > CHUNK_SIZE)
end = start + CHUNK_SIZE;
for (var i = start; i < end; ++i)
network.displayHere (getMsg("my_322", list[i]), "322");
list.displayed = end;
}
if (list.done && (list.displayed == list.length))
{
if (list.event323)
{
network.displayHere (list.event323.params.join(" ") + ": " +
list.event323.meat, "323");
}
network.displayHere (getMsg("my_323", [list.displayed, list.count]),
"INFO");
delete network.list;
}
else
{
setTimeout(outputList, 250, network);
}
}
if (!("list" in this))
{
this.list = new Array();
this.list.regexp = null;
}
this.displayHere (e.params[2] + " " + e.meat, "321");
if (client.currentObject != this)
client.currentObject.display (getMsg("my_321", this.name), "INFO");
client.currentObject.display (getMsg("my_321", this.name), "INFO");
this.list.lastLength = 0;
this.list.done = false;
this.list.count = 0;
this.list.displayed = 0;
setTimeout(outputList, 250, this);
this.list.endTimeout = setTimeout(checkEndList, 1500, this);
}
CIRCNetwork.prototype.on323 = /* end of LIST reply */
function my_323 (e)
{
this.displayHere (e.params.join(" ") + ": " + e.meat, "323");
if (this.list.endTimeout)
{
clearTimeout(this.list.endTimeout);
delete this.list.endTimeout;
}
this.list.done = true;
this.list.event323 = e;
}
CIRCNetwork.prototype.on322 = /* LIST reply */
function my_listrply (e)
{
this.displayHere (getMsg("my_322", [toUnicode(e.params[2]), e.params[3], e.meat]),
"322");
++this.list.count;
e.params[2] = toUnicode(e.params[2]);
if (!(this.list.regexp) || e.params[2].match(this.list.regexp)
|| e.meat.match(this.list.regexp))
{
this.list.push([e.params[2], e.params[3], e.meat]);
}
}
/* end of WHO */

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

@ -36,7 +36,7 @@ const MSG_UNKNOWN = getMsg ("unknown");
client.defaultNick = getMsg( "defaultNick" );
client.version = "0.8.10";
client.version = "0.8.11";
client.TYPE = "IRCClient";
client.COMMAND_CHAR = "/";

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

@ -108,6 +108,9 @@ leaveHelp=Leaves the current channel, use /delete or /hide to force the view to
listUsage=[channel]
listHelp=Lists channel name, user count, and topic information for the network/server you are attached to. If you omit the optional channel argument, all channels will be listed. On large networks, the server may disconnect you for asking for a complete list.
rlistUsage=<regexp>
rlistHelp=Lists channel name, user count, and topic information for the network/server you are attached to, filtered by the regular expression.
meUsage=<action>
meHelp=Performs an 'action' on the current channel.
@ -355,6 +358,7 @@ cli_istalkMsg2=Currently stalking [%S]
cli_istalkMsg3=Now stalking %S
cli_iunstalkMsg=No longer stalking %S
cli_iunstalkMsg2=Not stalking %S
cli_irlistMsg=Error in pattern ``%S'': %S
my_ctcprunk=CTCP %S reply ``%S'' from %S
my_whoisreplyMsg=%S <%S@%S> ``%S''
my_whoisreplyMsg2=%S: member of %S
@ -367,6 +371,7 @@ my_433Msg=The nickname ``%S'' is already in use, use the /nick command to pick a
my_433Retry=The nickname ``%S'' is already in use, trying ``%S''.
my_321=List reply will appear on the ``%S'' view.
my_322=%S %S %S
my_323=Displayed %S of %S channels
my_315=End of WHO results for ``%S'', %S user(s) found
my_352.h=here
my_352.g=gone