Bug 297796 - Make /cancel stop a /list output from displaying any more items.

ChatZilla only.
r=samuel
p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch)
This commit is contained in:
silver%warwickcompsoc.co.uk 2005-12-03 15:18:45 +00:00
parent 5663eeaaaa
commit 75f83719de
4 changed files with 59 additions and 9 deletions

View File

@ -852,15 +852,24 @@ function cmdBan(e)
function cmdCancel(e)
{
var network = e.network;
if ((network.state != NET_CONNECTING) && (network.state != NET_WAITING))
if ((network.state == NET_ONLINE) && network.isRunningList())
{
// We're running a /list, terminate the output so we return to sanity
display(MSG_CANCELLING_LIST);
network.abortList();
}
else if ((network.state == NET_CONNECTING) ||
(network.state == NET_WAITING))
{
// We're trying to connect to a network, and want to cancel. Do so:
display(getMsg(MSG_CANCELLING, network.unicodeName));
network.cancel();
}
else
{
display(MSG_NOTHING_TO_CANCEL, MT_ERROR);
return;
}
display(getMsg(MSG_CANCELLING, network.unicodeName));
network.cancel();
}
function cmdChanUserMode(e)

View File

@ -1256,6 +1256,12 @@ function my_263 (e)
return true;
}
CIRCNetwork.prototype.isRunningList =
function my_running_list()
{
return (("_list" in this) && !this._list.done && !this._list.cancelled);
}
CIRCNetwork.prototype.list =
function my_list(word, file)
{
@ -1308,6 +1314,27 @@ function my_list_init ()
{
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;
@ -1365,6 +1392,12 @@ function my_list_init ()
this._list.endTimeout = setTimeout(checkEndList, 5000, this);
}
CIRCNetwork.prototype.abortList =
function my_abortList()
{
this._list.cancelled = true;
}
CIRCNetwork.prototype.on321 = /* LIST reply header */
function my_321 (e)
{
@ -1398,6 +1431,13 @@ function my_listrply (e)
++this._list.count;
/* If the list has been cancelled, don't bother adding all this info
* anymore. Do increase the count (above), otherwise we never truly notice
* the list being finished.
*/
if (this._list.cancelled)
return;
var chanName = e.decodeParam(2);
var topic = e.decodeParam(4);
if (!this._list.regexp || chanName.match(this._list.regexp) ||

View File

@ -43,7 +43,7 @@ const __cz_version = "0.9.67+";
const __cz_condition = "green";
const __cz_suffix = "";
const __cz_guid = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2";
const __cz_locale = "0.9.67.2";
const __cz_locale = "0.9.67.3";
var warn;
var ASSERT;

View File

@ -69,7 +69,7 @@
#
### End of notes ###
locale.version = 0.9.67.2
locale.version = 0.9.67.3
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
@ -832,8 +832,9 @@ msg.default.alias.help = This command is an alias for |%1$S|.
msg.extra.params = Extra parameters ``%1$S'' ignored.
msg.version.reply = Chatzilla %S [%S]
msg.source.reply = http://hacksrus.com/~ginda/chatzilla/
msg.nothing.to.cancel = No connection in progress, nothing to cancel.
msg.nothing.to.cancel = No connection or /list in progress, nothing to cancel.
msg.cancelling = Cancelling connection to ``%S''...
msg.cancelling.list = Cancelling /list request...
msg.current.charset = Using ``%S'' as default character encoding.
msg.current.charset.view = Using ``%S'' as character encoding for this view.
msg.current.css = Using <%S> as default motif.