changeset: 6793:405cbc43c3ac user: Antonio Radici <anto...@dyne.org> date: Tue Sep 20 15:51:13 2016 -0700 link: http://dev.mutt.org/hg/mutt/rev/405cbc43c3ac
Use body color for gpgme output. (closes #3872) When switching from pgp_* commands to crypt_use_gpgme=yes, Peter Colberg noticed that the output was colored 'brightyellow'. The issue is that crypt-gpgme.c uses state_attach_puts in various places where it should use state_puts to maintain compatibility with the previous behavior in pgp.c. diffs (280 lines): diff -r c41562a8118b -r 405cbc43c3ac crypt-gpgme.c --- a/crypt-gpgme.c Tue Sep 20 14:01:09 2016 -0700 +++ b/crypt-gpgme.c Tue Sep 20 15:51:13 2016 -0700 @@ -874,7 +874,7 @@ #else strftime (p, sizeof (p), "%c", localtime (&t)); #endif - state_attach_puts (p, s); + state_puts (p, s); } /* @@ -1139,7 +1139,7 @@ if ((sum & GPGME_SIGSUM_KEY_REVOKED)) { - state_attach_puts (_("Warning: One of the keys has been revoked\n"),s); + state_puts (_("Warning: One of the keys has been revoked\n"),s); severe = 1; } @@ -1148,13 +1148,13 @@ time_t at = key->subkeys->expires ? key->subkeys->expires : 0; if (at) { - state_attach_puts (_("Warning: The key used to create the " + state_puts (_("Warning: The key used to create the " "signature expired at: "), s); print_time (at , s); - state_attach_puts ("\n", s); + state_puts ("\n", s); } else - state_attach_puts (_("Warning: At least one certification key " + state_puts (_("Warning: At least one certification key " "has expired\n"), s); } @@ -1170,29 +1170,29 @@ sig = sig->next, i++) ; - state_attach_puts (_("Warning: The signature expired at: "), s); + state_puts (_("Warning: The signature expired at: "), s); print_time (sig ? sig->exp_timestamp : 0, s); - state_attach_puts ("\n", s); + state_puts ("\n", s); } if ((sum & GPGME_SIGSUM_KEY_MISSING)) - state_attach_puts (_("Can't verify due to a missing " + state_puts (_("Can't verify due to a missing " "key or certificate\n"), s); if ((sum & GPGME_SIGSUM_CRL_MISSING)) { - state_attach_puts (_("The CRL is not available\n"), s); + state_puts (_("The CRL is not available\n"), s); severe = 1; } if ((sum & GPGME_SIGSUM_CRL_TOO_OLD)) { - state_attach_puts (_("Available CRL is too old\n"), s); + state_puts (_("Available CRL is too old\n"), s); severe = 1; } if ((sum & GPGME_SIGSUM_BAD_POLICY)) - state_attach_puts (_("A policy requirement was not met\n"), s); + state_puts (_("A policy requirement was not met\n"), s); if ((sum & GPGME_SIGSUM_SYS_ERROR)) { @@ -1201,7 +1201,7 @@ gpgme_signature_t sig; unsigned int i; - state_attach_puts (_("A system error occurred"), s ); + state_puts (_("A system error occurred"), s ); /* Try to figure out some more detailed system error information. */ result = gpgme_op_verify_result (ctx); @@ -1216,17 +1216,17 @@ if (t0 || t1) { - state_attach_puts (": ", s); + state_puts (": ", s); if (t0) - state_attach_puts (t0, s); + state_puts (t0, s); if (t1 && !(t0 && !strcmp (t0, t1))) { if (t0) - state_attach_puts (",", s); - state_attach_puts (t1, s); + state_puts (",", s); + state_puts (t1, s); } } - state_attach_puts ("\n", s); + state_puts ("\n", s); } #ifdef HAVE_GPGME_PKA_TRUST @@ -1235,16 +1235,16 @@ { if (sig->pka_trust == 1 && sig->pka_address) { - state_attach_puts (_("WARNING: PKA entry does not match " + state_puts (_("WARNING: PKA entry does not match " "signer's address: "), s); - state_attach_puts (sig->pka_address, s); - state_attach_puts ("\n", s); + state_puts (sig->pka_address, s); + state_puts ("\n", s); } else if (sig->pka_trust == 2 && sig->pka_address) { - state_attach_puts (_("PKA verified signer's address is: "), s); - state_attach_puts (sig->pka_address, s); - state_attach_puts ("\n", s); + state_puts (_("PKA verified signer's address is: "), s); + state_puts (sig->pka_address, s); + state_puts ("\n", s); } } @@ -1301,7 +1301,7 @@ *p++ = *s; *p++ = '\n'; *p = 0; - state_attach_puts (buf, state); + state_puts (buf, state); FREE (&buf); } @@ -1339,7 +1339,7 @@ break; } if (txt) - state_attach_puts (txt, s); + state_puts (txt, s); } static void print_smime_keyinfo (const char* msg, gpgme_signature_t sig, @@ -1349,8 +1349,8 @@ gpgme_user_id_t uids = NULL; int i, aka = 0; - state_attach_puts (msg, s); - state_attach_puts (" ", s); + state_puts (msg, s); + state_puts (" ", s); /* key is NULL when not present in the user's keyring */ if (key) { @@ -1364,30 +1364,30 @@ * and "aka" translation length */ msglen = mutt_strlen (msg) - 4; for (i = 0; i < msglen; i++) - state_attach_puts(" ", s); - state_attach_puts(_("aka: "), s); + state_puts(" ", s); + state_puts(_("aka: "), s); } - state_attach_puts (uids->uid, s); - state_attach_puts ("\n", s); + state_puts (uids->uid, s); + state_puts ("\n", s); aka = 1; } } else { - state_attach_puts (_("KeyID "), s); - state_attach_puts (sig->fpr, s); - state_attach_puts ("\n", s); + state_puts (_("KeyID "), s); + state_puts (sig->fpr, s); + state_puts ("\n", s); } msglen = mutt_strlen (msg) - 8; /* TODO: need to account for msg wide characters * and "created" translation length */ for (i = 0; i < msglen; i++) - state_attach_puts(" ", s); - state_attach_puts (_("created: "), s); + state_puts(" ", s); + state_puts (_("created: "), s); print_time (sig->timestamp, s); - state_attach_puts ("\n", s); + state_puts ("\n", s); } /* Show information about one signature. This function is called with @@ -1459,7 +1459,7 @@ snprintf (buf, sizeof (buf), _("Error getting key information for KeyID %s: %s\n"), fpr, gpgme_strerror (err)); - state_attach_puts (buf, s); + state_puts (buf, s); anybad = 1; } else if ((sum & GPGME_SIGSUM_GREEN)) @@ -1494,9 +1494,9 @@ /* L10N: This is trying to match the width of the "Problem signature from:" translation just above. */ - state_attach_puts (_(" expires: "), s); + state_puts (_(" expires: "), s); print_time (sig->exp_timestamp, s); - state_attach_puts ("\n", s); + state_puts ("\n", s); } show_sig_summary (sum, ctx, key, idx, s, sig); anywarn = 1; @@ -1555,7 +1555,7 @@ snprintf (buf, sizeof(buf)-1, _("Error: verification failed: %s\n"), gpgme_strerror (err)); - state_attach_puts (buf, s); + state_puts (buf, s); } else { /* Verification succeeded, see what the result is. */ @@ -1604,7 +1604,7 @@ snprintf (buf, sizeof (buf), _("*** Begin Notation (signature by: %s) ***\n"), signature->fpr); - state_attach_puts (buf, s); + state_puts (buf, s); for (notation = signature->notations; notation; notation = notation->next) { @@ -1613,18 +1613,18 @@ if (notation->name) { - state_attach_puts (notation->name, s); - state_attach_puts ("=", s); + state_puts (notation->name, s); + state_puts ("=", s); } if (notation->value) { - state_attach_puts (notation->value, s); + state_puts (notation->value, s); if (!(*notation->value && (notation->value[strlen (notation->value)-1]=='\n'))) - state_attach_puts ("\n", s); + state_puts ("\n", s); } } - state_attach_puts (_("*** End Notation ***\n"), s); + state_puts (_("*** End Notation ***\n"), s); } } } @@ -2438,7 +2438,7 @@ snprintf (errbuf, sizeof(errbuf)-1, _("Error: decryption/verification failed: %s\n"), gpgme_strerror (err)); - state_attach_puts (errbuf, s); + state_puts (errbuf, s); } else { /* Decryption/Verification succeeded */ @@ -2481,7 +2481,7 @@ if (!tmpfname) { pgpout = NULL; - state_attach_puts (_("Error: copy data failed\n"), s); + state_puts (_("Error: copy data failed\n"), s); } else {