From 025866092e14bb4ed68fe23140bf62dcce770cc5 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Mon, 22 Apr 2002 21:58:26 +0000 Subject: [PATCH] doc/ 2002-04-22 Marcus Brinkmann * gpgme.texi (Passphrase Callback): Fix small typo. Document the new function gpgme_get_passphrase_cb. (Progress Meter Callback): Document the new function gpgme_get_progress_cb. gpgme/ 2002-04-22 Marcus Brinkmann * gpgme.c (gpgme_get_passphrase_cb): New function. (gpgme_get_progress_cb): New function. * gpgme.h: Add new prototypes for gpgme_get_passphrase_cb and gpgme_get_progress_cb. --- NEWS | 10 ++++++++++ doc/ChangeLog | 7 +++++++ doc/gpgme.texi | 18 +++++++++++++++++- gpgme/ChangeLog | 7 +++++++ gpgme/gpgme.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ gpgme/gpgme.h | 10 ++++++++++ 6 files changed, 101 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a5a8840..e811e5e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ + * The current passphrase callback and progress meter callback can be + retrieved with the new functions gpgme_get_passphrase_cb and + gpgme_get_progress_cb respectively. + + * Interface changes relative to the 0.3.5 release: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +gpgme_get_passphrase_cb NEW +gpgme_get_progress_cb NEW +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Noteworthy changes in version 0.3.5 (2002-04-01) ------------------------------------------------ diff --git a/doc/ChangeLog b/doc/ChangeLog index 954014a..b1257f5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2002-04-22 Marcus Brinkmann + + * gpgme.texi (Passphrase Callback): Fix small typo. Document the + new function gpgme_get_passphrase_cb. + (Progress Meter Callback): Document the new function + gpgme_get_progress_cb. + 2002-04-16 Marcus Brinkmann * gpgme.texi (Creating a Signature): Fix function name. Reported diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 63568f5..63bfde7 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -1153,7 +1153,7 @@ current mode otherwise. Note that 0 is not a valid mode value. The @code{GpgmePassphraseCb} type is the type of functions usable as passphrase callback function. -The string @var{desc} contains a test usable to be displayed to the +The string @var{desc} contains a text usable to be displayed to the user of the application. The function should return a passphrase for the context when invoked with @var{desc} not being @code{NULL}. @@ -1182,6 +1182,14 @@ calling @code{gpgme_set_passphrase_cb} with @var{passfunc} being @code{NULL}. @end deftypefun +@deftypefun void gpgme_get_passphrase_cb (@w{GpgmeCtx @var{ctx}}, @w{GpgmePassphraseCb *@var{passfunc}}, @w{void **@var{hook_value}}) +The function @code{gpgme_get_passphrase_cb} returns the function that +is used when a passphrase needs to be provided by the user in +@var{*passfunc}, and the first argument for this function in +@var{*hook_value}. If no passphrase callback is set, or @var{ctx} is +not a valid pointer, @code{NULL} is returned in both variables. +@end deftypefun + @node Progress Meter Callback @subsection Progress Meter Callback @@ -1215,6 +1223,14 @@ calling @code{gpgme_set_progress_cb} with @var{progfunc} being @code{NULL}. @end deftypefun +@deftypefun void gpgme_get_progress_cb (@w{GpgmeCtx @var{ctx}}, @w{GpgmeProgressCb *@var{progfunc}}, @w{void **@var{hook_value}}) +The function @code{gpgme_get_progress_cb} returns the function that is +used to inform the user about the progress made in @var{*progfunc}, +and the first argument for this function in @var{*hook_value}. If no +progress callback is set, or @var{ctx} is not a valid pointer, +@code{NULL} is returned in both variables. +@end deftypefun + @node Key Management @section Key Management diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index e77e3a0..2719c57 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2002-04-22 Marcus Brinkmann + + * gpgme.c (gpgme_get_passphrase_cb): New function. + (gpgme_get_progress_cb): New function. + * gpgme.h: Add new prototypes for gpgme_get_passphrase_cb and + gpgme_get_progress_cb. + 2002-03-28 Werner Koch * gpgme.h (GpgmeAttr): Add values for issuer and chaining. diff --git a/gpgme/gpgme.c b/gpgme/gpgme.c index 1de0dc7..396ae48 100644 --- a/gpgme/gpgme.c +++ b/gpgme/gpgme.c @@ -397,6 +397,32 @@ gpgme_set_passphrase_cb (GpgmeCtx ctx, GpgmePassphraseCb cb, void *cb_value) } } + +/** + * gpgme_get_passphrase_cb: + * @ctx: the context + * @cb: The current callback function + * @cb_value: The current value passed to the callback function + * + * This function returns the callback function to be used to pass a passphrase + * to the crypto engine. + **/ +void +gpgme_get_passphrase_cb (GpgmeCtx ctx, GpgmePassphraseCb *cb, void **cb_value) +{ + if (ctx) + { + *cb = ctx->passphrase_cb; + *cb_value = ctx->passphrase_cb_value; + } + else + { + *cb = NULL; + *cb_value = NULL; + } +} + + /** * gpgme_set_progress_cb: * @ctx: the context @@ -423,3 +449,27 @@ gpgme_set_progress_cb (GpgmeCtx ctx, GpgmeProgressCb cb, void *cb_value) ctx->progress_cb_value = cb_value; } } + + +/** + * gpgme_get_progress_cb: + * @ctx: the context + * @cb: The current callback function + * @cb_value: The current value passed to the callback function + * + * This function returns the callback function to be used as a progress indicator. + **/ +void +gpgme_get_progress_cb (GpgmeCtx ctx, GpgmeProgressCb *cb, void **cb_value) +{ + if (ctx) + { + *cb = ctx->progress_cb; + *cb_value = ctx->progress_cb_value; + } + else + { + *cb = NULL; + *cb_value = NULL; + } +} diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 49df920..6561564 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -249,10 +249,20 @@ int gpgme_get_keylist_mode (GpgmeCtx ctx); void gpgme_set_passphrase_cb (GpgmeCtx ctx, GpgmePassphraseCb cb, void *hook_value); +/* Get the current passphrase callback function in *CB and the current + hook value in *HOOK_VALUE. */ +void gpgme_get_passphrase_cb (GpgmeCtx ctx, GpgmePassphraseCb *cb, + void **hook_value); + /* Set the progress callback function in CTX to CB. HOOK_VALUE is passed as first argument to the progress callback function. */ void gpgme_set_progress_cb (GpgmeCtx c, GpgmeProgressCb cb, void *hook_value); +/* Get the current progress callback function in *CB and the current + hook value in *HOOK_VALUE. */ +void gpgme_get_progress_cb (GpgmeCtx ctx, GpgmeProgressCb *cb, + void **hook_value); + /* Delete all signers from CTX. */ void gpgme_signers_clear (GpgmeCtx ctx); -- 2.26.2