From 2f96067fe71e796e9da378620ad16a9f94a7b8ac Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 18 Oct 2011 22:46:50 +0200 Subject: change gpg import message to resemble gpg --list-keys Dan: const pointers, don't worry about bitfields. Signed-off-by: Florian Pritz Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 2 ++ lib/libalpm/signing.c | 2 ++ src/pacman/callback.c | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 9b2d8a92..f25d4c44 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -226,6 +226,8 @@ typedef struct _alpm_pgpkey_t { char *email; alpm_time_t created; alpm_time_t expires; + unsigned int length; + unsigned int revoked; } alpm_pgpkey_t; /** Signature result. Contains the key, status, and validity of a given diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 92f34b56..dbdd350b 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -270,6 +270,8 @@ static int key_search(alpm_handle_t *handle, const char *fpr, pgpkey->email = key->uids->email; pgpkey->created = key->subkeys->timestamp; pgpkey->expires = key->subkeys->expires; + pgpkey->length = key->subkeys->length; + pgpkey->revoked = key->subkeys->revoked; ret = 1; error: diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 3889c088..4b2ad2aa 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -347,10 +347,14 @@ void cb_question(alpm_question_t event, void *data1, void *data2, { alpm_pgpkey_t *key = data1; char created[12]; + const char *revoked = ""; time_t time = (time_t)key->created; strftime(created, 12, "%Y-%m-%d", localtime(&time)); - *response = yesno(_(":: Import PGP key %s, \"%s\", created %s?"), - key->fingerprint, key->uid, created); + if (key->revoked) { + revoked = " (revoked)"; + } + *response = yesno(_(":: Import PGP key %d/%s, \"%s\", created: %s%s?"), + key->length, key->fingerprint, key->uid, created, revoked); } break; } -- cgit v1.2.3-24-g4f1b