From 12f49379e7ef935b341ee00f2b92366604d43279 Mon Sep 17 00:00:00 2001 From: "gijskruitbosch%gmail.com" Date: Sat, 4 Mar 2006 22:43:53 +0000 Subject: [PATCH] Bug 329274 - Quit when connected prompt is too enthusiastic. ChatZilla Only. r=samuel --- extensions/irc/xul/content/commands.js | 11 ++++++++++- extensions/irc/xul/content/handlers.js | 7 ++----- extensions/irc/xul/content/static.js | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/extensions/irc/xul/content/commands.js b/extensions/irc/xul/content/commands.js index fe578f9a59c1..b7ef927d1cc8 100644 --- a/extensions/irc/xul/content/commands.js +++ b/extensions/irc/xul/content/commands.js @@ -1454,7 +1454,16 @@ function cmdSSLServer(e) function cmdQuit(e) { - client.wantToQuit(e.reason); + // if we're not connected to anything, just close the window + if (!("getConnectionCount" in client) || (client.getConnectionCount() == 0)) + { + client.userClose = true; + window.close(); + return; + } + + // Otherwise, try to close gracefully: + client.wantToQuit(e.reason, true); } function cmdDisconnect(e) diff --git a/extensions/irc/xul/content/handlers.js b/extensions/irc/xul/content/handlers.js index 48fa6d533a36..4ba9ba4291ec 100644 --- a/extensions/irc/xul/content/handlers.js +++ b/extensions/irc/xul/content/handlers.js @@ -125,12 +125,9 @@ function onClose() if ("userClose" in client && client.userClose) return true; - if (!("getConnectionCount" in client) || - client.getConnectionCount() == 0) - { - /* if we're not connected to anything, just close the window */ + // if we're not connected to anything, just close the window + if (!("getConnectionCount" in client) || (client.getConnectionCount() == 0)) return true; - } /* otherwise, try to close out gracefully */ client.wantToQuit(); diff --git a/extensions/irc/xul/content/static.js b/extensions/irc/xul/content/static.js index 57177d3a33f4..61e0f70066a3 100644 --- a/extensions/irc/xul/content/static.js +++ b/extensions/irc/xul/content/static.js @@ -4420,11 +4420,11 @@ function cli_quit (reason) } client.wantToQuit = -function cli_wantToQuit(reason) +function cli_wantToQuit(reason, deliberate) { var close = true; - if (client.prefs["warnOnClose"]) + if (client.prefs["warnOnClose"] && !deliberate) { const buttons = ["!yes", "!no"]; var checkState = { value: true };