From 14cf70f68912aefe428d6a10f0c8a41f429028c5 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 28 Dec 2017 04:08:32 +0000
Subject: [PATCH] New POP3 server feature: Append "#nospam" to your login
 name/alias and any SPAM-tagged messages will not be listed/downloaded. This
 is useful if for example you use POP3 to download mail to your phone and have
 limited storage or sorting options. The SPAM-tagged messages will remain in
 your inbox on the BBS so you should use another POP3 or local mail client to
 download and delete those messages (which could potentially include false
 positives).

---
 src/sbbs3/mailsrvr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c
index 5800634016..28d6983ac5 100644
--- a/src/sbbs3/mailsrvr.c
+++ b/src/sbbs3/mailsrvr.c
@@ -63,6 +63,7 @@
 static const char*	server_name="Synchronet Mail Server";
 #define FORWARD			"forward:"
 #define NO_FORWARD		"local:"
+#define NO_SPAM			"#nospam"
 
 int dns_getmx(char* name, char* mx, char* mx2
 			  ,DWORD intf, DWORD ip_addr, BOOL use_tcp, int timeout);
@@ -811,6 +812,7 @@ static void pop3_thread(void* arg)
 	BOOL		activity=TRUE;
 	BOOL		apop=FALSE;
 	uint32_t	l;
+	long		lm_mode = 0;
 	ulong		lines;
 	ulong		lines_sent;
 	ulong		login_attempts;
@@ -940,6 +942,11 @@ static void pop3_thread(void* arg)
 				response=p;
 		}
 		SAFECOPY(username,p);
+		if((p = strstr(username, NO_SPAM)) != NULL) {
+			*p = 0;
+			lm_mode = LM_NOSPAM;
+		} else
+			lm_mode = 0;
 		if(!apop) {
 			sockprintf(socket,"+OK");
 			if(!sockgetrsp(socket,"PASS ",buf,sizeof(buf))) {
@@ -1030,7 +1037,7 @@ static void pop3_thread(void* arg)
 			break;
 		}
 
-		mail=loadmail(&smb,&msgs,user.number,MAIL_YOUR,0);
+		mail=loadmail(&smb,&msgs,user.number,MAIL_YOUR,lm_mode);
 
 		for(l=bytes=0;l<msgs;l++) {
 			msg.hdr.number=mail[l].number;
-- 
GitLab