diff options
| author | J08nY | 2017-07-17 19:18:54 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-17 19:18:54 +0200 |
| commit | 20317c3444e0b11d8d4676dec23c34222d4d7340 (patch) | |
| tree | 42914fe88de12ecc986cc50451b7727f7a52f3fd /src/mailman_pgp/runners/incoming.py | |
| parent | 8fe73c6364c873e1bd52286353c3f79a4486127a (diff) | |
| download | mailman-pgp-20317c3444e0b11d8d4676dec23c34222d4d7340.tar.gz mailman-pgp-20317c3444e0b11d8d4676dec23c34222d4d7340.tar.zst mailman-pgp-20317c3444e0b11d8d4676dec23c34222d4d7340.zip | |
Diffstat (limited to 'src/mailman_pgp/runners/incoming.py')
| -rw-r--r-- | src/mailman_pgp/runners/incoming.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mailman_pgp/runners/incoming.py b/src/mailman_pgp/runners/incoming.py index d25479c..1c81908 100644 --- a/src/mailman_pgp/runners/incoming.py +++ b/src/mailman_pgp/runners/incoming.py @@ -29,6 +29,7 @@ from public import public from mailman_pgp.config import config from mailman_pgp.model.list import PGPMailingList from mailman_pgp.pgp.wrapper import PGPWrapper +from mailman_pgp.utils.moderation import record_action log = logging.getLogger('mailman.plugin.pgp') @@ -62,10 +63,12 @@ class IncomingRunner(Runner): try: msg = wrapped.decrypt(list_key) except PGPError: - msgdata['moderation_action'] = Action.reject.name - msgdata['moderation_sender'] = msg.sender - msgdata.setdefault('moderation_reasons', []).append( - 'Message could not be decrypted.') + reason = 'Message could not be decrypted.' + log.info('[pgp] {}{}: {}'.format( + Action.reject.name, msg.get('message-id', 'n/a'), + reason)) + record_action(msg, msgdata, Action.reject, msg.sender, + reason) msgdata['pgp_moderate'] = True else: # Take the `nonencrypted_msg_action` @@ -76,9 +79,7 @@ class IncomingRunner(Runner): reason = 'Message was not encrypted.' log.info('[pgp] {}{}: {}'.format( action.name, msg.get('message-id', 'n/a'), reason)) - msgdata['moderation_action'] = action.name - msgdata['moderation_sender'] = msg.sender - msgdata.setdefault('moderation_reasons', []).append(reason) + record_action(msg, msgdata, action, msg.sender, reason) msgdata['pgp_moderate'] = True _pass_default(msg, msgdata, mlist.list_id) |
