From 88606438f208c4b2307958aa84c87796a31ff724 Mon Sep 17 00:00:00 2001 From: Ted Goddard Date: Thu, 17 Apr 2014 11:38:22 -0600 Subject: [PATCH 1/2] support for use_strict use unicode escapes to allow node --use_strict --- lib/irc.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/irc.js b/lib/irc.js index f9ea02c4..83faf6d4 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -205,7 +205,7 @@ function Client(server, nick, opt) { to = null; } var text = message.args[1] || ''; - if (text[0] === '\1' && text.lastIndexOf('\1') > 0) { + if (text[0] === '\\u1' && text.lastIndexOf('\\u1') > 0) { self._handleCTCP(from, to, text, 'notice', message); break; } @@ -464,7 +464,7 @@ function Client(server, nick, opt) { var from = message.nick; var to = message.args[0]; var text = message.args[1] || ''; - if (text[0] === '\1' && text.lastIndexOf('\1') > 0) { + if (text[0] === '\\u1' && text.lastIndexOf('\\u1') > 0) { self._handleCTCP(from, to, text, 'privmsg', message); break; } @@ -532,17 +532,17 @@ function Client(server, nick, opt) { case "err_umodeunknownflag": if ( self.opt.showErrors ) - util.log("\033[01;31mERROR: " + util.inspect(message) + "\033[0m"); + util.log("\\u033[01;31mERROR: " + util.inspect(message) + "\\u033[0m"); break; default: if ( message.commandType == 'error' ) { self.emit('error', message); if ( self.opt.showErrors ) - util.log("\033[01;31mERROR: " + util.inspect(message) + "\033[0m"); + util.log("\\u033[01;31mERROR: " + util.inspect(message) + "\\u033[0m"); } else { if ( self.opt.debug ) - util.log("\033[01;31mUnhandled message: " + util.inspect(message) + "\033[0m"); + util.log("\\u033[01;31mUnhandled message: " + util.inspect(message) + "\\u033[0m"); } break; } @@ -847,7 +847,7 @@ Client.prototype._clearWhoisData = function(nick) { // {{{ } // }}} Client.prototype._handleCTCP = function(from, to, text, type, message) { text = text.slice(1) - text = text.slice(0, text.indexOf('\1')) + text = text.slice(0, text.indexOf('\\u1')) var parts = text.split(' ') this.emit('ctcp', from, to, text, type, message) this.emit('ctcp-'+type, from, to, text, message) From 7b6433b986de5e98d2f0d7cd7e4d3949991db3bc Mon Sep 17 00:00:00 2001 From: Ted Goddard Date: Tue, 6 May 2014 15:53:00 -0600 Subject: [PATCH 2/2] fixed unicode escapes for control characters --- lib/irc.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/irc.js b/lib/irc.js index 83faf6d4..33393a60 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -205,7 +205,7 @@ function Client(server, nick, opt) { to = null; } var text = message.args[1] || ''; - if (text[0] === '\\u1' && text.lastIndexOf('\\u1') > 0) { + if (text[0] === '\u0001' && text.lastIndexOf('\u0001') > 0) { self._handleCTCP(from, to, text, 'notice', message); break; } @@ -464,7 +464,7 @@ function Client(server, nick, opt) { var from = message.nick; var to = message.args[0]; var text = message.args[1] || ''; - if (text[0] === '\\u1' && text.lastIndexOf('\\u1') > 0) { + if (text[0] === '\u0001' && text.lastIndexOf('\u0001') > 0) { self._handleCTCP(from, to, text, 'privmsg', message); break; } @@ -532,18 +532,17 @@ function Client(server, nick, opt) { case "err_umodeunknownflag": if ( self.opt.showErrors ) - util.log("\\u033[01;31mERROR: " + util.inspect(message) + "\\u033[0m"); + util.log("\u001b[01;31mERROR: " + util.inspect(message) + "\u001b[0m"); break; default: if ( message.commandType == 'error' ) { self.emit('error', message); if ( self.opt.showErrors ) - util.log("\\u033[01;31mERROR: " + util.inspect(message) + "\\u033[0m"); + util.log("\u001b[01;31mERROR: " + util.inspect(message) + "\u001b[0m"); } else { if ( self.opt.debug ) - util.log("\\u033[01;31mUnhandled message: " + util.inspect(message) + "\\u033[0m"); - } + util.log("\u001b[01;31mUnhandled message: " + util.inspect(message) + "\u001b break; } }); // }}} @@ -847,7 +846,7 @@ Client.prototype._clearWhoisData = function(nick) { // {{{ } // }}} Client.prototype._handleCTCP = function(from, to, text, type, message) { text = text.slice(1) - text = text.slice(0, text.indexOf('\\u1')) + text = text.slice(0, text.indexOf('\u0001')) var parts = text.split(' ') this.emit('ctcp', from, to, text, type, message) this.emit('ctcp-'+type, from, to, text, message)