diff --git a/doc/gpg.texi b/doc/gpg.texi index 7d314b6c3..f1dee58d3 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1177,7 +1177,7 @@ for the key fingerprint, "%t" for the extension of the image type (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"), "%v" for the single-character calculated validity of the image being viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g. -"full"), +"full"), "%U" for a base32 encoded hash of the user ID, and "%%" for an actual percent sign. If neither %i or %I are present, then the photo will be supplied to the viewer on standard input. diff --git a/g10/main.h b/g10/main.h index 6876e0a95..8d29071ff 100644 --- a/g10/main.h +++ b/g10/main.h @@ -109,6 +109,7 @@ struct expando_args byte imagetype; int validity_info; const char *validity_string; + const byte *namehash; }; char *pct_expando(const char *string,struct expando_args *args); diff --git a/g10/misc.c b/g10/misc.c index 82a13aa9a..43ea0d2e3 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -648,6 +648,23 @@ pct_expando(const char *string,struct expando_args *args) } break; + case 'U': /* z-base-32 encoded user id hash. */ + if (args->namehash) + { + char *tmp = zb32_encode (args->namehash, 8*20); + if (tmp) + { + if (idx + strlen (tmp) < maxlen) + { + strcpy (ret+idx, tmp); + idx += strlen (tmp); + } + xfree (tmp); + done = 1; + } + } + break; + case 'c': /* signature count from card, if any. */ if(idx+10namehash; if(pk) keyid_from_pk(pk,kid);