diff options
| author | Mark Sapiro | 2017-07-26 08:11:33 -0700 |
|---|---|---|
| committer | Mark Sapiro | 2017-07-26 08:11:33 -0700 |
| commit | bea94cb9538a55b1376afd42c2ce751efce62cfe (patch) | |
| tree | 5fba570b0c6f4c0919009cb6f455c18bc732192a /src/mailman/rules/suspicious.py | |
| parent | 02826321d0430d7ffc1f674eeff4221941689ef7 (diff) | |
| download | mailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.tar.gz mailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.tar.zst mailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.zip | |
Diffstat (limited to 'src/mailman/rules/suspicious.py')
| -rw-r--r-- | src/mailman/rules/suspicious.py | 10 |
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 |
