diff --git a/nodes/social/61-imap.js b/nodes/social/61-imap.js index 6d30bf167..e5237a599 100644 --- a/nodes/social/61-imap.js +++ b/nodes/social/61-imap.js @@ -16,7 +16,7 @@ var RED = require("../../red/red"); var Imap = require('imap'); -var inspect = require('util').inspect; +var util = require('util'); var oldmail = {}; try { @@ -33,12 +33,8 @@ var imap = new Imap({ secure: true }); -function show(obj) { - return inspect(obj, false, Infinity); -} - function fail(err) { - console.log('[imap] : ' + err); + util.log('[imap] : ' + err); } function openInbox(cb) { @@ -101,14 +97,12 @@ function ImapNode(n) { }); }); + + this.on("close", function() { + if (this.interval_id != null) { + clearInterval(this.interval_id); + } + }); } RED.nodes.registerType("imap",ImapNode); - -ImapNode.prototype.close = function() { - if (this.interval_id != null) { - clearInterval(this.interval_id); - this.log("inject: repeat stopped"); - } -} - diff --git a/nodes/social/91-irc.js b/nodes/social/91-irc.js index 21456c32d..2073aad81 100644 --- a/nodes/social/91-irc.js +++ b/nodes/social/91-irc.js @@ -51,7 +51,7 @@ function IrcInNode(n) { var node = this; this.ircclient.addListener('message', function (from, to, message) { - console.log(from + ' => ' + to + ': ' + message); + //util.log(from + ' => ' + to + ': ' + message); var msg = { "topic":from, "to":to, "payload":message }; node.send(msg); }); diff --git a/nodes/storage/66-mongodb.js b/nodes/storage/66-mongodb.js index 6378538e7..a5db7af3e 100644 --- a/nodes/storage/66-mongodb.js +++ b/nodes/storage/66-mongodb.js @@ -51,7 +51,6 @@ function MongoOutNode(n) { else coll.save(msg,function(err,item){if (err){node.error(err);}}); } if (node.operation == "delete") { - console.log(msg.payload); coll.remove(msg.payload, {w:1}, function(err, items){ if (err) node.error(err); }); } }); @@ -62,15 +61,15 @@ function MongoOutNode(n) { } else { this.error("missing mongodb configuration"); } -} + this.on("close", function() { + if (this.clientDb) { + this.clientDb.close(); + } + }); +} RED.nodes.registerType("mongodb out",MongoOutNode); -MongoOutNode.prototype.close = function() { - if (this.clientDb) { - this.clientDb.close(); - } -} function MongoInNode(n) { RED.nodes.createNode(this,n); @@ -105,12 +104,11 @@ function MongoInNode(n) { } else { this.error("missing mongodb configuration"); } -} + this.on("close", function() { + if (this.clientDb) { + this.clientDb.close(); + } + }); +} RED.nodes.registerType("mongodb in",MongoInNode); - -MongoInNode.prototype.close = function() { - if (this.clientDb) { - this.clientDb.close(); - } -}