diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2016-03-24 19:48:16 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2016-03-24 21:10:26 +0000 |
commit | db13e515db6abba5a6a0732b77268cce0e3f60bd (patch) | |
tree | 89f909f7cb6f73167e7e0e99e16ac85fb49ac624 | |
parent | 39d214f87c9bf0559d6e360af7b35fe3a6258454 (diff) |
Indicate untrusted PGP signatures in thread view.
-rw-r--r-- | alot/db/utils.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index 63bd6b89..f98a0828 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -42,7 +42,17 @@ def add_signature_headers(mail, sigs, error_msg): error_msg = error_msg or 'no signature found' else: try: - sig_from = crypto.get_key(sigs[0].fpr).uids[0].uid + key = crypto.get_key(sigs[0].fpr) + for uid in key.uids: + if crypto.check_uid_validity(key, uid.email): + sig_from = uid.uid + uid_trusted = True + break + else: + # No trusted uid found, we did not break but drop from the + # for loop. + uid_trusted = False + sig_from = key.uids[0].uid except: sig_from = sigs[0].fpr @@ -54,7 +64,9 @@ def add_signature_headers(mail, sigs, error_msg): X_SIGNATURE_MESSAGE_HEADER, u'Invalid: {0}'.format(error_msg) if error_msg else - u'Valid: {0}'.format(sig_from), + u'Valid: {0}'.format(sig_from) + if uid_trusted else + u'Untrusted: {0}'.format(sig_from) ) |