diff --git a/extensions/irc/locales/en-US/chrome/chatzilla.properties b/extensions/irc/locales/en-US/chrome/chatzilla.properties index 99f67a3aa29..629895ecadc 100644 --- a/extensions/irc/locales/en-US/chrome/chatzilla.properties +++ b/extensions/irc/locales/en-US/chrome/chatzilla.properties @@ -1234,6 +1234,7 @@ msg.mode.all = Mode for %S is %S" msg.mode.changed = Mode %S by %S" msg.away.on = You are now marked as away (%S). Click the nickname button or use the |/back| command to return from being away. +msg.idle.away.on = You have automatically been marked as away (%S) after %S minutes of inactivity. msg.away.off = You are no longer marked as away. msg.away.prompt = Enter an away message to use: msg.away.default = I'm not here right now. diff --git a/extensions/irc/xul/content/commands.js b/extensions/irc/xul/content/commands.js index 4f24941dd27..0744f0b7fca 100644 --- a/extensions/irc/xul/content/commands.js +++ b/extensions/irc/xul/content/commands.js @@ -2849,7 +2849,8 @@ function cmdAway(e) // user doesn't want to change nicks: if (awayNick && (normalNick != awayNick)) e.server.changeNick(awayNick); - e.server.sendData("AWAY :" + fromUnicode(e.reason, e.network) + "\n"); + e.server.sendData("AWAY :" + fromUnicode(e.reason, e.network) + + "\n"); } if (awayNick && (normalNick != awayNick)) e.network.preferredNick = awayNick; @@ -2860,10 +2861,20 @@ function cmdAway(e) // Client view, do command for all networks. sendToAllNetworks("away", e.reason); client.prefs["away"] = e.reason; - if (("frame" in client) && client.frame) - client.display(getMsg(MSG_AWAY_ON, e.reason)); + + // Don't tell people how to get back if they're idle: + var idleMsgParams = [e.reason, client.prefs["awayIdleTime"]]; + if (e.command.name == "idle-away") + var msg = getMsg(MSG_IDLE_AWAY_ON, idleMsgParams); else - display(getMsg(MSG_AWAY_ON, e.reason)); + msg = getMsg(MSG_AWAY_ON, e.reason); + + // Display on the *client* tab, or on the current tab iff + // there's nowhere else they'll hear about it: + if (("frame" in client) && client.frame) + client.display(msg); + else if (!client.getConnectedNetworks()) + display(msg); } } else @@ -2891,7 +2902,7 @@ function cmdAway(e) sendToAllNetworks("back"); if (("frame" in client) && client.frame) client.display(MSG_AWAY_OFF); - else + else if (!client.getConnectedNetworks()) display(MSG_AWAY_OFF); } } diff --git a/extensions/irc/xul/content/handlers.js b/extensions/irc/xul/content/handlers.js index e7abebbabe7..c1bfbc84fa5 100644 --- a/extensions/irc/xul/content/handlers.js +++ b/extensions/irc/xul/content/handlers.js @@ -143,7 +143,7 @@ function onUnload() { dd("Shutting down ChatZilla."); uninitOfflineIcon(); - uninitIdleAutoAway(client.prefs["idleAutoAway"]); + uninitIdleAutoAway(client.prefs["awayIdleTime"]); destroy(); } @@ -1284,7 +1284,11 @@ function my_305(e) CIRCNetwork.prototype.on306 = function my_306(e) { - this.display(getMsg(MSG_AWAY_ON, this.prefs["away"])); + var idleMsgParams = [this.prefs["away"], client.prefs["awayIdleTime"]]; + if (!this.isIdleAway) + this.display(getMsg(MSG_AWAY_ON, this.prefs["away"])); + else + this.display(getMsg(MSG_IDLE_AWAY_ON, idleMsgParams)); return true; }