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 7ec109cd authored by echicken's avatar echicken 🐔

Removed 000-mail.ssjs, added new 000-mail.xjs private mail page. Added...

Removed 000-mail.ssjs, added new 000-mail.xjs private mail page.  Added delete-mail API call and backend function for deletion of multiple messages.  Select-all and delete-selected-messages now available on the mail page.
parent 50a9c86d
......@@ -572,7 +572,6 @@ function deleteMessage(sub, number) {
var msgBase = new MsgBase(sub);
if (!msgBase.open()) return false;
var header = msgBase.get_msg_header(number);
log(JSON.stringify(header));
if (header === null) return false;
if (sub === 'mail' &&
(header.to_ext == user.number || header.from_ext == user.number)
......@@ -587,6 +586,25 @@ function deleteMessage(sub, number) {
return ret;
}
function deleteMail(numbers) {
if (typeof numbers === 'undefined' || !Array.isArray(numbers)) return false;
var msgBase = new MsgBase('mail');
if (!msgBase.open()) return false;
numbers.forEach(
function (e) {
e = parseInt(e);
if (isNaN(e) || e < msgBase.first_msg || e > msgBase.last_msg) return;
var header = msgBase.get_msg_header(e);
if (header === null) return;
if (header.to_ext == user.number || header.from_ext == user.number) {
msgBase.remove_msg(e);
}
}
);
msgBase.close();
return true;
}
function voteMessage(sub, number, up) {
if (typeof msg_area.sub[sub] === 'undefined' && sub !== 'mail') {
return false;
......
......@@ -23,42 +23,6 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
switch(http_request.query.call[0].toLowerCase()) {
case 'list-groups':
reply = listGroups();
break;
case 'list-subs':
if (typeof http_request.query.group !== 'undefined') {
reply = listSubs(http_request.query.group[0]);
}
break;
case 'list-threads':
if (typeof http_request.query.sub !== 'undefined') {
reply = listThreads(http_request.query.sub[0]);
}
break;
case 'get-group-unread-count':
if (typeof http_request.query.group !== 'undefined') {
http_request.query.group.forEach(
function(group) {
reply[group] = getGroupUnreadCount(group);
}
);
}
break;
case 'get-sub-unread-count':
if (typeof http_request.query.sub !== 'undefined') {
http_request.query.sub.forEach(
function(sub) {
reply[sub] = getSubUnreadCount(sub);
}
);
}
break;
case 'get-mail-unread-count':
reply.count = getMailUnreadCount();
break;
......@@ -118,6 +82,14 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
}
break;
case 'delete-mail':
if (typeof http_request.query.number !== 'undefined') {
reply.success = deleteMail(http_request.query.number);
} else {
reply.success = false;
}
break;
case 'set-scan-cfg':
if (typeof http_request.query.sub !== 'undefined' &&
typeof http_request.query.cfg !== 'undefined'
......@@ -188,7 +160,9 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
// Unauthenticated calls
if (!handled) {
switch(http_request.query.call[0].toLowerCase()) {
case 'get-thread-votes':
if (typeof http_request.query.sub !== 'undefined' &&
typeof http_request.query.id !== 'undefined'
......@@ -202,11 +176,13 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
}
}
break;
case 'get-sub-votes':
if (typeof http_request.query.sub !== 'undefined') {
reply = getVotesInThreads(http_request.query.sub[0]);
}
break;
case 'get-poll-results':
if (typeof http_request.query.sub !== 'undefined' &&
typeof http_request.query.id !== 'undefined'
......@@ -217,9 +193,57 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
);
}
break;
case 'list-groups':
reply = listGroups();
break;
case 'list-subs':
if (typeof http_request.query.group !== 'undefined') {
reply = listSubs(http_request.query.group[0]);
}
break;
case 'list-threads':
if (typeof http_request.query.sub !== 'undefined' &&
typeof http_request.query.offset !== 'undefined'
) {
if (typeof http_request.query.count !== 'undefined') {
var count = http_request.query.count[0];
}
reply = listThreads(
http_request.query.sub[0],
http_request.query.offset[0],
count || settings.page_size
);
}
break;
case 'get-group-unread-count':
if (typeof http_request.query.group !== 'undefined') {
http_request.query.group.forEach(
function(group) {
reply[group] = getGroupUnreadCount(group);
}
);
}
break;
case 'get-sub-unread-count':
if (typeof http_request.query.sub !== 'undefined') {
http_request.query.sub.forEach(
function(sub) {
reply[sub] = getSubUnreadCount(sub);
}
);
}
break;
default:
break;
}
}
}
......
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