diff src/context.cpp @ 163:97d7da45fe2a

spamassassin changes
author carl
date Sun, 26 Aug 2007 19:03:17 -0700
parents c4bce911c276
children 5809bcdc325b
line wrap: on
line diff
--- a/src/context.cpp	Sat Jul 14 12:25:17 2007 -0700
+++ b/src/context.cpp	Sun Aug 26 19:03:17 2007 -0700
@@ -50,6 +50,7 @@
 char *token_rbrace;
 char *token_semi;
 char *token_soft;
+char *token_spamassassin;
 char *token_substitute;
 char *token_tld;
 char *token_cctld;
@@ -678,6 +679,7 @@
 	host_random 		= (parent) ? parent->host_random : false;
 	tag_limit			= (parent) ? parent->tag_limit	 : 0;
 	tag_limit_message	= NULL;
+	spamassassin_limit	= (parent) ? parent->spamassassin_limit : 0;
 	default_rcpt_rate	= INT_MAX;
 }
 
@@ -861,7 +863,10 @@
 }
 
 
-bool CONTEXT::acceptable_content(recorder &memory, char *&msg) {
+bool CONTEXT::acceptable_content(recorder &memory, int score, char *&msg) {
+	if (spamassassin_limit && (score > spamassassin_limit)) {
+		msg = "Mail rejected by spam assassin";
+	}
 	if (memory.excessive_bad_tags(tag_limit)) {
 		msg = tag_limit_message;
 		return false;
@@ -953,6 +958,7 @@
 		else {
 			printf("%s         html_limit off; \n", indent);
 		}
+		printf("%s         spamassassin %d; \n", indent, spamassassin_limit);
 		printf("%s     }; \n", indent);
 		}
 	else {
@@ -1215,6 +1221,10 @@
 			}
 			if (!tsa(tok, token_semi)) return false;
 		}
+		else if (have == token_spamassassin) {
+			me.set_spamassassin_limit(tok.nextint());
+			if (!tsa(tok, token_semi)) return false;
+		}
 		else if (have == token_rbrace) {
 			break;	// done
 		}
@@ -1533,6 +1543,7 @@
 	token_rbrace	 = register_string("}");
 	token_semi		 = register_string(";");
 	token_soft		 = register_string("soft");
+	token_spamassassin = register_string("spamassassin");
 	token_substitute = register_string("substitute");
 	token_tld		 = register_string("tld");
 	token_unknown	 = register_string("unknown");