From bccd639482b8c5cc8479477bf30d681662d1d009 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 2 Feb 2019 23:21:24 +0000
Subject: [PATCH] When printing the CantDeleteMsg text line, incude the message
 number. The (O)perator (D)elete message (range) command will now skip
 permanent msgs. Fixed bug with (L)ist msgs command while in (S)earch for Your
 Messages mode (the msg numbers listed did not match the msg numbers used by
 the Read prompt).

---
 src/sbbs3/readmsgs.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/readmsgs.cpp b/src/sbbs3/readmsgs.cpp
index cc87e15c75..2913e3e265 100644
--- a/src/sbbs3/readmsgs.cpp
+++ b/src/sbbs3/readmsgs.cpp
@@ -73,7 +73,7 @@ long sbbs_t::listmsgs(uint subnum, long mode, post_t *post, long i, long posts)
 		smb_unlockmsghdr(&smb,&msg);
 		if(listed==0)
 			bputs(text[MailOnSystemLstHdr]);
-		bprintf(text[SubMsgLstFmt],post[i].num
+		bprintf(text[SubMsgLstFmt], i+1
 			,msg.hdr.attr&MSG_ANONYMOUS && !sub_op(subnum)
 			? text[Anonymous] : msg.from
 			,msg.to
@@ -964,7 +964,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
 						break; 
 					}
 					if(cfg.sub[subnum]->misc&SUB_DELLAST && smb.curmsg!=(smb.msgs-1)) {
-						bputs(text[CantDeleteMsg]);
+						bprintf(text[CantDeleteMsg], smb.curmsg + 1);
 						domsg=0;
 						break;
 					}
@@ -977,7 +977,7 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
 					} 
 				}
 				if(msg.hdr.attr&MSG_PERMANENT) {
-					bputs(text[CantDeleteMsg]);
+					bprintf(text[CantDeleteMsg], smb.curmsg + 1);
 					domsg=0;
 					break; 
 				}
@@ -1407,6 +1407,11 @@ int sbbs_t::scanposts(uint subnum, long mode, const char *find)
 										already++;
 										continue;	// Already deleted
 									}
+									if(post[n - 1].idx.attr & MSG_PERMANENT) {
+										bprintf(text[CantDeleteMsg], smb.curmsg + 1);
+										failed++;
+										continue;
+									}
 									smb_freemsgmem(&msg);
 									msg.idx.offset = 0;
 									msg.idx.number = post[n - 1].idx.number;
-- 
GitLab