diff --git a/extensions/irc/xul/content/handlers.js b/extensions/irc/xul/content/handlers.js index 3d89618e6695..07359e512f1c 100644 --- a/extensions/irc/xul/content/handlers.js +++ b/extensions/irc/xul/content/handlers.js @@ -123,9 +123,6 @@ function onClose() if ("userClose" in client && client.userClose) return true; - client.userClose = true; - display(MSG_CLOSING); - if (!("getConnectionCount" in client) || client.getConnectionCount() == 0) { @@ -134,7 +131,23 @@ function onClose() } /* otherwise, try to close out gracefully */ - client.quit(client.userAgent); + var close = true; + if (client.prefs["warnOnClose"]) + { + const buttons = ["!yes", "!no"]; + var checkState = { value: true }; + var rv = confirmEx(MSG_CONFIRM_QUIT, buttons, 0, MSG_WARN_ON_EXIT, + checkState); + close = (rv == 0); + client.prefs["warnOnClose"] = checkState.value; + } + + if (close) + { + client.userClose = true; + display(MSG_CLOSING); + client.quit(client.userAgent); + } return false; } diff --git a/extensions/irc/xul/content/prefs.js b/extensions/irc/xul/content/prefs.js index 0bab684440b3..f9091a5aacd9 100644 --- a/extensions/irc/xul/content/prefs.js +++ b/extensions/irc/xul/content/prefs.js @@ -196,7 +196,8 @@ function initPrefs() ["usermode", "+i", ".ident"], ["userHeader", true, "global.header"], ["userLog", false, "global.log"], - ["userMaxLines", 200, "global.maxLines"] + ["userMaxLines", 200, "global.maxLines"], + ["warnOnClose", true, "global"] ]; client.prefManager.addPrefs(prefs); diff --git a/extensions/irc/xul/locale/en-US/chatzilla.properties b/extensions/irc/xul/locale/en-US/chatzilla.properties index 23ac99bb3459..c4bfb980a304 100644 --- a/extensions/irc/xul/locale/en-US/chatzilla.properties +++ b/extensions/irc/xul/locale/en-US/chatzilla.properties @@ -942,6 +942,8 @@ msg.tabdnd.drop = Would you like to use the file ``%S'' as your new motif? msg.default.status = Welcome to ChatZilla! msg.closing = Disconnecting from IRC. Click close again to exit now. +msg.confirm.quit = You are still connected to some networks, are you sure you want to quit ChatZilla?\nConfirming will close the window, and disconnect from all the networks and channels you're connected to. +msg.warn.on.exit = Warn me when quitting while still connected msg.whois.name = "%S <%S@%S> ``%S'' msg.whois.channels = "%S: member of %S" @@ -1270,6 +1272,8 @@ pref.username.label = Username pref.username.help = Your username is used to construct your "host mask", which is a string representing you, by including your connection's host name and this username. It is sometimes used for setting auto-op, bans, and other things specific to one person. pref.usermode.label = Usermode pref.usermode.help = Your usermode determines how the IRC server treats you (it is a list of letters preceded by "+") - for example, you can get the server to send to message about "behind the scenes"-like things but setting a different usermode. The most common option, "i", makes you not show up as a member of a channel unless the user making the query is already in the channel (it stands for "invisible"). +pref.warnOnClose.label = Warn me when quitting while still connected +pref.warnOnClose.help = When quitting while still connected to networks, a message appears asking you if you are sure you want to quit. Uncheck this to disable it. # Preference group labels #