[Gpa-commits] r887 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 7 17:13:02 CEST 2008


Author: werner
Date: 2008-05-07 17:13:01 +0200 (Wed, 07 May 2008)
New Revision: 887

Modified:
   trunk/src/gpgmetools.c
   trunk/src/recipientdlg.c
Log:
Use auto key locate for recipient keys.


Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c	2008-05-07 11:19:25 UTC (rev 886)
+++ trunk/src/gpgmetools.c	2008-05-07 15:13:01 UTC (rev 887)
@@ -1156,7 +1156,8 @@
 }
 
 
-/* Return true if the gpg engine has at least version NEED_VERSION.  */
+/* Return 1 if the gpg engine has at least version NEED_VERSION,
+   otherwise 0.  */
 int
 is_gpg_version_at_least (const char *need_version)
 {
@@ -1166,7 +1167,7 @@
   while (engine)
     {
       if (engine->protocol == GPGME_PROTOCOL_OpenPGP)
-        return compare_version_strings (engine->version, need_version);
+        return !!compare_version_strings (engine->version, need_version);
       engine = engine->next;
     }
   return 0; /* No gpg-engine available. */

Modified: trunk/src/recipientdlg.c
===================================================================
--- trunk/src/recipientdlg.c	2008-05-07 11:19:25 UTC (rev 886)
+++ trunk/src/recipientdlg.c	2008-05-07 15:13:01 UTC (rev 887)
@@ -466,12 +466,21 @@
 parse_one_recipient (gpgme_ctx_t ctx, GtkListStore *store, GtkTreeIter *iter,
                      struct userdata_s *info)
 {
+  static int have_locate = -1;
   gpgme_key_t key = NULL;
+  gpgme_keylist_mode_t mode;
 
+  if (have_locate == -1)
+    have_locate = is_gpg_version_at_least ("2.0.10");
+
   g_return_if_fail (info);
 
   clear_keyinfo (&info->pgp);
   gpgme_set_protocol (ctx, GPGME_PROTOCOL_OpenPGP);
+  mode = gpgme_get_keylist_mode (ctx);
+  if (have_locate)
+    gpgme_set_keylist_mode (ctx, (mode | (GPGME_KEYLIST_MODE_LOCAL
+                                          | GPGME_KEYLIST_MODE_EXTERN)));
   if (!gpgme_op_keylist_start (ctx, info->mailbox, 0))
     {
       while (!gpgme_op_keylist_next (ctx, &key))
@@ -491,6 +500,7 @@
         }
     }
   gpgme_op_keylist_end (ctx);
+  gpgme_set_keylist_mode (ctx, mode);
 
   clear_keyinfo (&info->x509);
   gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);



More information about the Gpa-commits mailing list