diff --git a/nodes/social/91-irc.html b/nodes/social/91-irc.html index 10f062ec9..7e0fa3cbc 100644 --- a/nodes/social/91-irc.html +++ b/nodes/social/91-irc.html @@ -65,12 +65,12 @@ -
Sending complete object will stringify the whole msg object before sending.
+
Sending the complete object will stringify the whole msg object before sending.
@@ -103,7 +103,7 @@
- +
diff --git a/nodes/social/91-irc.js b/nodes/social/91-irc.js index 4041147dc..acc7fc974 100644 --- a/nodes/social/91-irc.js +++ b/nodes/social/91-irc.js @@ -16,6 +16,7 @@ var RED = require("../../red/red"); var irc = require("irc"); +var util = require("util"); // The Server Definition - this opens (and closes) the connection function IRCServerNode(n) { @@ -26,13 +27,15 @@ function IRCServerNode(n) { this.ircclient = new irc.Client(this.server, this.nickname, { channels: [this.channel] }); + this.ircclient.addListener('error', function(message) { + util.log('[irc] '+ JSON.stringify(message)); + }); this._close = function() { this.ircclient.disconnect(); } } RED.nodes.registerType("irc-server",IRCServerNode); - IRCServerNode.prototype.close = function() { this._close(); } @@ -46,17 +49,12 @@ function IrcInNode(n) { this.ircclient = this.serverConfig.ircclient; var node = this; - this.ircclient.addListener('message', function (from, to, message) { console.log(from + ' => ' + to + ': ' + message); var msg = { "topic":from, "to":to, "payload":message }; node.send(msg); }); - this.ircclient.addListener('error', function(message) { - node.error(JSON.stringify(message)); - }); - } RED.nodes.registerType("irc in",IrcInNode); @@ -71,7 +69,7 @@ function IrcOutNode(n) { var node = this; this.on("input", function(msg) { - console.log(msg); + //console.log(msg,node.channel); if (node.sendAll) { node.ircclient.say(node.channel, JSON.stringify(msg)); }