Bug 323786 - Show connection attempt delay in minutes/hours as appropriate. Also show delay with the error message, not with previous start-of-attempt message.

Go for 0.9.75.
ChatZilla only.
p=rdmsoft@bugs.rdmsoft.com (Robert Marshall)
r=silver
This commit is contained in:
silver%warwickcompsoc.co.uk 2006-07-30 00:28:31 +00:00
Родитель d0575206ac
Коммит 68f08233a0
5 изменённых файлов: 98 добавлений и 55 удалений

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

@ -215,6 +215,19 @@ function net_delayedConnect(eventProperties)
network.immediateConnect(eventProperties);
};
if ((-1 != this.MAX_CONNECT_ATTEMPTS) &&
(this.connectAttempt >= this.MAX_CONNECT_ATTEMPTS))
{
this.state = NET_OFFLINE;
var ev = new CEvent("network", "error", this, "onError");
ev.debug = "Connection attempts exhausted, giving up.";
ev.errorCode = JSIRC_ERR_EXHAUSTED;
this.eventPump.addEvent(ev);
return;
}
this.state = NET_WAITING;
this.reconnectTimer = setTimeout(reconnectFn,
this.getReconnectDelayMs(),
@ -347,20 +360,6 @@ function net_doconnect(e)
this.connectAttempt++;
this.connectCandidate++;
if ((-1 != this.MAX_CONNECT_ATTEMPTS) &&
(this.connectAttempt > this.MAX_CONNECT_ATTEMPTS))
{
this.state = NET_OFFLINE;
ev = new CEvent ("network", "error", this, "onError");
ev.server = this;
ev.debug = "Connection attempts exhausted, giving up.";
ev.errorCode = JSIRC_ERR_EXHAUSTED;
this.eventPump.addEvent(ev);
return false;
}
this.state = NET_CONNECTING; /* connection is considered "made" when server
* sends a 001 message (see server.on001) */

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

@ -682,14 +682,26 @@ function formatDateOffset (offset, format)
if (!format)
{
var ary = new Array();
if (days > 0)
ary.push (getMsg(MSG_DAYS, days));
if (hours > 0)
ary.push (getMsg(MSG_HOURS, hours));
if (minutes > 0)
ary.push (getMsg(MSG_MINUTES, minutes));
if (seconds > 0 || offset == 0)
ary.push (getMsg(MSG_SECONDS, seconds));
if (days == 1)
ary.push(MSG_DAY);
else if (days > 0)
ary.push(getMsg(MSG_DAYS, days));
if (hours == 1)
ary.push(MSG_HOUR);
else if (hours > 0)
ary.push(getMsg(MSG_HOURS, hours));
if (minutes == 1)
ary.push(MSG_MINUTE);
else if (minutes > 0)
ary.push(getMsg(MSG_MINUTES, minutes));
if (seconds == 1)
ary.push(MSG_SECOND);
else if (seconds > 0 || offset == 0)
ary.push(getMsg(MSG_SECONDS, seconds));
format = ary.join(", ");
}

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

@ -1742,18 +1742,8 @@ function my_sconnect (e)
if ("_firstNick" in this)
delete this._firstNick;
if (-1 == this.MAX_CONNECT_ATTEMPTS)
this.display (getMsg(MSG_CONNECTION_ATTEMPT_UNLIMITED,
[this.getURL(),
e.server.getURL(),
e.connectAttempt,
e.reconnectDelayMs / 1000]), "INFO");
else
this.display (getMsg(MSG_CONNECTION_ATTEMPT,
[this.getURL(),
e.server.getURL(),
e.connectAttempt,
this.MAX_CONNECT_ATTEMPTS]), "INFO");
this.display(getMsg(MSG_CONNECTION_ATTEMPT,
[this.getURL(), e.server.getURL()]), "INFO");
if (this.prefs["identd.enabled"])
{
@ -1779,7 +1769,7 @@ function my_neterror (e)
break;
case JSIRC_ERR_EXHAUSTED:
msg = MSG_ERR_EXHAUSTED;
// error already displayed in onDisconnect
break;
case JSIRC_ERR_OFFLINE:
@ -1810,7 +1800,8 @@ function my_neterror (e)
client.ident.removeNetwork(this);
this.display(msg, type);
if (msg)
this.display(msg, type);
if (this.deleteWhenDone)
this.dispatch("delete-view");
@ -1823,7 +1814,7 @@ function my_neterror (e)
CIRCNetwork.prototype.onDisconnect =
function my_netdisconnect (e)
{
var msg;
var msg, msgNetwork;
var msgType = "ERROR";
if (typeof e.disconnectStatus != "undefined")
@ -1874,25 +1865,47 @@ function my_netdisconnect (e)
{
msgType = "DISCONNECT";
msg = getMsg(MSG_CONNECTION_QUIT, [this.getURL(), e.server.getURL()]);
msgNetwork = msg;
}
else
{
var delayStr = formatDateOffset(this.getReconnectDelayMs() / 1000);
if (this.MAX_CONNECT_ATTEMPTS == -1)
{
msgNetwork = getMsg(MSG_RECONNECTING_IN, [msg, delayStr]);
}
else if (this.connectAttempt < this.MAX_CONNECT_ATTEMPTS)
{
var left = this.MAX_CONNECT_ATTEMPTS - this.connectAttempt;
if (left == 1)
{
msgNetwork = getMsg(MSG_RECONNECTING_IN_LEFT1, [msg, delayStr]);
}
else
{
msgNetwork = getMsg(MSG_RECONNECTING_IN_LEFT,
[msg, left, delayStr]);
}
}
else
{
msgNetwork = getMsg(MSG_CONNECTION_EXHAUSTED, msg);
}
}
/* If we were only /trying/ to connect, and failed, just put an error on
* the network tab. If we were actually connected ok, put it on all tabs.
/* If we were connected ok, put an error on all tabs. If we were only
* /trying/ to connect, and failed, just put it on the network tab.
*/
if (this.state != NET_ONLINE)
{
this.busy = false;
updateProgress();
if (this.state != NET_CANCELLING)
this.displayHere(msg, msgType);
}
// Don't do anything if we're cancelling.
else if (this.state != NET_CANCELLING)
if (this.state == NET_ONLINE)
{
for (var v in client.viewsArray)
{
var obj = client.viewsArray[v].source;
if (obj != client)
if (obj == this)
{
obj.displayHere(msgNetwork, msgType);
}
else if (obj != client)
{
var details = getObjectDetails(obj);
if ("server" in details && details.server == e.server)
@ -1900,6 +1913,17 @@ function my_netdisconnect (e)
}
}
}
else
{
this.busy = false;
updateProgress();
// Don't do anything if we're cancelling.
if (this.state != NET_CANCELLING)
{
this.displayHere(msgNetwork, msgType);
}
}
for (var c in this.primServ.channels)
{

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

@ -39,11 +39,11 @@
*
* ***** END LICENSE BLOCK ***** */
const __cz_version = "0.9.74";
const __cz_version = "0.9.75";
const __cz_condition = "green";
const __cz_suffix = "";
const __cz_guid = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2";
const __cz_locale = "0.9.74.4";
const __cz_locale = "0.9.75";
var warn;
var ASSERT;

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

@ -69,7 +69,7 @@
#
### End of notes ###
locale.version = 0.9.74.4
locale.version = 0.9.75
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
@ -738,7 +738,6 @@ msg.err.need.recip = Command ``%1$S'' must be run in the context of a user or
msg.err.no.default = Please do not just type into this tab, use an actual command instead.
msg.err.no.match = No match for ``%S''.
msg.err.no.socket = Error creating socket.
msg.err.exhausted = Connection attempts exhausted, giving up.
msg.err.no.secure = The network ``%S'' has no secure servers defined.
msg.err.cancelled = Connection process canceled.
msg.err.offline = The host software platform (e.g. Mozilla, Firefox) is in ``offline mode''. No network connections can be made in this mode.
@ -835,6 +834,10 @@ msg.days = "%S days
msg.hours = "%S hours
msg.minutes = "%S minutes
msg.seconds = "%S seconds
msg.day = 1 day
msg.hour = 1 hour
msg.minute = 1 minute
msg.second = 1 second
msg.rsp.hello = [HELLO]
@ -1157,8 +1160,7 @@ msg.list.end = Displayed %S of %S channels.
msg.who.end = End of WHO results for ``%S'', %S user(s) found.
msg.who.match = User %S, (%S@%S) ``%S'' (%S), member of %S, is connected to <irc://%S/>, %S hop(s).
msg.connection.attempt = Connecting to %S (%S), attempt %S of %S...
msg.connection.attempt.unlimited = Connecting to %S (%S), attempt %S, next attempt in %S seconds...
msg.connection.attempt = Connecting to %S (%S)...
msg.connection.refused = Connection to %S (%S) refused.
msg.connection.timeout = Connection to %S (%S) timed out.
msg.unknown.host = Unknown host ``%S'' connecting to %S (%S).
@ -1167,6 +1169,12 @@ msg.connection.reset = Connection to %S (%S) reset.
msg.connection.quit = Disconnected from %S (%S).
msg.close.status = Connection to %S (%S) closed with status %S.
# In these messages, %1$S is a connection error from above.
msg.connection.exhausted = "%1$S Connection attempts exhausted, giving up.
msg.reconnecting.in = "%1$S Reconnecting in %2$S.
msg.reconnecting.in.left = "%1$S %2$S attempts left, reconnecting in %3$S.
msg.reconnecting.in.left1 = "%1$S 1 attempt left, reconnecting in %2$S.
msg.reconnecting = Reconnecting...
msg.confirm.disconnect.all = Are you sure you want to disconnect from ALL networks?
msg.no.connected.nets = You are not connected to any networks.