[svn] gpgme - r1426 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Tue Nov 10 15:49:36 CET 2009


Author: marcus
Date: 2009-11-10 15:49:35 +0100 (Tue, 10 Nov 2009)
New Revision: 1426

Modified:
   trunk/src/ChangeLog
   trunk/src/context.h
   trunk/src/gpgme.c
   trunk/src/gpgme.def
   trunk/src/gpgme.h.in
   trunk/src/libgpgme.vers
   trunk/src/op-support.c
Log:
2009-11-10  Marcus Brinkmann  <marcus at g10code.de>

	* 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.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/ChangeLog	2009-11-10 14:49:35 UTC (rev 1426)
@@ -1,5 +1,12 @@
 2009-11-10  Marcus Brinkmann  <marcus at g10code.de>
 
+	* 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,

Modified: trunk/src/context.h
===================================================================
--- trunk/src/context.h	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/context.h	2009-11-10 14:49:35 UTC (rev 1426)
@@ -89,6 +89,9 @@
   /* 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;
 

Modified: trunk/src/gpgme.c
===================================================================
--- trunk/src/gpgme.c	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/gpgme.c	2009-11-10 14:49:35 UTC (rev 1426)
@@ -305,13 +305,22 @@
 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;
 }
 
 

Modified: trunk/src/gpgme.def
===================================================================
--- trunk/src/gpgme.def	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/gpgme.def	2009-11-10 14:49:35 UTC (rev 1426)
@@ -194,6 +194,7 @@
 
     gpgme_key_from_uid                    @149
     gpgme_set_sub_protocol                @150
+    gpgme_get_sub_protocol                @151
 
 ; END
 

Modified: trunk/src/gpgme.h.in
===================================================================
--- trunk/src/gpgme.h.in	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/gpgme.h.in	2009-11-10 14:49:35 UTC (rev 1426)
@@ -810,8 +810,10 @@
    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);

Modified: trunk/src/libgpgme.vers
===================================================================
--- trunk/src/libgpgme.vers	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/libgpgme.vers	2009-11-10 14:49:35 UTC (rev 1426)
@@ -75,6 +75,7 @@
 
     gpgme_key_from_uid;
     gpgme_set_sub_protocol;
+    gpgme_get_sub_protocol;
 };
 
 

Modified: trunk/src/op-support.c
===================================================================
--- trunk/src/op-support.c	2009-11-10 09:07:19 UTC (rev 1425)
+++ trunk/src/op-support.c	2009-11-10 14:49:35 UTC (rev 1426)
@@ -130,6 +130,10 @@
         }
     }
 
+  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.  */




More information about the Gnupg-commits mailing list