From dc2cc23f8b0ad2e758d0432833d764e60205bf76 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 21 Nov 2013 10:25:28 -0200 Subject: Add a footer to outgoing messages that point to where sender keys can be feched. Closes #4526. --- mail/src/leap/mail/smtp/gateway.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'mail/src/leap') diff --git a/mail/src/leap/mail/smtp/gateway.py b/mail/src/leap/mail/smtp/gateway.py index f09ee141..523ac0d3 100644 --- a/mail/src/leap/mail/smtp/gateway.py +++ b/mail/src/leap/mail/smtp/gateway.py @@ -333,6 +333,8 @@ class EncryptedMessage(object): """ implements(smtp.IMessage) + FOOTER_STRING = "I prefer encrypted email" + def __init__(self, fromAddress, user, keymanager, host, port, cert, key): """ Initialize the encrypted message. @@ -597,7 +599,16 @@ class EncryptedMessage(object): self._msg = self._origmsg return + # add a nice footer to the outgoing message from_address = validate_address(self._fromAddress.addrstr) + username, domain = from_address.split('@') + self.lines.append('--') + self.lines.append('%s - https://%s/key/%s.' % + (self.FOOTER_STRING, domain, username)) + self.lines.append('') + self._origmsg = self.parseMessage() + + # get sender and recipient data signkey = self._km.get_key(from_address, OpenPGPKey, private=True) log.msg("Will sign the message with %s." % signkey.fingerprint) to_address = validate_address(self._user.dest.addrstr) @@ -672,6 +683,6 @@ class EncryptedMessage(object): username, domain = signkey.address.split('@') newmsg.add_header( 'OpenPGP', 'id=%s' % signkey.key_id, - url='https://%s/openpgp/%s' % (domain, username)) + url='https://%s/key/%s' % (domain, username)) # delete user-agent from origmsg del(origmsg['user-agent']) -- cgit v1.2.3