aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/runners/incoming.py
diff options
context:
space:
mode:
authorJ08nY2017-06-27 17:53:02 +0200
committerJ08nY2017-06-27 17:53:02 +0200
commit750eb6716d7cc603ae877a484a02bc1b420eb2c5 (patch)
tree960185d61ee52cc231596d7cb83f09d7d95a75d3 /src/mailman_pgp/runners/incoming.py
parentfc513a7842fdc19317c3ffdd5ec75a00db24a7bf (diff)
downloadmailman-pgp-750eb6716d7cc603ae877a484a02bc1b420eb2c5.tar.gz
mailman-pgp-750eb6716d7cc603ae877a484a02bc1b420eb2c5.tar.zst
mailman-pgp-750eb6716d7cc603ae877a484a02bc1b420eb2c5.zip
Diffstat (limited to 'src/mailman_pgp/runners/incoming.py')
-rw-r--r--src/mailman_pgp/runners/incoming.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mailman_pgp/runners/incoming.py b/src/mailman_pgp/runners/incoming.py
index 7bc14e1..2941502 100644
--- a/src/mailman_pgp/runners/incoming.py
+++ b/src/mailman_pgp/runners/incoming.py
@@ -16,6 +16,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
"""The encryption-aware incoming runner."""
+import logging
from mailman.config import config as mailman_config
from mailman.core.runner import Runner
@@ -28,6 +29,8 @@ from mailman_pgp.config import config
from mailman_pgp.model.list import PGPMailingList
from mailman_pgp.pgp.wrapper import PGPWrapper
+log = logging.getLogger('mailman.plugin.pgp')
+
def _pass_default(msg, msgdata, listid):
inq = config.get('queues', 'in')
@@ -42,7 +45,7 @@ class IncomingRunner(Runner):
# Is the message for an encrypted mailing list? If not, pass to default
# incoming runner. If yes, go on.
pgp_list = PGPMailingList.query().filter_by(
- list_id=mlist.list_id).first()
+ list_id=mlist.list_id).first()
if not pgp_list:
_pass_default(msg, msgdata, mlist.list_id)
return False
@@ -61,9 +64,12 @@ class IncomingRunner(Runner):
# jump to the moderation chain if `pgp_moderate` is True
action = pgp_list.nonencrypted_msg_action
if action != Action.defer:
- msgdata['moderation_action'] = action
+ 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['moderation_reason'] = 'Message was not encrypted.'
+ msgdata['moderation_reason'] = reason
msgdata['pgp_moderate'] = True
_pass_default(msg, msgdata, mlist.list_id)