mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: New %U expando for the photo viewer.
* g10/photoid.c (show_photos): Set namehash. * g10/misc.c (pct_expando): Add "%U" expando. -- This makes is possible to extract all photos ids from a key to different files. (cherry picked from commit e184a11f94e2d41cd9266484542631bec23628b5) Resolved conflicts: g10/photoid.c - whitespaces
This commit is contained in:
parent
2a415c47ea
commit
d7750a15d5
@ -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"),
|
(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
|
"%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.
|
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,
|
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.
|
then the photo will be supplied to the viewer on standard input.
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ struct expando_args
|
|||||||
byte imagetype;
|
byte imagetype;
|
||||||
int validity_info;
|
int validity_info;
|
||||||
const char *validity_string;
|
const char *validity_string;
|
||||||
|
const byte *namehash;
|
||||||
};
|
};
|
||||||
|
|
||||||
char *pct_expando(const char *string,struct expando_args *args);
|
char *pct_expando(const char *string,struct expando_args *args);
|
||||||
|
17
g10/misc.c
17
g10/misc.c
@ -648,6 +648,23 @@ pct_expando(const char *string,struct expando_args *args)
|
|||||||
}
|
}
|
||||||
break;
|
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. */
|
case 'c': /* signature count from card, if any. */
|
||||||
if(idx+10<maxlen)
|
if(idx+10<maxlen)
|
||||||
{
|
{
|
||||||
|
@ -297,11 +297,12 @@ show_photos(const struct user_attribute *attrs,
|
|||||||
u32 len;
|
u32 len;
|
||||||
u32 kid[2]={0,0};
|
u32 kid[2]={0,0};
|
||||||
|
|
||||||
memset(&args,0,sizeof(args));
|
memset (&args, 0, sizeof(args));
|
||||||
args.pk=pk;
|
args.pk = pk;
|
||||||
args.sk=sk;
|
args.validity_info = get_validity_info (pk, uid);
|
||||||
args.validity_info=get_validity_info(pk,uid);
|
args.validity_string = get_validity_string (pk, uid);
|
||||||
args.validity_string=get_validity_string(pk,uid);
|
namehash_from_uid (uid);
|
||||||
|
args.namehash = uid->namehash;
|
||||||
|
|
||||||
if(pk)
|
if(pk)
|
||||||
keyid_from_pk(pk,kid);
|
keyid_from_pk(pk,kid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user