Commit db03d3b8 authored by Brendan Cully's avatar Brendan Cully

Improve gpgme SMIME uid display: align each line by the length of the first.

parent b2a3ceb5
...@@ -1252,24 +1252,36 @@ static void show_one_sig_validity (gpgme_ctx_t ctx, int idx, STATE *s) ...@@ -1252,24 +1252,36 @@ static void show_one_sig_validity (gpgme_ctx_t ctx, int idx, STATE *s)
state_attach_puts (txt, s); state_attach_puts (txt, s);
} }
static void print_smime_keyinfo (gpgme_signature_t sig, gpgme_key_t key, static void print_smime_keyinfo (const char* msg, gpgme_signature_t sig,
STATE *s) gpgme_key_t key, STATE *s)
{ {
size_t msglen;
gpgme_user_id_t uids = NULL; gpgme_user_id_t uids = NULL;
int aka = 0; int i, aka = 0;
state_attach_puts (msg, s);
state_attach_puts (" ", s);
for (uids = key->uids; uids; uids = uids->next) for (uids = key->uids; uids; uids = uids->next)
{ {
if (uids->revoked) if (uids->revoked)
continue; continue;
if (aka) if (aka)
state_attach_puts (_(" aka: "), s); {
msglen = mutt_strlen (msg) - 4;
for (i = 0; i < msglen; i++)
state_attach_puts(" ", s);
state_attach_puts(_("aka: "), s);
}
state_attach_puts (uids->uid, s); state_attach_puts (uids->uid, s);
state_attach_puts ("\n", s); state_attach_puts ("\n", s);
aka = 1; aka = 1;
} }
state_attach_puts (_(" created: "), s);
msglen = mutt_strlen (msg) - 8;
for (i = 0; i < msglen; i++)
state_attach_puts(" ", s);
state_attach_puts (_("created: "), s);
print_time (sig->timestamp, s); print_time (sig->timestamp, s);
state_attach_puts ("\n", s); state_attach_puts ("\n", s);
} }
...@@ -1287,7 +1299,6 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE *s) ...@@ -1287,7 +1299,6 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE *s)
gpgme_key_t key = NULL; gpgme_key_t key = NULL;
int i, anybad = 0, anywarn = 0; int i, anybad = 0, anywarn = 0;
unsigned int sum; unsigned int sum;
gpgme_user_id_t uids = NULL;
gpgme_verify_result_t result; gpgme_verify_result_t result;
gpgme_signature_t sig; gpgme_signature_t sig;
gpgme_error_t err = GPG_ERR_NO_ERROR; gpgme_error_t err = GPG_ERR_NO_ERROR;
...@@ -1342,42 +1353,31 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE *s) ...@@ -1342,42 +1353,31 @@ static int show_one_sig_status (gpgme_ctx_t ctx, int idx, STATE *s)
} }
else if ((sum & GPGME_SIGSUM_GREEN)) else if ((sum & GPGME_SIGSUM_GREEN))
{ {
state_attach_puts (_("Good signature from: "), s); print_smime_keyinfo (_("Good signature from:"), sig, key, s);
print_smime_keyinfo (sig, key, s);
state_attach_puts (_(" expires: "), s);
print_time (sig->exp_timestamp, s);
state_attach_puts ("\n", s);
if (show_sig_summary (sum, ctx, key, idx, s, sig)) if (show_sig_summary (sum, ctx, key, idx, s, sig))
anywarn = 1; anywarn = 1;
show_one_sig_validity (ctx, idx, s); show_one_sig_validity (ctx, idx, s);
} }
else if ((sum & GPGME_SIGSUM_RED)) else if ((sum & GPGME_SIGSUM_RED))
{ {
state_attach_puts (_("*BAD* signature claimed to be from: "), s); print_smime_keyinfo (_("*BAD* signature from:"), sig, key, s);
print_smime_keyinfo (sig, key, s);
show_sig_summary (sum, ctx, key, idx, s, sig); show_sig_summary (sum, ctx, key, idx, s, sig);
} }
else if (!anybad && key && (key->protocol == GPGME_PROTOCOL_OpenPGP)) else if (!anybad && key && (key->protocol == GPGME_PROTOCOL_OpenPGP))
{ /* We can't decide (yellow) but this is a PGP key with a good { /* We can't decide (yellow) but this is a PGP key with a good
signature, so we display what a PGP user expects: The name, signature, so we display what a PGP user expects: The name,
fingerprint and the key validity (which is neither fully or fingerprint and the key validity (which is neither fully or
ultimate). */ ultimate). */
state_attach_puts (_("Good signature from: "), s); print_smime_keyinfo (_("Good signature from:"), sig, key, s);
state_attach_puts (uid, s); show_one_sig_validity (ctx, idx, s);
state_attach_puts ("\n", s); show_fingerprint (key,s);
state_attach_puts (_(" created: "), s); if (show_sig_summary (sum, ctx, key, idx, s, sig))
print_time (sig->timestamp, s); anywarn = 1;
state_attach_puts ("\n", s); }
show_one_sig_validity (ctx, idx, s);
show_fingerprint (key,s);
if (show_sig_summary (sum, ctx, key, idx, s, sig))
anywarn = 1;
}
else /* can't decide (yellow) */ else /* can't decide (yellow) */
{ {
state_attach_puts (_("Problem signature from: "), s); print_smime_keyinfo (_("Problem signature from:"), sig, key, s);
print_smime_keyinfo (sig, key, s); state_attach_puts (_(" expires: "), s);
state_attach_puts (_(" expires: "), s);
print_time (sig->exp_timestamp, s); print_time (sig->exp_timestamp, s);
state_attach_puts ("\n", s); state_attach_puts ("\n", s);
show_sig_summary (sum, ctx, key, idx, s, sig); show_sig_summary (sum, ctx, key, idx, s, sig);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment