зеркало из https://github.com/mozilla/gecko-dev.git
Bug 289135 - Support cancelling during the connect better, and make sure closing a view cancels the connect and does not re-open the view.
ChatZilla only. r=silver p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch)
This commit is contained in:
Родитель
97e70bc1c0
Коммит
6af5ca7999
|
@ -264,16 +264,28 @@ function net_quit (reason)
|
|||
CIRCNetwork.prototype.cancel =
|
||||
function net_cancel()
|
||||
{
|
||||
// We're online, pull the plug on the current connection, or...
|
||||
if (this.state == NET_ONLINE)
|
||||
{
|
||||
// Pull the plug on the current connection, or...
|
||||
this.quit();
|
||||
}
|
||||
else if ((this.state == NET_CONNECTING) || (this.state == NET_WAITING))
|
||||
// We're waiting for the 001, too late to throw a reconnect, or...
|
||||
else if (this.state == NET_CONNECTING)
|
||||
{
|
||||
this.state = NET_CANCELLING;
|
||||
|
||||
// ...try a reconnect (which will fail us).
|
||||
this.primServ.connection.disconnect();
|
||||
// Throw the necessary error events:
|
||||
ev = new CEvent ("network", "error", this, "onError");
|
||||
ev.server = this;
|
||||
ev.debug = "Connect sequence was cancelled.";
|
||||
ev.errorCode = JSIRC_ERR_CANCELLED;
|
||||
this.eventPump.addEvent(ev);
|
||||
}
|
||||
// We're waiting for onDoConnect, so try a reconnect (which will fail us)
|
||||
else if (this.state == NET_WAITING)
|
||||
{
|
||||
this.state = NET_CANCELLING;
|
||||
// onDoConnect will throw the error events for us, as it will fail
|
||||
this.immediateConnect();
|
||||
}
|
||||
else
|
||||
|
@ -980,7 +992,7 @@ function serv_disconnect(e)
|
|||
CIRCServer.prototype.onSendData =
|
||||
function serv_onsenddata (e)
|
||||
{
|
||||
if (!this.isConnected)
|
||||
if (!this.isConnected || (this.parent.state == NET_CANCELLING))
|
||||
{
|
||||
dd ("Can't send to disconnected socket");
|
||||
this.flushSendQueue();
|
||||
|
@ -1046,6 +1058,7 @@ function serv_poll(e)
|
|||
|
||||
try
|
||||
{
|
||||
if (this.parent.state != NET_CANCELLING)
|
||||
line = this.connection.readData(this.READ_TIMEOUT);
|
||||
}
|
||||
catch (ex)
|
||||
|
|
|
@ -863,6 +863,9 @@ function cmdCancel(e)
|
|||
(network.state == NET_WAITING))
|
||||
{
|
||||
// We're trying to connect to a network, and want to cancel. Do so:
|
||||
if (e.deleteWhenDone)
|
||||
e.network.deleteWhenDone = true;
|
||||
|
||||
display(getMsg(MSG_CANCELLING, network.unicodeName));
|
||||
network.cancel();
|
||||
}
|
||||
|
@ -1485,9 +1488,18 @@ function cmdDeleteView(e)
|
|||
e.view = e.sourceObject;
|
||||
|
||||
if (e.view.TYPE == "IRCChannel" && e.view.active)
|
||||
e.view.part();
|
||||
{
|
||||
e.view.dispatch("part", { deleteWhenDone: true });
|
||||
return;
|
||||
}
|
||||
if (e.view.TYPE == "IRCDCCChat" && e.view.active)
|
||||
e.view.disconnect();
|
||||
if (e.view.TYPE == "IRCNetwork" && (e.view.state == NET_CONNECTING ||
|
||||
e.view.state == NET_WAITING))
|
||||
{
|
||||
e.view.dispatch("cancel", { deleteWhenDone: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.viewsArray.length < 2)
|
||||
{
|
||||
|
@ -1659,7 +1671,7 @@ function cmdRejoin(e)
|
|||
{
|
||||
if (!e.reason)
|
||||
e.reason = "";
|
||||
e.channel.dispatch("part", { reason: e.reason, noDelete: true });
|
||||
e.channel.dispatch("part", { reason: e.reason, deleteWhenDone: false });
|
||||
}
|
||||
|
||||
e.channel.join(e.channel.mode.key);
|
||||
|
@ -2280,13 +2292,15 @@ function cmdLeave(e)
|
|||
}
|
||||
}
|
||||
|
||||
if (!("deleteWhenDone" in e))
|
||||
e.deleteWhenDone = client.prefs["deleteOnPart"];
|
||||
|
||||
/* If it's not active, we're not actually in it, even though the view is
|
||||
* still here.
|
||||
*/
|
||||
if (e.channel.active)
|
||||
{
|
||||
if (e.noDelete)
|
||||
e.channel.noDelete = true;
|
||||
e.channel.deleteWhenDone = e.deleteWhenDone;
|
||||
|
||||
if (!e.reason)
|
||||
e.reason = "";
|
||||
|
@ -2296,8 +2310,8 @@ function cmdLeave(e)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!e.noDelete && client.prefs["deleteOnPart"])
|
||||
e.channel.dispatch("delete");
|
||||
if (e.deleteWhenDone)
|
||||
e.channel.dispatch("delete-view");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1807,7 +1807,14 @@ function my_neterror (e)
|
|||
updateProgress();
|
||||
}
|
||||
|
||||
|
||||
this.display(msg, type);
|
||||
|
||||
if (this.deleteWhenDone)
|
||||
this.dispatch("delete-view");
|
||||
|
||||
delete this.deleteWhenDone;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1874,10 +1881,11 @@ function my_netdisconnect (e)
|
|||
{
|
||||
this.busy = false;
|
||||
updateProgress();
|
||||
|
||||
if (this.state != NET_CANCELLING)
|
||||
this.displayHere(msg, msgType);
|
||||
}
|
||||
else
|
||||
// Don't do anything if we're cancelling.
|
||||
else if (this.state != NET_CANCELLING)
|
||||
{
|
||||
for (var v in client.viewsArray)
|
||||
{
|
||||
|
@ -2258,10 +2266,10 @@ function my_cpart (e)
|
|||
/* redisplay the tree */
|
||||
client.rdf.setTreeRoot("user-list", this.getGraphResource());
|
||||
|
||||
if ("noDelete" in this)
|
||||
delete this.noDelete;
|
||||
else if (client.prefs["deleteOnPart"])
|
||||
this.dispatch("delete");
|
||||
if (this.deleteWhenDone)
|
||||
this.dispatch("delete-view");
|
||||
|
||||
delete this.deleteWhenDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -456,7 +456,7 @@ cmd.label-user.help =
|
|||
cmd.leave.format = Leave $channelName
|
||||
cmd.leave.label = &Leave
|
||||
cmd.leave.params = [<channel-name> [<reason>]]
|
||||
cmd.leave.help = Leaves the current channel. Use /delete to force the view to go away, losing its contents, or /hide to temporarily hide it, preserving its contents. Many servers do not support the optional <reason> parameter. If you are dispatching this command from a script, you may also specify the <no-delete> parameter. If this is provided and is |true|, |on|, |yes|, or |1|, the tab will not be deleted.
|
||||
cmd.leave.help = Leaves the current channel. Use /delete to force the view to go away, losing its contents, or /hide to temporarily hide it, preserving its contents. Many servers do not support the optional <reason> parameter. Your preferences are used to determine whether to delete the tab. If you are dispatching this command from a script, you may override this behaviour with the <delete-when-done> parameter.
|
||||
|
||||
cmd.links.help = Displays the "links" to the current server. This is a list of the other servers in the network which are directly connected to the one you are connected to.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче