Skip to content

Commit

Permalink
Don't prompt for navigation away from the page if iris is currently d…
Browse files Browse the repository at this point in the history
…isconnected from the IRC server. Based upon qwebirc commit 28e7d1238045.
  • Loading branch information
mrflea committed May 29, 2012
1 parent 6f6304b commit dff7b35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions js/irc/ircclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ qwebirc.irc.IRCClient = new Class({
}
this.tracker = undefined;

qwebirc.connected = false;
this.newServerLine("DISCONNECT", {"m": message});
},
nickOnChanHasPrefix: function(nick, channel, prefix) {
Expand Down Expand Up @@ -493,6 +494,7 @@ qwebirc.irc.IRCClient = new Class({
this.parent(key, value);
},
connected: function() {
qwebirc.connected = true;
this.newServerLine("CONNECT");
},
serverError: function(message) {
Expand Down
2 changes: 1 addition & 1 deletion js/qwebirc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var qwebirc = {ui: {themes: {}, style: {}}, irc: {}, util: {crypto: {}}, config: {}, options: {}, auth: {}, sound: {}};
var qwebirc = {ui: {themes: {}, style: {}}, irc: {}, util: {crypto: {}}, config: {}, options: {}, auth: {}, sound: {}, connected: false};
var conf = null;
var ui = null;

Expand Down
12 changes: 7 additions & 5 deletions js/ui/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ qwebirc.ui.create = function(element, uiclass) {

/* Displays a warning if the user tries to close their browser. */
qwebirc.ui.onbeforeunload = function(e) { /* IE sucks */
var message = "This action will close all active IRC connections.";
var e = e || window.event;
if(e)
e.returnValue = message;
return message;
if (qwebirc.connected) {
var message = "This action will close all active IRC connections.";
var e = e || window.event;
if(e)
e.returnValue = message;
return message;
}
};

0 comments on commit dff7b35

Please sign in to comment.