aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2009-11-10 14:49:35 +0000
committerMarcus Brinkmann <[email protected]>2009-11-10 14:49:35 +0000
commitcda07b9ab4f09ac87bc1aebbbe113f125eedeb02 (patch)
tree53b0a5bc6d03bbea4b0fce70ea3454777907ad4c /src
parent2009-11-10 Marcus Brinkmann <[email protected]> (diff)
downloadgpgme-cda07b9ab4f09ac87bc1aebbbe113f125eedeb02.tar.gz
gpgme-cda07b9ab4f09ac87bc1aebbbe113f125eedeb02.zip
2009-11-10 Marcus Brinkmann <[email protected]>
* gpgme.h.in (gpgme_get_sub_protocol): Add prototype. * gpgme.def, libgpgme.vers: Add gpgme_get_sub_protocol. * context.h (struct gpgme_context): New member sub_protocol. * gpgme.c (gpgme_set_sub_protocol): Set CTX->sub_protocol. (gpgme_get_sub_protocol): New function. * op-support.c (_gpgme_op_reset): Set sub protocol.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/context.h3
-rw-r--r--src/gpgme.c21
-rw-r--r--src/gpgme.def1
-rw-r--r--src/gpgme.h.in4
-rw-r--r--src/libgpgme.vers1
-rw-r--r--src/op-support.c4
7 files changed, 34 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b758b7ba..91ea9da0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2009-11-10 Marcus Brinkmann <[email protected]>
+ * gpgme.h.in (gpgme_get_sub_protocol): Add prototype.
+ * gpgme.def, libgpgme.vers: Add gpgme_get_sub_protocol.
+ * context.h (struct gpgme_context): New member sub_protocol.
+ * gpgme.c (gpgme_set_sub_protocol): Set CTX->sub_protocol.
+ (gpgme_get_sub_protocol): New function.
+ * op-support.c (_gpgme_op_reset): Set sub protocol.
+
* Makefile.am (uiserver_components): New variable.
(main_sources): Add it.
* ops.h, key.c (_gpgme_key_append_name): Take CONVERT argument,
diff --git a/src/context.h b/src/context.h
index 6818e7e4..6ab0154a 100644
--- a/src/context.h
+++ b/src/context.h
@@ -89,6 +89,9 @@ struct gpgme_context
/* The running engine process. */
engine_t engine;
+ /* Engine's sub protocol. */
+ gpgme_protocol_t sub_protocol;
+
/* True if armor mode should be used. */
unsigned int use_armor : 1;
diff --git a/src/gpgme.c b/src/gpgme.c
index b6c79a0d..7c523851 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -305,13 +305,22 @@ gpgme_get_protocol (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
{
- gpgme_error_t err;
- TRACE_BEG2 (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)",
- protocol, gpgme_get_protocol_name (protocol)
- ? gpgme_get_protocol_name (protocol) : "invalid");
+ TRACE2 (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)",
+ protocol, gpgme_get_protocol_name (protocol)
+ ? gpgme_get_protocol_name (protocol) : "invalid");
+ ctx->sub_protocol = protocol;
+ return 0;
+}
- err = _gpgme_engine_set_protocol (ctx->engine, protocol);
- return TRACE_ERR (err);
+
+gpgme_error_t
+gpgme_get_sub_protocol (gpgme_ctx_t ctx)
+{
+ TRACE2 (DEBUG_CTX, "gpgme_get_sub_protocol", ctx,
+ "ctx->sub_protocol=%i (%s)", ctx->sub_protocol,
+ gpgme_get_protocol_name (ctx->sub_protocol)
+ ? gpgme_get_protocol_name (ctx->sub_protocol) : "invalid");
+ return ctx->sub_protocol;
}
diff --git a/src/gpgme.def b/src/gpgme.def
index 5a1b2c15..eee25311 100644
--- a/src/gpgme.def
+++ b/src/gpgme.def
@@ -194,6 +194,7 @@ EXPORTS
gpgme_key_from_uid @149
gpgme_set_sub_protocol @150
+ gpgme_get_sub_protocol @151
; END
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 2a3acd47..13a33992 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -810,8 +810,10 @@ gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx);
prococol (for example, an UISERVER can support OpenPGP and CMS).
This is reset to the default with gpgme_set_protocol. */
gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx,
- gpgme_protocol_t proto);
+ gpgme_protocol_t proto);
+/* Get the sub protocol. */
+gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx);
/* Get the string describing protocol PROTO, or NULL if invalid. */
const char *gpgme_get_protocol_name (gpgme_protocol_t proto);
diff --git a/src/libgpgme.vers b/src/libgpgme.vers
index 449197cb..a9ddfb3c 100644
--- a/src/libgpgme.vers
+++ b/src/libgpgme.vers
@@ -75,6 +75,7 @@ GPGME_1.1 {
gpgme_key_from_uid;
gpgme_set_sub_protocol;
+ gpgme_get_sub_protocol;
};
diff --git a/src/op-support.c b/src/op-support.c
index 90e1283e..8dfe15d7 100644
--- a/src/op-support.c
+++ b/src/op-support.c
@@ -130,6 +130,10 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)
}
}
+ err = _gpgme_engine_set_protocol (ctx->engine, ctx->sub_protocol);
+ if (err)
+ return err;
+
if (type == 1 || (type == 2 && !ctx->io_cbs.add))
{
/* Use private event loop. */