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

Don't assume the first null message index is the last message in the sub. ...

Don't assume the first null message index is the last message in the sub.  Don't create an Array just to have something to set arbitrary properties on.  This may fix the problem observed on Vert by KenDB3 (messages after mid Nov. 2016 not being displayed).
parent 271b5485
No related branches found
No related tags found
No related merge requests found
......@@ -47,12 +47,15 @@ var err=null;
function get_message_offsets(type)
{
offsets=new Array;
var last_offset;
var idx;
var hdr;
for(last_offset=0; (idx=msgbase.get_msg_index(true,last_offset)) != null;last_offset++) {
offsets=[];//new Array; // is this global or something?
// var last_offset;
// var idx;
// var hdr;
// for(last_offset=0; (idx=msgbase.get_msg_index(true,last_offset)) != null;last_offset++) {
for (var last_offset = 0; last_offset <= msgbase.last_msg; last_offset++) {
var idx = msgbase.get_msg_index(true, last_offset);
if (typeof idx === 'undefined' || idx === null) continue;
if(idx.attr&MSG_DELETE)
continue;
if(sub=='mail' && idx.to!=user.number)
......@@ -66,11 +69,12 @@ function get_message_offsets(type)
continue;
}
if(idx.attr&MSG_MODERATED && !(idx.attr&MSG_VALIDATED))
break;
msg=new Array;
msg.idx=idx;
msg.offset=last_offset;
offsets.push(msg);
break; // pourquoi?
// msg=new Array;
// msg.idx=idx;
// msg.offset=last_offset;
// offsets.push(msg);
offsets.push({ idx : idx, offset : last_offset });
}
return(offsets);
}
......
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