Skip to content
Snippets Groups Projects
Commit bad3a502 authored by echicken's avatar echicken :chicken:
Browse files

Some tidying up, I guess

parent 56e634dd
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -11,25 +11,21 @@ function barfOut(err) { ...@@ -11,25 +11,21 @@ function barfOut(err) {
exit(); exit();
} }
if (typeof http_request.query.sub === 'undefined' || if (http_request.query.sub === undefined || (http_request.query.sub[0] !== 'mail' && msg_area.sub[http_request.query.sub[0]] === undefined)) {
( http_request.query.sub[0] !== 'mail' &&
typeof msg_area.sub[http_request.query.sub[0]] === 'undefined'
)
) {
barfOut('Invalid sub.'); barfOut('Invalid sub.');
} }
var sub = http_request.query.sub[0]; var sub = http_request.query.sub[0];
if (typeof http_request.query.msg === 'undefined') { if (http_request.query.msg === undefined) {
barfOut('No message number provided.'); barfOut('No message number provided.');
} }
var id = parseInt(http_request.query.msg[0]); var id = parseInt(http_request.query.msg[0]);
if (typeof http_request.query.cid !== 'undefined') { if (http_request.query.cid !== undefined) {
var cid = http_request.query.cid[0]; var cid = http_request.query.cid[0];
} else if (typeof http_request.query.filename !== 'undefined') { } else if (http_request.query.filename !== undefined) {
var filename = http_request.query.filename[0]; var filename = http_request.query.filename[0];
} else { } else {
barfOut('No attachment specified.'); barfOut('No attachment specified.');
...@@ -40,7 +36,7 @@ if (!msgBase.open()) barfOut('Unable to open MsgBase ' + sub); ...@@ -40,7 +36,7 @@ if (!msgBase.open()) barfOut('Unable to open MsgBase ' + sub);
var header = msgBase.get_msg_header(false, id); var header = msgBase.get_msg_header(false, id);
if (header === null) barfOut('No such message.'); if (header === null) barfOut('No such message.');
if (typeof msgBase.cfg === 'undefined' && header.to_ext != user.number) { if (msgBase.cfg === undefined && header.to_ext != user.number) {
barfOut('Not your message.'); barfOut('Not your message.');
} }
...@@ -48,16 +44,18 @@ var body = msgBase.get_msg_body(false, id, header); ...@@ -48,16 +44,18 @@ var body = msgBase.get_msg_body(false, id, header);
if (body === null) barfOut('Cannot read message body!'); if (body === null) barfOut('Cannot read message body!');
msgBase.close(); msgBase.close();
if (typeof cid !== 'undefined') { msgBase = undefined;
if (cid !== undefined) {
var att = mime_get_cid_attach(header, body, cid); var att = mime_get_cid_attach(header, body, cid);
} else if (typeof filename !== 'undefined') { } else if (filename !== undefined) {
var att = mime_get_attach(header, body, filename); var att = mime_get_attach(header, body, filename);
} }
if (typeof att != 'undefined') { if (att !== undefined) {
if (typeof att.content_type !== 'undefined') { if (att.content_type !== undefined) http_reply.header['Content-Type'] = att.content_type;
http_reply.header['Content-Type'] = att.content_type;
}
http_reply.header['Content-Length'] = att.body.length; http_reply.header['Content-Length'] = att.body.length;
write(att.body); write(att.body);
} }
att = undefined;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment