Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/parser_email.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys')
var util = require('util')
, utils = require('./utils')
;

Expand Down
20 changes: 10 additions & 10 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys')
var util = require('util')
;

exports.parse_header_block = parse_header_block;
Expand All @@ -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];
}
Expand All @@ -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 {
Expand All @@ -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':
Expand All @@ -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;
Expand All @@ -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;
// }

Expand Down