diff options
author | drebs <drebs@leap.se> | 2013-11-21 10:25:28 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-11-21 17:35:38 -0200 |
commit | 6ced546f8787fb952297c6281192c73b5b78194f (patch) | |
tree | 88b8c651abd52f03c267e3ab12d602a3bfe7472e /src | |
parent | 46ccf635c44aeffb75c95845b8b4cc9ce2b1c4a4 (diff) |
Add a footer to outgoing messages that point to where sender keys can be feched. Closes #4526.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/mail/smtp/gateway.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py index f09ee14..523ac0d 100644 --- a/src/leap/mail/smtp/gateway.py +++ b/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']) |