From: Chris Porter Date: Fri, 5 Dec 2008 00:19:49 +0000 (+0000) Subject: Fix lowercase/uppercase queries/windows. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/26c81b65334fe4fde4800214ad56366fb112b057?hp=be7754cd7e70047e118fdc150115d4e69a1d4d97 Fix lowercase/uppercase queries/windows. Don't allow /query to target windows. --- diff --git a/TODO.txt b/TODO.txt index 62f7be6..6678166 100644 --- a/TODO.txt +++ b/TODO.txt @@ -23,5 +23,5 @@ Options pane: Other: BUG: IE7 seems to be broke - BUG: Queries: upper/lowercase issues. + \ No newline at end of file diff --git a/js/irc/commandparser.js b/js/irc/commandparser.js index 04070cd..12ef4bd 100644 --- a/js/irc/commandparser.js +++ b/js/irc/commandparser.js @@ -179,6 +179,11 @@ qwebirc.irc.CommandParser = new Class({ } }], cmd_QUERY: [false, 2, 1, function(args) { + if(this.parentObject.isChannel(args[0])) { + this.getActiveWindow().errorMessage("Can't target a channel with this command."); + return; + } + this.parentObject.newWindow(args[0], qwebirc.ui.WINDOW_QUERY, true); if((args.length > 1) && (args[1] != "")) diff --git a/js/irc/ircclient.js b/js/irc/ircclient.js index 47c8361..b6224be 100644 --- a/js/irc/ircclient.js +++ b/js/irc/ircclient.js @@ -89,15 +89,15 @@ qwebirc.irc.IRCClient = new Class({ w.updateNickList(sortednames); }, getWindow: function(name) { - return this.windows[name]; + return this.windows[name.toIRCLower()]; }, newWindow: function(name, type, select) { var w = this.getWindow(name); if(!w) { - w = this.windows[name] = this.ui.newWindow(this, type, name); + w = this.windows[name.toIRCLower()] = this.ui.newWindow(this, type, name); w.addEvent("close", function(w) { - delete this.windows[name]; + delete this.windows[name.toIRCLower()]; }.bind(this)); } @@ -106,13 +106,16 @@ qwebirc.irc.IRCClient = new Class({ return w; }, + getQueryWindow: function(name) { + return this.ui.getWindow(this, qwebirc.ui.WINDOW_QUERY, name); + }, newQueryWindow: function(name) { - if(this.ui.uiOptions.DEDICATED_MSG_WINDOW) + if(this.ui.uiOptions.DEDICATED_MSG_WINDOW && !this.ui.getWindow(this, qwebirc.ui.WINDOW_MESSAGES) && !this.getQueryWindow(name)) return this.ui.newWindow(this, qwebirc.ui.WINDOW_MESSAGES, "Messages"); return this.newWindow(name, qwebirc.ui.WINDOW_QUERY, false); }, newQueryLine: function(window, type, data, active) { - if(this.getWindow(window)) + if(this.getQueryWindow(window)) return this.newLine(window, type, data); var w = this.ui.getWindow(this, qwebirc.ui.WINDOW_MESSAGES); diff --git a/js/ui/baseui.js b/js/ui/baseui.js index 6b2887f..2e47e85 100644 --- a/js/ui/baseui.js +++ b/js/ui/baseui.js @@ -56,7 +56,7 @@ qwebirc.ui.BaseUI = new Class({ return "-M"; if(type == qwebirc.ui.WINDOW_STATUS) return ""; - return "_" + name; + return "_" + name.toIRCLower(); }, newWindow: function(client, type, name) { var w = this.getWindow(client, type, name);