diff options
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
| -rw-r--r-- | src/mailman_pgp/commands/eml_key.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py index 9ea0384..0437430 100644 --- a/src/mailman_pgp/commands/eml_key.py +++ b/src/mailman_pgp/commands/eml_key.py @@ -17,7 +17,6 @@ """The key email command.""" from email.mime.text import MIMEText -from email.utils import parseaddr from mailman.email.message import UserNotification from mailman.interfaces.command import ContinueProcessing, IEmailCommand @@ -33,19 +32,12 @@ from mailman_pgp.model.address import PGPAddress from mailman_pgp.model.list import PGPMailingList from mailman_pgp.pgp.mime import MIMEWrapper from mailman_pgp.pgp.wrapper import PGPWrapper +from mailman_pgp.utils.email import get_email from mailman_pgp.workflows.key_change import (CHANGE_CONFIRM_REQUEST, KeyChangeWorkflow) from mailman_pgp.workflows.pubkey import CONFIRM_REQUEST -def _get_email(msg): - display_name, email = parseaddr(msg['from']) - # Address could be None or the empty string. - if not email: - email = msg.sender - return email - - def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results): """ `key set "token"` command. @@ -76,7 +68,7 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results): print('More than one key! Send only one key.', file=results) return ContinueProcessing.no - email = _get_email(msg) + email = get_email(msg) if not email: print('No email to subscribe with.', file=results) return ContinueProcessing.no @@ -126,7 +118,7 @@ def _cmd_confirm(pgp_list, mlist, msg, msgdata, arguments, results): print('Missing token.', file=results) return ContinueProcessing.no - email = _get_email(msg) + email = get_email(msg) if not email: print('No email to subscribe with.', file=results) return ContinueProcessing.no @@ -205,7 +197,7 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results): print('More than one key! Send only one key.', file=results) return ContinueProcessing.no - email = _get_email(msg) + email = get_email(msg) if not email: print('No email to change key of.', file=results) return ContinueProcessing.no @@ -238,7 +230,7 @@ def _cmd_receive(pgp_list, mlist, msg, msgdata, arguments, results): file=results) return ContinueProcessing.no - email = _get_email(msg) + email = get_email(msg) if not email: print('No email to send list public key.', file=results) return ContinueProcessing.no |
