Skip to content
Snippets Groups Projects
Commit b3d13d81 authored by deuce's avatar deuce
Browse files

Add utility function to locate the next or previous message number in the

current msgbase.
parent 183c8bc9
No related branches found
No related tags found
No related merge requests found
......@@ -71,3 +71,25 @@ function msgs_done()
if(msgbase!=undefined)
msgbase.close();
}
function find_np_message(offset,next)
{
/* "Next" actually means the one before this one as msgs reverses everything */
var step=-1;
var hdr=null;
var idx;
if(!next)
step=1;
for(last_offset=offset+step;(hdr=msgbase.get_msg_header(true,last_offset))!=null;last_offset+=step) {
if(hdr.attr&MSG_DELETE)
continue;
if(sub!=mail)
return(last_offset);
if((idx=msgbase.get_msg_index(true,last_offset))==null || idx.to!=user.number)
continue;
return(last_offset);
}
return(undefined);
}
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