On 2026-07-02T22:26:32+0200, Robert Jäschke via Mutt-dev wrote:
[...]
> So here are my two patches (thanks also to Alejandro for the tipps to
> improve my code):
> 
> 
> -- >8 --
> Subject: [PATCH 1/2] refactored alignment of strings into function

For the first patch:

        Reviewed-by: Alejandro Colomar <[email protected]>


Have a lovely night!
Alex

> ---
>  crypt-gpgme.c | 19 +++----------------
>  curs_lib.c    | 11 +++++++++++
>  protos.h      |  1 +
>  3 files changed, 15 insertions(+), 16 deletions(-)
[...]
> -- >8 --
> Subject: [PATCH 2/2] show s/mime keyid for successfully checked signatures
> 
> ---
>  crypt-gpgme.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/crypt-gpgme.c b/crypt-gpgme.c
> index 4e0be87f..5fa7b7e5 100644
> --- a/crypt-gpgme.c
> +++ b/crypt-gpgme.c
> @@ -1528,12 +1528,11 @@ static int show_sig_summary(unsigned long sum,
>  }
>  
>  
> -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;
> @@ -1542,9 +1541,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);
> +  mutt_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++)
> @@ -1638,6 +1637,8 @@ static void print_smime_keyinfo(const char *msg, 
> gpgme_signature_t sig,
>  
>        aka = 1;
>      }
> +
> +    show_fingerprint(msg, key, s);
>    }
>    else
>    {
> @@ -1755,7 +1756,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
> 
> 

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to