Skip to content
Snippets Groups Projects
Commit 25ada8ed authored by echicken's avatar echicken
Browse files

Added 'max' argument (only sort up to 'max' messages in a sub before returning threads.)

parent 58e6df93
No related branches found
No related tags found
No related merge requests found
......@@ -360,7 +360,9 @@ function expand_body(body, sys_misc, mode)
}
}
*/
function getMessageThreads(sub) {
function getMessageThreads(sub, max) {
if(max === undefined)
max = 0;
var threads = { thread : {}, dates : [], order : [] };
var threadedMessages = [];
var subjects = {};
......@@ -369,6 +371,7 @@ function getMessageThreads(sub) {
var md5subject;
var msgBase = new MsgBase(sub);
msgBase.open();
var n = 0;
for(var m = msgBase.first_msg; m <= msgBase.last_msg; m++) {
header = msgBase.get_msg_header(m);
if(
......@@ -433,6 +436,9 @@ function getMessageThreads(sub) {
}
subjects[md5subject] = header.number;
threadedMessages.push(header.number);
n++;
if(max > 0 && n >= max)
break;
}
msgBase.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment