summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-11-21 10:25:28 -0200
committerdrebs <drebs@leap.se>2013-11-21 17:35:38 -0200
commitdc2cc23f8b0ad2e758d0432833d764e60205bf76 (patch)
tree735eefeb9dbedf470be1e336fa09552315813ed8 /mail/src/leap
parente65620c9de05fdd051a8ad045a0ff81bcf67e39a (diff)
Add a footer to outgoing messages that point to where sender keys can be feched. Closes #4526.
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/smtp/gateway.py13
1 files changed, 12 insertions, 1 deletions
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'])