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

Add utility function to get an offset from a message number...

Could we get an offset attribute added to the index or header objects?
<hint> <hint>
parent 9d169d59
Branches
Tags
No related merge requests found
...@@ -76,20 +76,31 @@ function find_np_message(offset,next) ...@@ -76,20 +76,31 @@ function find_np_message(offset,next)
{ {
/* "Next" actually means the one before this one as msgs reverses everything */ /* "Next" actually means the one before this one as msgs reverses everything */
var step=-1; var step=-1;
var hdr=null;
var idx; var idx;
var last_offset;
if(!next) if(!next)
step=1; step=1;
write("offset: "+offset+" step: "+step+"<BR>");
for(last_offset=offset+step;(hdr=msgbase.get_msg_header(true,last_offset))!=null;last_offset+=step) { for(last_offset=parseInt(offset)+step;last_offset>0 && (idx=msgbase.get_msg_index(true,last_offset))!=null;last_offset+=step) {
if(hdr.attr&MSG_DELETE) write("checking: "+last_offset+"<BR>");
if(idx.attr&MSG_DELETE)
continue; continue;
if(sub!=mail) if(sub!='mail')
return(last_offset); return(idx.number);
if((idx=msgbase.get_msg_index(true,last_offset))==null || idx.to!=user.number) if(idx.to!=user.number)
continue;
return(idx.number);
}
return(undefined);
}
function get_msg_offset(number)
{
for(last_offset=0; (hdr=msgbase.get_msg_header(true,last_offset)) != null;last_offset++) {
if((idx=msgbase.get_msg_index(true,last_offset))==null)
continue; continue;
return(hdr.number); return(idx.number);
} }
return(undefined); return(undefined);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment