From bce415df277db25519bd702a08a3431dde2480e8 Mon Sep 17 00:00:00 2001 From: ota42y Date: Thu, 8 Jan 2015 07:30:15 +0900 Subject: [PATCH 1/2] fix data split delimiter --- lib/irc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/irc.js b/lib/irc.js index e2cada79..c117844f 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -736,7 +736,7 @@ Client.prototype.connect = function(retryCount, callback) { buffer = Buffer.concat([buffer, chunk]); } - var lines = self.convertEncoding(buffer).toString().split('\r\n'); + var lines = self.convertEncoding(buffer).toString().split(/\r\n|\r|\n/); if (lines.pop()) { // if buffer is not ended with \r\n, there's more chunks. From 84c211014a693c20cb4e7900c0963301f6fcbc8e Mon Sep 17 00:00:00 2001 From: ota42y Date: Sat, 10 Jan 2015 00:01:43 +0900 Subject: [PATCH 2/2] use RegExp object --- lib/irc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/irc.js b/lib/irc.js index c117844f..80ef127e 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -28,6 +28,8 @@ exports.colors = colors; var replyFor = require('./codes'); +var lineDelimiter = new RegExp('\r\n|\r|\n') + function Client(server, nick, opt) { var self = this; self.opt = { @@ -736,7 +738,7 @@ Client.prototype.connect = function(retryCount, callback) { buffer = Buffer.concat([buffer, chunk]); } - var lines = self.convertEncoding(buffer).toString().split(/\r\n|\r|\n/); + var lines = self.convertEncoding(buffer).toString().split(lineDelimiter); if (lines.pop()) { // if buffer is not ended with \r\n, there's more chunks.