summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/SpamDetect.py
diff options
context:
space:
mode:
authorbwarsaw2000-05-08 17:28:19 +0000
committerbwarsaw2000-05-08 17:28:19 +0000
commit58a17b9f5a8763c1ea9224ee4e7c72c3e11e4197 (patch)
treeba0d2fb11ee5fe6b58ab6ad6c1ca8f724daca964 /Mailman/Handlers/SpamDetect.py
parentc6096572df688db5ad73ad74f8500de2a44cd899 (diff)
downloadmailman-58a17b9f5a8763c1ea9224ee4e7c72c3e11e4197.tar.gz
mailman-58a17b9f5a8763c1ea9224ee4e7c72c3e11e4197.tar.zst
mailman-58a17b9f5a8763c1ea9224ee4e7c72c3e11e4197.zip
Diffstat (limited to 'Mailman/Handlers/SpamDetect.py')
-rw-r--r--Mailman/Handlers/SpamDetect.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py
index b4854816a..b8b6d49d8 100644
--- a/Mailman/Handlers/SpamDetect.py
+++ b/Mailman/Handlers/SpamDetect.py
@@ -18,15 +18,17 @@
This module hard codes site wide spam detection. By hacking the
KNOWN_SPAMMERS variable, you can set up more regular expression matches
-against message headers. If spam is detected, it is held for approval (see
-Hold.py).
+against message headers. If spam is detected the message is discarded
+immediately.
TBD: This needs to be made more configurable and robust.
"""
import re
import HandlerAPI
-import Hold
+
+class SpamDetected(HandlerAPI.DiscardMessage):
+ """The message contains known spam"""
# This variable contains a list of 2-tuple of the format (header, regex) which
@@ -38,14 +40,9 @@ import Hold
KNOWN_SPAMMERS = []
-class SpamDetected(HandlerAPI.MessageHeld):
- """Potential spam detected"""
- pass
-
-
-def process(mlist, msg):
- if getattr(msg, 'approved', 0):
+def process(mlist, msg, msgdata):
+ if msgdata.get('approved'):
return
for header, regex in KNOWN_SPAMMERS:
cre = re.compile(regex, re.IGNORECASE)
@@ -57,6 +54,5 @@ def process(mlist, msg):
continue
mo = cre.search(text)
if mo:
- # we've detected spam
- Hold.hold_for_approval(mlist, msg, SpamDetected)
- # no return
+ # we've detected spam, so throw the message away
+ raise SpamDetected