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

Add a can_delete() function takes a message number and returns true if the

current user is (currently) allowed to delete that message.
parent e6d0b0d9
Branches
Tags
No related merge requests found
......@@ -103,3 +103,20 @@ function get_msg_offset(number)
}
return(undefined);
}
function can_delete(mnum)
{
if(sub=='mail' && ((idx=msgbase.get_msg_index(false,mnum))==null || idx.to!=user.number))
return(false);
if(sub!='mail' && !msg_area.sub[sub].is_operator) {
if(!msg_area.sub[sub].settings&SUB_DEL)
return(false);
if(msg_area.sub[sub].settings&SUB_DELLAST) {
if(msgbase.last_msg!=mnum)
return(false);
}
if((hdr=msgbase.get_msg_header(false,mnum))==null || hdr.from_ext!=user.number)
return(false);
}
return(true);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment