diff --git a/NEWS b/NEWS index a5a88401..e811e5e0 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 954014ad..b1257f5e 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 63568f56..63bfde7a 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 e77e3a0a..2719c57b 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 1de0dc78..396ae484 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 49df9200..65615645 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);