]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add notice redirection to message window option.
authorChris Porter <redacted>
Fri, 5 Dec 2008 12:20:17 +0000 (12:20 +0000)
committerChris Porter <redacted>
Fri, 5 Dec 2008 12:20:17 +0000 (12:20 +0000)
\r\n are quoted in messages sent.

TODO.txt
js/irc/baseircclient.js
js/irc/ircclient.js
js/ui/baseuiwindow.js
js/ui/optionspane.js

index 15c36fe3d8c3061922695f95d7ca02e137e17efc..c7f76a3a2b6c5d7719cea774ae7ba954f3647c57 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,7 +4,7 @@ UI:
   FEAT: block backspace\r
   TIDY: [enter] in text box should trigger event instead of having a form there?\r
   FEAT: about DIALOG?\r
-  FEAT: Save last nick in cookies.\r
+  FEAT: Save last nick/chans in cookies.\r
   FEAT: multiline pastes\r
   FEAT: link motd and embedded wizard somewhere more obvious.\r
   FEAT: Last position line\r
@@ -20,8 +20,7 @@ IRC:
   \r
 Options pane:\r
   FEAT: Store options server side when logged in.\r
+  FEAT: Add option to redirect notices to message window.\r
   \r
 Other:\r
   BUG: IE7 seems to be broke\r
