From db13e515db6abba5a6a0732b77268cce0e3f60bd Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 24 Mar 2016 19:48:16 +0100 Subject: Indicate untrusted PGP signatures in thread view. --- alot/db/utils.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'alot') 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) ) -- cgit v1.2.3