diff --git a/NEWS b/NEWS index 3b8fea3f..55c8660d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Noteworthy changes in version 1.4.3 (unreleased) ------------------------------------------------ + * Interface changes relative to the 1.4.2 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgme_signers_count NEW. + Noteworthy changes in version 1.4.2 (2013-05-28) ------------------------------------------------ diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 217dc13a..1a193706 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -4785,6 +4785,11 @@ list of signers in the context @var{ctx}. Calling this function acquires an additional reference for the key. @end deftypefun +@deftypefun @w{unsigned int} gpgme_signers_count (@w{const gpgme_ctx_t @var{ctx}}) +The function @code{gpgme_signers_count} returns the number of signer keys in +the context @var{ctx}. +@end deftypefun + @deftypefun gpgme_key_t gpgme_signers_enum (@w{const gpgme_ctx_t @var{ctx}}, @w{int @var{seq}}) The function @code{gpgme_signers_enum} returns the @var{seq}th key in the list of signers in the context @var{ctx}. An additional reference diff --git a/src/gpgme.def b/src/gpgme.def index 3a6e0e3e..7610d37e 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -209,5 +209,7 @@ EXPORTS gpgme_set_pinentry_mode @158 gpgme_get_pinentry_mode @159 + gpgme_signers_count @160 + ; END diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 11780d11..f644a509 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -934,6 +934,9 @@ void gpgme_signers_clear (gpgme_ctx_t ctx); /* Add KEY to list of signers in CTX. */ gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key); +/* Return the number of signers in CTX. */ +unsigned int gpgme_signers_count (const gpgme_ctx_t ctx); + /* Return the SEQth signer's key in CTX. */ gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq); diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 358b63c7..0b2e89db 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -143,6 +143,7 @@ GPGME_1.0 { gpgme_set_textmode; gpgme_signers_add; gpgme_signers_clear; + gpgme_signers_count; gpgme_signers_enum; gpgme_key_ref; diff --git a/src/signers.c b/src/signers.c index 88f923c5..f43fafc7 100644 --- a/src/signers.c +++ b/src/signers.c @@ -93,6 +93,14 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) } +/* Return the number of signers in CTX. */ +unsigned int +gpgme_signers_count (const gpgme_ctx_t ctx) +{ + return ctx? ctx->signers_len : 0; +} + + /* Return the SEQth signer's key in CTX with one reference. */ gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq)