From e11702c8f6d81978279d791fa37c5d5e21b1e567 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 30 Oct 2017 06:18:56 +0000
Subject: [PATCH] Delete messages moved from the badecho/unknown area, even if
 they weren't actually moved because they were dupes. Don't attempt to
 auto-add subs that aren't marked as "FidoNet EchoMail" in SCFG

---
 src/sbbs3/sbbsecho.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c
index 46c6fd5109..ebc9d9e9a9 100644
--- a/src/sbbs3/sbbsecho.c
+++ b/src/sbbs3/sbbsecho.c
@@ -4810,10 +4810,10 @@ bool retoss_bad_echomail(void)
 			FREE_AND_NULL(body);
 			FREE_AND_NULL(tail);
 
-			if(retval != SMB_SUCCESS) {
+			if(retval != SMB_SUCCESS)
 				lprintf(LOG_ERR,"ERROR smb_addmsg(%s) returned %d: %s"
 					,scfg.sub[subnum]->code, retval, smb.last_error);
-			} else {
+			if(retval == SMB_SUCCESS || retval == SMB_DUPE_MSG) {
 				badmsg.hdr.attr |= MSG_DELETE;
 				if((retval = smb_updatemsg(&badsmb, &badmsg)) != SMB_SUCCESS)
 					lprintf(LOG_ERR,"!ERROR %d (%s) deleting msg #%u in bad echo sub"
@@ -5989,6 +5989,8 @@ int main(int argc, char **argv)
 		for(unsigned subnum = 0; subnum < scfg.total_subs; subnum++) {
 			if(cfg.badecho >=0 && cfg.area[cfg.badecho].sub == subnum)
 				continue;	/* No need to auto-add the badecho sub */
+			if(!(scfg.sub[subnum]->misc&SUB_FIDO))
+				continue;
 			unsigned area;
 			for(area = 0; area < cfg.areas; area++)
 				if(cfg.area[area].sub == subnum)
@@ -6029,7 +6031,7 @@ int main(int argc, char **argv)
 		lprintf(LOG_DEBUG, "Read %u areas from %s", before, cfg.badareafile);
 		if(fp!=NULL)
 			fclose(fp);
-		lprintf(LOG_DEBUG, "Checking bad areas for areas we now carry - begin");
+//		lprintf(LOG_DEBUG, "Checking bad areas for areas we now carry - begin");
 		strListTruncateStrings(bad_areas, " \t\r\n");
 		for(i=0; bad_areas[i] != NULL; i++) {
 			if(area_is_valid(find_area(bad_areas[i]))) {			/* Do we carry this area? */
@@ -6038,7 +6040,7 @@ int main(int argc, char **argv)
 				i--;
 			}
 		}
-		lprintf(LOG_DEBUG, "Checking bad areas for areas we now carry - end");
+//		lprintf(LOG_DEBUG, "Checking bad areas for areas we now carry - end");
 		after = strListCount(bad_areas);
 		if(before != after)
 			lprintf(LOG_NOTICE, "Removed %d areas from bad area file: %s", before-after, cfg.badareafile);
-- 
GitLab