Remove some excess console.log and tidy up some close calls

This commit is contained in:
Dave C-J 2013-10-15 21:12:30 +01:00
parent 4780c2bfe8
commit d8a6e28950
3 changed files with 21 additions and 29 deletions

View File

@ -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");
}
}

View File

@ -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);
});

View File

@ -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();
}
}