-  BUG: check to see if newlines are passed through (or \r).\r
-  
\ No newline at end of file
index df434850ab4b499abd99272c703a2a3c38098515..e44de7e48ba5e2611b208ce475a40c5f17193b03 100644 (file)
@@ -210,8 +210,8 @@ qwebirc.irc.BaseIRCClient = new Class({
     var target = params[0];
     var message = params.indexFromEnd(-1);
     
-    if(user == "") {
-      this.serverNotice(message);
+    if((user == "") || (user.indexOf("!") == -1)) {
+      this.serverNotice(user, message);
     } else if(target == this.nickname) {
       var ctcp = this.processCTCP(message);
       if(ctcp) {
index 9e121f8c8307b3d9af8e64bd819a072495ffaae3..d8c742b419d4eefc9fbc8849f441a27ddfd8a971 100644 (file)
@@ -109,18 +109,32 @@ qwebirc.irc.IRCClient = new Class({
   getQueryWindow: function(name) {
     return this.ui.getWindow(this, qwebirc.ui.WINDOW_QUERY, name);
   },
-  newQueryWindow: function(name) {
-    if(this.ui.uiOptions.DEDICATED_MSG_WINDOW && !this.ui.getWindow(this, qwebirc.ui.WINDOW_MESSAGES) && !this.getQueryWindow(name))
+  newQueryWindow: function(name, privmsg) {
+    var e;
+    if(privmsg) {
+      e = this.ui.uiOptions.DEDICATED_MSG_WINDOW;
+    } else {
+      e = this.ui.uiOptions.DEDICATED_NOTICE_WINDOW;
+    }
+    if(e && !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);
+      
+    if(privmsg)
+      return this.newWindow(name, qwebirc.ui.WINDOW_QUERY, false);
   },
-  newQueryLine: function(window, type, data, active) {
+  newQueryLine: function(window, type, data, privmsg, active) {
     if(this.getQueryWindow(window))
       return this.newLine(window, type, data);
       
     var w = this.ui.getWindow(this, qwebirc.ui.WINDOW_MESSAGES);
     
-    if(this.ui.uiOptions.DEDICATED_MSG_WINDOW && w) {
+    var e;
+    if(privmsg) {
+      e = this.ui.uiOptions.DEDICATED_MSG_WINDOW;
+    } else {
+      e = this.ui.uiOptions.DEDICATED_NOTICE_WINDOW;
+    }
+    if(e && w) {
       return w.addLine(type, data);
     } else {
       if(active) {
@@ -130,8 +144,8 @@ qwebirc.irc.IRCClient = new Class({
       }
     }
   },
-  newQueryOrActiveLine: function(window, type, data) {
-    this.newQueryLine(window, type, data, true);
+  newQueryOrActiveLine: function(window, type, data, privmsg) {
+    this.newQueryLine(window, type, data, privmsg, true);
   },
   getActiveWindow: function() {
     return this.ui.getActiveIRCWindow(this);
@@ -314,8 +328,8 @@ qwebirc.irc.IRCClient = new Class({
       args = "";
     
     if(type == "ACTION") {      
-      this.newQueryWindow(nick);
-      this.newQueryLine(nick, "PRIVACTION", {"m": args, "x": type, "h": host, "n": nick});
+      this.newQueryWindow(nick, true);
+      this.newQueryLine(nick, "PRIVACTION", {"m": args, "x": type, "h": host, "n": nick}, true);
       return;
     }
     
@@ -352,18 +366,27 @@ qwebirc.irc.IRCClient = new Class({
     var nick = user.hostToNick();
     var host = user.hostToHost();
     
-    this.newQueryWindow(nick);
+    this.newQueryWindow(nick, true);
     this.pushLastNick(nick);
-    this.newQueryLine(nick, "PRIVMSG", {"m": message, "h": host, "n": nick});
+    this.newQueryLine(nick, "PRIVMSG", {"m": message, "h": host, "n": nick}, true);
   },
-  serverNotice: function(message) {
-    this.newServerLine("SERVERNOTICE", {"m": message});
+  serverNotice: function(user, message) {
+    if(user == "") {
+      this.newServerLine("SERVERNOTICE", {"m": message});
+    } else {
+      this.newServerLine("PRIVNOTICE", {"m": message, "n": user});
+    }
   },
   userNotice: function(user, message) {
     var nick = user.hostToNick();
     var host = user.hostToHost();
 
-    this.newTargetOrActiveLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick});
+    if(this.ui.uiOptions.DEDICATED_NOTICE_WINDOW) {
+      this.newQueryWindow(nick, false);
+      this.newQueryOrActiveLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick}, false);
+    } else {
+      this.newTargetOrActiveLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick});
+    }
   },
   userInvite: function(user, channel) {
     var nick = user.hostToNick();
@@ -429,7 +452,7 @@ qwebirc.irc.IRCClient = new Class({
     this.disconnect();
   },
   awayMessage: function(nick, message) {
-    this.newQueryLine(nick, "AWAY", {"n": nick, "m": message});
+    this.newQueryLine(nick, "AWAY", {"n": nick, "m": message}, true);
   },
   whois: function(nick, type, data) {
     var ndata = {"n": nick};
@@ -484,7 +507,7 @@ qwebirc.irc.IRCClient = new Class({
     this.newTargetOrActiveLine(target, "GENERICERROR", {m: message, t: target});
   },
   genericQueryError: function(target, message) {
-    this.newQueryOrActiveLine(target, "GENERICERROR", {m: message, t: target});
+    this.newQueryOrActiveLine(target, "GENERICERROR", {m: message, t: target}, true);
   },
   awayStatus: function(state, message) {
     this.newActiveLine("GENERICMESSAGE", {m: message});
index 30b3049b00cbb39848c96c235bb9690ff657da77..bde4c4f5b4ab00bcbf7d6c7456d744981d8efc7d 100644 (file)
@@ -77,7 +77,7 @@ qwebirc.ui.Window = new Class({
       
       if(type.match(/(NOTICE|ACTION|MSG)$/)) {
         if(this.type == qwebirc.ui.WINDOW_QUERY || this.type == qwebirc.ui.WINDOW_MESSAGES) {
-          if(type.match(/^OUR/)) {
+          if(type.match(/^OUR/) || type.match(/NOTICE$/)) {
             hilight = qwebirc.ui.HILIGHT_ACTIVITY;
           } else {
             hilight = qwebirc.ui.HILIGHT_US;
index f85133205bd76ecd8635d2b963c58501541063c9..fc698f81499e79f62530522eaea2d924032e8d40 100644 (file)
@@ -15,7 +15,8 @@ qwebirc.config.DEFAULT_OPTIONS = [
         ui.setBeepOnMention(value);
     }
   }],
-  [2, "DEDICATED_MSG_WINDOW", "Use dedicated messages window", false],
+  [2, "DEDICATED_MSG_WINDOW", "Send privmsgs to dedicated messages window", false],
+  [4, "DEDICATED_NOTICE_WINDOW", "Send notices to dedicated message window", false],
   [3, "NICK_OV_STATUS", "Show status (@/+) before nicknames", true]
 ];