CIRCNetwork.listInit Member

Syntax

object.listInit();

Returns

Remarks

See Also

Source Code

function my_list_init ()
{
function checkEndList (network)
{
if (network._list.count == network._list.lastLength)
{
network.on323();
}
else
{
network._list.lastLength = network._list.count;
network._list.endTimeout =
setTimeout(checkEndList, 5000, network);
}
}
function outputList (network)
{
const CHUNK_SIZE = 5;
var list = network._list;
if (list.cancelled)
{
if (list.done)
{
/* The server is no longer throwing stuff at us, so now
* we can safely kill the list.
*/
network.display(getMsg(MSG_LIST_END,
[list.displayed, list.count]));
delete network._list;
}
else
{
/* We cancelled the list, but we're still getting data.
* Handle that data, but don't display, and do it more
* slowly, so we cause less lag.
*/
setTimeout(outputList, 1000, network);
}
return;
}
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(MSG_FMT_CHANLIST, list[i]), "322");
list.displayed = end;
}
if (list.done && (list.displayed == list.length))
{
if (list.event323)
{
var length = list.event323.params.length;
network.displayHere (list.event323.params[length - 1], "323");
}
network.displayHere(getMsg(MSG_LIST_END,
[list.displayed, list.count]));
}
else
{
setTimeout(outputList, 250, network);
}
}
if (!("_list" in this))
{
this._list = new Array();
this._list.string = MSG_UNKNOWN;
this._list.regexp = null;
this._list.done = false;
this._list.count = 0;
}
if (!("file" in this._list))
{
this._list.displayed = 0;
if (client.currentObject != this)
display (getMsg(MSG_LIST_REROUTED, this.unicodeName));
setTimeout(outputList, 250, this);
}
this._list.lastLength = 0;
this._list.endTimeout = setTimeout(checkEndList, 5000, this);
}