From c6dbc74b6abdc26698a5c76e7374d965d19632af Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 19 Jul 2017 18:17:57 +0200 Subject: Simplify outgoing encryption in BulkDelivery. --- src/mailman_pgp/mta/bulk.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mailman_pgp/mta/bulk.py b/src/mailman_pgp/mta/bulk.py index d22fec7..cd517e8 100644 --- a/src/mailman_pgp/mta/bulk.py +++ b/src/mailman_pgp/mta/bulk.py @@ -66,6 +66,9 @@ class PGPBulkMixin: pgp_list = PGPMailingList.for_list(mlist) if not pgp_list: return + if not pgp_list.encrypt_outgoing and not pgp_list.sign_outgoing: + # nothing to do + return keys = [] for recipient in recipients: @@ -79,7 +82,6 @@ class PGPBulkMixin: keys.append(pgp_address.key) wrapped = MIMEWrapper(msg) - out = msg if pgp_list.sign_outgoing: if pgp_list.encrypt_outgoing: out = wrapped.sign_encrypt(pgp_list.key, pgp_list.pubkey, @@ -87,11 +89,9 @@ class PGPBulkMixin: else: out = wrapped.sign(pgp_list.key) else: - if pgp_list.encrypt_outgoing: - out = wrapped.encrypt(pgp_list.pubkey, *keys, throw_keyid=True) + out = wrapped.encrypt(pgp_list.pubkey, *keys, throw_keyid=True) - if out is not msg: - overwrite_message(out, msg) + overwrite_message(out, msg) @public -- cgit v1.2.3-70-g09d2