core: Extend gpgme_user_id_t with uidhash member.
* src/gpgme.h.in (struct _gpgme_user_id): Add field 'uidhash'. * src/key.c (gpgme_key_unref): Free it. * src/keylist.c (keylist_colon_handler): Set it. * tests/run-keylist.c (main): Print it. -- The uidhash value is part of gpg's output since the year 2005. This now adds support to gpgme. The application for uidhash is to select a user id in an edit interactor: Instead of giving the number of the user id, the uidhash value can be be used to avoid tracking the user id numbers. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
7e7eaf4342
commit
5eeae535ee
1
NEWS
1
NEWS
@ -13,6 +13,7 @@ Noteworthy changes in version 1.14.0 (unreleased)
|
|||||||
|
|
||||||
* Interface changes relative to the 1.13.1 release:
|
* Interface changes relative to the 1.13.1 release:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
gpgme_user_id_t EXTENDED: New field 'uidhash'.
|
||||||
cpp: UserID::remark NEW.
|
cpp: UserID::remark NEW.
|
||||||
cpp: UserID::remarks NEW.
|
cpp: UserID::remarks NEW.
|
||||||
cpp: GpgSignKeyEditInteractor::setDupeOk NEW.
|
cpp: GpgSignKeyEditInteractor::setDupeOk NEW.
|
||||||
|
@ -3581,6 +3581,12 @@ Reserved for the origin of this user ID.
|
|||||||
|
|
||||||
Reserved for the time of the last update of this user ID.
|
Reserved for the time of the last update of this user ID.
|
||||||
|
|
||||||
|
@item char *uidhash;
|
||||||
|
A string used by gpg to identify a user ID. This string can be used
|
||||||
|
at certain prompts of @code{gpgme_op_edit} to select a user ID. Users
|
||||||
|
must be prepared to see a @code{NULL} value here. The format of the
|
||||||
|
value is not specified and may depend on the GPGME or GnuPG version.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
@ -728,6 +728,9 @@ struct _gpgme_user_id
|
|||||||
|
|
||||||
/* Time of the last refresh of this user id. 0 if unknown. */
|
/* Time of the last refresh of this user id. 0 if unknown. */
|
||||||
unsigned long last_update;
|
unsigned long last_update;
|
||||||
|
|
||||||
|
/* The string to exactly identify a userid. Might be NULL. */
|
||||||
|
char *uidhash;
|
||||||
};
|
};
|
||||||
typedef struct _gpgme_user_id *gpgme_user_id_t;
|
typedef struct _gpgme_user_id *gpgme_user_id_t;
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ gpgme_key_unref (gpgme_key_t key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free (uid->address);
|
free (uid->address);
|
||||||
|
free (uid->uidhash);
|
||||||
free (uid);
|
free (uid);
|
||||||
uid = next_uid;
|
uid = next_uid;
|
||||||
}
|
}
|
||||||
|
@ -831,6 +831,12 @@ keylist_colon_handler (void *priv, char *line)
|
|||||||
|
|
||||||
if (field[1])
|
if (field[1])
|
||||||
set_userid_flags (key, field[1]);
|
set_userid_flags (key, field[1]);
|
||||||
|
if (field[7] && *field[7])
|
||||||
|
{
|
||||||
|
gpgme_user_id_t uid = key->_last_uid;
|
||||||
|
assert (uid);
|
||||||
|
uid->uidhash = strdup (field[7]);
|
||||||
|
}
|
||||||
opd->tmp_uid = key->_last_uid;
|
opd->tmp_uid = key->_last_uid;
|
||||||
if (fields >= 20)
|
if (fields >= 20)
|
||||||
{
|
{
|
||||||
|
@ -330,6 +330,8 @@ main (int argc, char **argv)
|
|||||||
printf (" name: %s\n", uid->name);
|
printf (" name: %s\n", uid->name);
|
||||||
if (uid->comment)
|
if (uid->comment)
|
||||||
printf (" cmmnt: %s\n", uid->comment);
|
printf (" cmmnt: %s\n", uid->comment);
|
||||||
|
if (uid->uidhash)
|
||||||
|
printf (" uidhash: %s\n", uid->uidhash);
|
||||||
printf (" upd: %lu (%u)\n", uid->last_update, uid->origin);
|
printf (" upd: %lu (%u)\n", uid->last_update, uid->origin);
|
||||||
printf (" valid: %s\n",
|
printf (" valid: %s\n",
|
||||||
uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown":
|
uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown":
|
||||||
|
Loading…
Reference in New Issue
Block a user