Skip to content
Snippets Groups Projects
Commit 29e3b5f4 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Always advance to next message after deleting a message

Also, the logic to check if the user could even view deleted messages (on line 912) was wrong, replace with new method: can_view_deleted_msgs().

As requested by deon (ALTERANT).
parent daf48cf8
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3159 passed
...@@ -26,6 +26,13 @@ int sbbs_t::sub_op(uint subnum) ...@@ -26,6 +26,13 @@ int sbbs_t::sub_op(uint subnum)
return(is_user_subop(&cfg, subnum, &useron, &client)); return(is_user_subop(&cfg, subnum, &useron, &client));
} }
bool sbbs_t::can_view_deleted_msgs(uint subnum)
{
if((cfg.sys_misc & SM_SYSVDELM) == 0) // No one can view deleted msgs
return false;
return (cfg.sys_misc & SM_USRVDELM) || sub_op(subnum);
}
uchar sbbs_t::msg_listing_flag(uint subnum, smbmsg_t* msg, post_t* post) uchar sbbs_t::msg_listing_flag(uint subnum, smbmsg_t* msg, post_t* post)
{ {
if(msg->hdr.attr&MSG_DELETE) return '-'; if(msg->hdr.attr&MSG_DELETE) return '-';
...@@ -149,10 +156,7 @@ post_t * sbbs_t::loadposts(uint32_t *posts, uint subnum, ulong ptr, long mode, u ...@@ -149,10 +156,7 @@ post_t * sbbs_t::loadposts(uint32_t *posts, uint subnum, ulong ptr, long mode, u
if(idx.attr&MSG_DELETE) { /* Pre-flagged */ if(idx.attr&MSG_DELETE) { /* Pre-flagged */
if(mode&LP_REP) /* Don't include deleted msgs in REP pkt */ if(mode&LP_REP) /* Don't include deleted msgs in REP pkt */
continue; continue;
if(!(cfg.sys_misc&SM_SYSVDELM)) /* Noone can view deleted msgs */ if(!can_view_deleted_msgs(subnum))
continue;
if(!(cfg.sys_misc&SM_USRVDELM) /* Users can't view deleted msgs */
&& !sub_op(subnum)) /* not sub-op */
continue; continue;
if(!sub_op(subnum) /* not sub-op */ if(!sub_op(subnum) /* not sub-op */
&& idx.from!=namecrc && idx.from!=aliascrc) /* not for you */ && idx.from!=namecrc && idx.from!=aliascrc) /* not for you */
...@@ -731,7 +735,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find) ...@@ -731,7 +735,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
smb_unlocksmbhdr(&smb); smb_unlocksmbhdr(&smb);
} }
if(msg_attr & MSG_DELETE) { if(msg_attr & MSG_DELETE) {
if(cfg.sys_misc&SM_SYSVDELM) if(can_view_deleted_msgs(subnum))
domsg=0; // If you can view deleted messages, don't redisplay. domsg=0; // If you can view deleted messages, don't redisplay.
} }
else { else {
...@@ -909,10 +913,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find) ...@@ -909,10 +913,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
smb_unlocksmbhdr(&smb); smb_unlocksmbhdr(&smb);
} }
domsg=1; domsg=1;
if((cfg.sys_misc&SM_SYSVDELM // anyone can view delete msgs if(can_view_deleted_msgs(subnum))
|| (cfg.sys_misc&SM_USRVDELM // sys/subops can view deleted msgs
&& sub_op(subnum)))
&& smb.curmsg<smb.msgs-1)
smb.curmsg++; smb.curmsg++;
if(smb.curmsg>=smb.msgs) if(smb.curmsg>=smb.msgs)
done=1; done=1;
......
...@@ -687,6 +687,7 @@ public: ...@@ -687,6 +687,7 @@ public:
uint finduser(const char* str, bool silent_failure = false); uint finduser(const char* str, bool silent_failure = false);
int sub_op(uint subnum); int sub_op(uint subnum);
bool can_view_deleted_msgs(uint subnum);
int dir_op(uint dirnum); int dir_op(uint dirnum);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment