diff --git a/lib/parser_email.js b/lib/parser_email.js index 4b23131..b438b3e 100644 --- a/lib/parser_email.js +++ b/lib/parser_email.js @@ -1,4 +1,4 @@ -var sys = require('sys') +var util = require('util') , utils = require('./utils') ; diff --git a/lib/utils.js b/lib/utils.js index 3639139..8be7042 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -var sys = require('sys') +var util = require('util') ; exports.parse_header_block = parse_header_block; @@ -14,16 +14,16 @@ function parse_header_block(content) { tupple = explode(header_arr[i], ':', 2); if (header_arr[i].match(/^\s+/) || tupple.length < 2) { if (current_key && header_arr[i].match(/^\s+/)) { - //sys.puts('Adding [' + header_arr[i] + '] to ' + current_key); + //util.puts('Adding [' + header_arr[i] + '] to ' + current_key); result[current_key] += ' ' + trim(header_arr[i]); extra = true; } else { - sys.puts('Invalid Header: ' + header_arr[i]); + util.puts('Invalid Header: ' + header_arr[i]); } continue; } var key = tupple[0].toLowerCase(); - //sys.puts('Working with ' + key); + //util.puts('Working with ' + key); current_key = key; result[key] = tupple[1]; } @@ -47,7 +47,7 @@ function parse_header(header) { extra = true; var tupple = explode(header[i], '=', 2); var h_name = trim(tupple[0]); - //sys.puts('Extra Name: (' + j + ')' + h_name); + //util.puts('Extra Name: (' + j + ')' + h_name); if (tupple.length == 2) { result[h_name] = trim(tupple[1]).replace(/^"/, '').replace(/"$/, ''); } else { @@ -62,7 +62,7 @@ function parse_body_block(content, headers) { if (!headers['content-type']) { headers['content-type'] = { 'value': 'text/plain' }; } - //sys.puts('Have a content type: ' + headers['content-type'].value); + //util.puts('Have a content type: ' + headers['content-type'].value); switch (headers['content-type'].value) { case 'text/plain': case 'text/html': @@ -78,8 +78,8 @@ function parse_body_block(content, headers) { case 'image/jpeg': content = content.replace(/\r\n/mg, ''); default: - //sys.puts('Unknown content type: ' + headers['content-type'].value); - //sys.puts(sys.inspect(headers['content-type'])); + //util.puts('Unknown content type: ' + headers['content-type'].value); + //util.puts(util.inspect(headers['content-type'])); break; } return content; @@ -90,11 +90,11 @@ function parse_multitype(content, boundary) { if (!content || !boundary) { return false; } - //sys.puts('Working with boundary ' + boundary); + //util.puts('Working with boundary ' + boundary); // TODO: Commenting this statement out. Not sure what its supposed to be doing // if (content.substr(0, boundary.length + 2) != ('--' + boundary)) { - // sys.puts('Invalid Multi Part'); + // util.puts('Invalid Multi Part'); // return false; // }