From 88f2c1c0d16eee6bb36a901623ea65ac69499f03 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 19 May 2016 17:01:07 +0200 Subject: api: Add new function gpgme_set_ctx_flag. * src/gpgme.h.in (gpgme_set_ctx_flag): New prototype. * src/gpgme.c (gpgme_set_ctx_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new function. * src/context.h (struct gpgme_context): Add FULL_STATUS. * src/decrypt.c (_gpgme_decrypt_status_handler): Do not call the status callback if FULL_STATUS is set. * src/genkey.c (genkey_status_handler): Ditto. * src/passphrase.c (_gpgme_passphrase_status_handler): Ditto. * src/sign.c (_gpgme_sign_status_handler): Ditto. * src/engine-backend.h (struct engine_ops): Add SET_STATUS_CB and add adjust all definitions of that variable. * src/engine.c (_gpgme_engine_set_status_cb): New. * src/op-support.c (_gpgme_op_reset): Call this function. * src/engine-gpg.c (struct engine_gpg): Add fields MON_CB and MON_CB_VALUE. (gpg_set_status_cb): New. (_gpgme_engine_ops_gpg): Register that function. (read_status): Call the monitor callback. * src/engine-gpgsm.c (struct engine_gpgsm): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_gpgsm): Register that function. (gpgsm_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * src/engine-uiserver.c (struct engine_uiserver): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_uiserver): Register that function. (uiserver_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * tests/run-verify.c (status_cb): New. (print_result): Print algo names. (main): Add option --status. -- This new feature is mainly intended for bug tracking. Having access to the raw status lines might also be useful for applications, though. Signed-off-by: Werner Koch --- src/passphrase.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/passphrase.c') diff --git a/src/passphrase.c b/src/passphrase.c index c88e57d2..74d235cb 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -118,9 +118,8 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code, case GPGME_STATUS_ERROR: /* We abuse this status handler to forward ERROR status codes to - the caller. This should better be done in a generic handler, - but for now this is sufficient. */ - if (ctx->status_cb) + the caller. */ + if (ctx->status_cb && !ctx->full_status) { err = ctx->status_cb (ctx->status_cb_value, "ERROR", args); if (err) @@ -130,9 +129,8 @@ _gpgme_passphrase_status_handler (void *priv, gpgme_status_code_t code, case GPGME_STATUS_FAILURE: /* We abuse this status handler to forward FAILURE status codes - to the caller. This should better be done in a generic - handler, but for now this is sufficient. */ - if (ctx->status_cb) + to the caller. */ + if (ctx->status_cb && !ctx->full_status) { err = ctx->status_cb (ctx->status_cb_value, "FAILURE", args); if (err) @@ -173,6 +171,7 @@ _gpgme_passphrase_command_handler (void *priv, gpgme_status_code_t code, if (processed) *processed = 1; + /* Fake a status line to to convey the MAXLEN info. */ if (ctx->status_cb && opd->maxlen) err = ctx->status_cb (ctx->status_cb_value, "INQUIRE_MAXLEN", opd->maxlen); -- cgit v1.2.3