[Pkg-gnupg-commit] [gpgme] 123/412: api: Add new context flag "raw-description".

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit dac2c5441d418536632f014c8b0e1359580279d1
Author: Werner Koch <wk at gnupg.org>
Date:   Sat May 21 10:22:57 2016 +0200

    api: Add new context flag "raw-description".
    
    * src/context.h (struct gpgme_context): Add field raw_description.
    * src/gpgme.c (gpgme_set_ctx_flag): New flag.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 doc/gpgme.texi |  6 ++++++
 src/context.h  |  5 +++++
 src/gpgme.c    | 13 +++++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index 4d7a874..8d666c3 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -2752,6 +2752,12 @@ gpgme_set_status_cb returns all status lines with the exception of
 PROGRESS lines.  With the default of "0" the status callback is only
 called in certain situations.
 
+ at item "raw-description"
+Setting the @var{value} to "1" returns human readable strings in a raw
+format.  For example the non breaking space characters ("~") will not
+be removed from the @code{description} field of the
+ at code{gpgme_tofu_info_t} object.
+
 @end table
 
 This function returns @code{0} on success.
diff --git a/src/context.h b/src/context.h
index 078f0cb..de69a7a 100644
--- a/src/context.h
+++ b/src/context.h
@@ -105,6 +105,11 @@ struct gpgme_context
    * lines.  */
   unsigned int full_status : 1;
 
+  /* The Tofu info has a human readable string which is presented to
+   * the user in a directly usable format.  By enabling this flag the
+   * unmodified string, as received form gpg, will be returned.  */
+  unsigned int raw_description : 1;
+
   /* Flags for keylist mode.  */
   gpgme_keylist_mode_t keylist_mode;
 
diff --git a/src/gpgme.c b/src/gpgme.c
index 3289be9..e0cd9b0 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -93,11 +93,20 @@ gpgme_set_global_flag (const char *name, const char *value)
 gpgme_error_t
 gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
 {
+  int abool;
+
   if (!ctx || !name || !value)
     return gpg_error (GPG_ERR_INV_VALUE);
-  else if (!strcmp (name, "full-status"))
+
+  abool = *value? !!atoi (value) : 0;
+
+  if (!strcmp (name, "full-status"))
+    {
+      ctx->full_status = abool;
+    }
+  else if (!strcmp (name, "raw-description"))
     {
-      ctx->full_status = *value? !!atoi (value) : 0;
+      ctx->raw_description = abool;
     }
   else
     return gpg_error (GPG_ERR_UNKNOWN_NAME);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list