aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgme.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-05-19 15:01:07 +0000
committerWerner Koch <[email protected]>2016-05-19 15:04:54 +0000
commit88f2c1c0d16eee6bb36a901623ea65ac69499f03 (patch)
tree4ac0d8ab84bee699987f61e277e8c4d80e857850 /src/gpgme.c
parentapi: Remove arbitrary restriction from gpgme_op_verify. (diff)
downloadgpgme-88f2c1c0d16eee6bb36a901623ea65ac69499f03.tar.gz
gpgme-88f2c1c0d16eee6bb36a901623ea65ac69499f03.zip
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 <[email protected]>
Diffstat (limited to 'src/gpgme.c')
-rw-r--r--src/gpgme.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gpgme.c b/src/gpgme.c
index 0b42ea19..3289be9d 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -82,6 +82,30 @@ gpgme_set_global_flag (const char *name, const char *value)
}
+/* Set the flag NAME for CTX to VALUE. The supported flags are:
+ *
+ * - full-status :: With a value of "1" the status callback set by
+ * gpgme_set_status_cb returns all status lines
+ * except for PROGRESS lines. With the default of
+ * "0" the status callback is only called in certain
+ * situations.
+ */
+gpgme_error_t
+gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
+{
+ if (!ctx || !name || !value)
+ return gpg_error (GPG_ERR_INV_VALUE);
+ else if (!strcmp (name, "full-status"))
+ {
+ ctx->full_status = *value? !!atoi (value) : 0;
+ }
+ else
+ return gpg_error (GPG_ERR_UNKNOWN_NAME);
+
+ return 0;
+}
+
+
/* Create a new context as an environment for GPGME crypto
operations. */