Dear Kevin, Am 03.07.2026 schrieb Kevin J. McCarthy: > Please move the helper function back inside crypt-gpgme.c and make it a > static function there. There is no reason to put it in curs_lib.c, as I > mentioned before.
Sorry, my branches got messed up and thus my patches. Below you'll find a cleaned-up version. > Otherwise this looks good. Thank you for the work. It was a good experience. Thank you for all the help. -- >8 -- Subject: [PATCH 1/2] refactored alignment of strings into function Reviewed-by: Alejandro Colomar <[email protected]> --- crypt-gpgme.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/crypt-gpgme.c b/crypt-gpgme.c index ccae5503..fe91f2b2 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -1527,6 +1527,16 @@ static int show_sig_summary(unsigned long sum, return severe; } +static void align_to_msg(const char *msg, const char *key, STATE *s) +{ + int msgwid = mutt_strwidth(msg) - mutt_strwidth(_(key)) + 1; + + if (msgwid < 0) + msgwid = 0; + for (int i = 0; i < msgwid; i++) + state_puts(" ", s); + state_puts(key, s); +} static void show_fingerprint(gpgme_key_t key, STATE *state) { @@ -1619,9 +1629,8 @@ static void show_one_sig_validity(gpgme_ctx_t ctx, int idx, STATE *s) static void print_smime_keyinfo(const char *msg, gpgme_signature_t sig, gpgme_key_t key, STATE *s) { - int msgwid; gpgme_user_id_t uids = NULL; - int i, aka = 0; + int aka = 0; state_puts(msg, s); state_puts(" ", s); @@ -1633,14 +1642,7 @@ static void print_smime_keyinfo(const char *msg, gpgme_signature_t sig, if (uids->revoked) continue; if (aka) - { - msgwid = mutt_strwidth(msg) - mutt_strwidth(_("aka: ")) + 1; - if (msgwid < 0) - msgwid = 0; - for (i = 0; i < msgwid; i++) - state_puts(" ", s); - state_puts(_("aka: "), s); - } + align_to_msg(msg, _("aka: "), s); state_puts(uids->uid, s); state_puts("\n", s); @@ -1666,12 +1668,7 @@ static void print_smime_keyinfo(const char *msg, gpgme_signature_t sig, "Jan 1 1970" is not the created date. */ if (sig->timestamp) { - msgwid = mutt_strwidth(msg) - mutt_strwidth(_("created: ")) + 1; - if (msgwid < 0) - msgwid = 0; - for (i = 0; i < msgwid; i++) - state_puts(" ", s); - state_puts(_("created: "), s); + align_to_msg(msg, _("created: "), s); print_time(sig->timestamp, s); state_puts("\n", s); } -- 2.47.3 -- >8 -- Subject: [PATCH 2/2] show s/mime keyid for successfully checked signatures --- crypt-gpgme.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crypt-gpgme.c b/crypt-gpgme.c index fe91f2b2..63dbc99e 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -1538,12 +1538,11 @@ static void align_to_msg(const char *msg, const char *key, STATE *s) state_puts(key, s); } -static void show_fingerprint(gpgme_key_t key, STATE *state) +static void show_fingerprint(const char *msg, gpgme_key_t key, STATE *state) { const char *s; int i, is_pgp; char *buf, *p; - const char *prefix = _("Fingerprint: "); if (!key) return; @@ -1552,9 +1551,9 @@ static void show_fingerprint(gpgme_key_t key, STATE *state) return; is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP); - buf = safe_malloc( strlen(prefix) + strlen(s) * 4 + 2 ); - strcpy(buf, prefix); /* __STRCPY_CHECKED__ */ - p = buf + strlen(buf); + align_to_msg(msg, _("Fingerprint: "), state); + buf = safe_malloc( strlen(s) * 4 + 2 ); + p = buf; if (is_pgp && strlen(s) == 40) { /* PGP v4 style formatted. */ for (i=0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) @@ -1648,6 +1647,7 @@ static void print_smime_keyinfo(const char *msg, gpgme_signature_t sig, aka = 1; } + show_fingerprint(msg, key, s); } else { @@ -1765,7 +1765,6 @@ static int show_one_sig_status(gpgme_ctx_t ctx, int idx, STATE *s) ultimate). */ print_smime_keyinfo(_("Good signature from:"), sig, key, s); show_one_sig_validity(ctx, idx, s); - show_fingerprint(key,s); if (show_sig_summary(sum, ctx, key, idx, s, sig)) anywarn = 1; } -- 2.47.3
signature.asc
Description: PGP signature
