Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit bad3a502 authored by echicken's avatar echicken 🐔

Some tidying up, I guess

parent 56e634dd
......@@ -11,25 +11,21 @@ function barfOut(err) {
exit();
}
if (typeof http_request.query.sub === 'undefined' ||
( http_request.query.sub[0] !== 'mail' &&
typeof msg_area.sub[http_request.query.sub[0]] === 'undefined'
)
) {
if (http_request.query.sub === undefined || (http_request.query.sub[0] !== 'mail' && msg_area.sub[http_request.query.sub[0]] === undefined)) {
barfOut('Invalid sub.');
}
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.');
}
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];
} else if (typeof http_request.query.filename !== 'undefined') {
} else if (http_request.query.filename !== undefined) {
var filename = http_request.query.filename[0];
} else {
barfOut('No attachment specified.');
......@@ -40,7 +36,7 @@ if (!msgBase.open()) barfOut('Unable to open MsgBase ' + sub);
var header = msgBase.get_msg_header(false, id);
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.');
}
......@@ -48,16 +44,18 @@ var body = msgBase.get_msg_body(false, id, header);
if (body === null) barfOut('Cannot read message body!');
msgBase.close();
if (typeof cid !== 'undefined') {
msgBase = undefined;
if (cid !== undefined) {
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);
}
if (typeof att != 'undefined') {
if (typeof att.content_type !== 'undefined') {
http_reply.header['Content-Type'] = att.content_type;
}
if (att !== undefined) {
if (att.content_type !== undefined) http_reply.header['Content-Type'] = att.content_type;
http_reply.header['Content-Length'] = att.body.length;
write(att.body);
}
att = undefined;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment