summaryrefslogtreecommitdiff
path: root/src/mailman/rules/suspicious.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-07-26 23:24:18 +0000
committerBarry Warsaw2017-07-26 23:24:18 +0000
commitade94e8f833a9472ba9be52a08f4e2f381e7a212 (patch)
tree5fba570b0c6f4c0919009cb6f455c18bc732192a /src/mailman/rules/suspicious.py
parent02826321d0430d7ffc1f674eeff4221941689ef7 (diff)
parentbea94cb9538a55b1376afd42c2ce751efce62cfe (diff)
downloadmailman-ade94e8f833a9472ba9be52a08f4e2f381e7a212.tar.gz
mailman-ade94e8f833a9472ba9be52a08f4e2f381e7a212.tar.zst
mailman-ade94e8f833a9472ba9be52a08f4e2f381e7a212.zip
Diffstat (limited to 'src/mailman/rules/suspicious.py')
-rw-r--r--src/mailman/rules/suspicious.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mailman/rules/suspicious.py b/src/mailman/rules/suspicious.py
index 9f0f0e922..1bf96d22a 100644
--- a/src/mailman/rules/suspicious.py
+++ b/src/mailman/rules/suspicious.py
@@ -41,7 +41,7 @@ class SuspiciousHeader:
def check(self, mlist, msg, msgdata):
"""See `IRule`."""
return (mlist.bounce_matching_headers and
- has_matching_bounce_header(mlist, msg))
+ has_matching_bounce_header(mlist, msg, msgdata))
def _parse_matching_header_opt(mlist):
@@ -77,7 +77,7 @@ bad regexp in bounce_matching_header line: %s
return all
-def has_matching_bounce_header(mlist, msg):
+def has_matching_bounce_header(mlist, msg, msgdata):
"""Does the message have a matching bounce header?
:param mlist: The mailing list the message is destined for.
@@ -90,5 +90,11 @@ def has_matching_bounce_header(mlist, msg):
# Convert the header value to a str because it may be an
# email.header.Header instance.
if cre.search(str(value)):
+ msgdata['moderation_sender'] = msg.sender
+ with _.defer_translation():
+ # This will be translated at the point of use.
+ msgdata.setdefault('moderation_reasons', []).append((_(
+ 'Header "{}" matched a bounce_matching_header line'),
+ str(value)))
return True
return False