core: Parse skipped_v3_keys
authorAndre Heinecke <aheinecke@intevation.de>
Thu, 15 Mar 2018 14:58:32 +0000 (15:58 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Thu, 15 Mar 2018 15:23:18 +0000 (16:23 +0100)
* src/gpgme.h.in (gpgme_import_result_t): Extend with skipped_v3_keys.
* src/import.c (gpgme_op_import_result): Extend debug with new field.
(parse_import_res): Parse skipped_v3_keys.
* tests/gpg/t-support.h, tests/run-support.h (print_import_result):
Print skipped_v3_keys.

--
This makes it possible to handle this in a GUI in a future
version.

GnuPG-Bug-Id: T3776

NEWS
src/gpgme.h.in
src/import.c
tests/gpg/t-support.h
tests/run-support.h

diff --git a/NEWS b/NEWS
index 1a342b1..c172697 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,10 +3,10 @@ Noteworthy changes in version 1.10.1 (unreleased)
 
  * Interface changes relative to the 1.10.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
  * Interface changes relative to the 1.10.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_import_result_t       EXTENDED: New field 'skipped_v3_keys'
  cpp: Key::locate                     NEW.
  cpp: Data::toString                  NEW.
 
  cpp: Key::locate                     NEW.
  cpp: Data::toString                  NEW.
 
-
 Noteworthy changes in version 1.10.0 (2017-12-12)
 -------------------------------------------------
 
 Noteworthy changes in version 1.10.0 (2017-12-12)
 -------------------------------------------------
 
index ff80023..73f2c94 100644 (file)
@@ -1637,6 +1637,9 @@ struct _gpgme_op_import_result
   /* Number of keys not imported.  */
   int not_imported;
 
   /* Number of keys not imported.  */
   int not_imported;
 
+  /* Number of v3 keys skipped.  */
+  int skipped_v3_keys;
+
   /* List of keys for which an import was attempted.  */
   gpgme_import_status_t imports;
 };
   /* List of keys for which an import was attempted.  */
   gpgme_import_status_t imports;
 };
index 386ca72..f0d9d9f 100644 (file)
@@ -94,8 +94,9 @@ gpgme_op_import_result (gpgme_ctx_t ctx)
       TRACE_LOG3 ("%i secret keys, %i imported, %i unchanged",
                  opd->result.secret_read, opd->result.secret_imported,
                  opd->result.secret_unchanged);
       TRACE_LOG3 ("%i secret keys, %i imported, %i unchanged",
                  opd->result.secret_read, opd->result.secret_imported,
                  opd->result.secret_unchanged);
-      TRACE_LOG2 ("%i skipped new keys, %i not imported",
-                 opd->result.skipped_new_keys, opd->result.not_imported);
+      TRACE_LOG3 ("%i skipped new keys, %i not imported, %i v3 skipped",
+                 opd->result.skipped_new_keys, opd->result.not_imported,
+                  opd->result.skipped_v3_keys);
 
       impstat = opd->result.imports;
       i = 0;
 
       impstat = opd->result.imports;
       i = 0;
@@ -212,6 +213,10 @@ parse_import_res (char *args, gpgme_import_result_t result)
   PARSE_NEXT (result->secret_unchanged);
   PARSE_NEXT (result->skipped_new_keys);
   PARSE_NEXT (result->not_imported);
   PARSE_NEXT (result->secret_unchanged);
   PARSE_NEXT (result->skipped_new_keys);
   PARSE_NEXT (result->not_imported);
+  if (args && *args)
+    {
+      PARSE_NEXT (result->skipped_v3_keys);
+    }
 
   return 0;
 }
 
   return 0;
 }
index f6dec68..ef5766a 100644 (file)
@@ -196,7 +196,8 @@ print_import_result (gpgme_import_result_t r)
           "   secret imported: %d\n"
           "  secret unchanged: %d\n"
           "  skipped new keys: %d\n"
           "   secret imported: %d\n"
           "  secret unchanged: %d\n"
           "  skipped new keys: %d\n"
-          "      not imported: %d\n",
+          "      not imported: %d\n"
+          "   skipped v3 keys: %d\n",
           r->considered,
           r->no_user_id,
           r->imported,
           r->considered,
           r->no_user_id,
           r->imported,
@@ -210,6 +211,7 @@ print_import_result (gpgme_import_result_t r)
           r->secret_imported,
           r->secret_unchanged,
           r->skipped_new_keys,
           r->secret_imported,
           r->secret_unchanged,
           r->skipped_new_keys,
-          r->not_imported);
+          r->not_imported,
+          r->skipped_v3_keys);
 }
 
 }
 
index 6a2170b..6c713a9 100644 (file)
@@ -177,7 +177,8 @@ print_import_result (gpgme_import_result_t r)
           "   secret imported: %d\n"
           "  secret unchanged: %d\n"
           "  skipped new keys: %d\n"
           "   secret imported: %d\n"
           "  secret unchanged: %d\n"
           "  skipped new keys: %d\n"
-          "      not imported: %d\n",
+          "      not imported: %d\n"
+          "   skipped v3 keys: %d\n",
           r->considered,
           r->no_user_id,
           r->imported,
           r->considered,
           r->no_user_id,
           r->imported,
@@ -191,6 +192,7 @@ print_import_result (gpgme_import_result_t r)
           r->secret_imported,
           r->secret_unchanged,
           r->skipped_new_keys,
           r->secret_imported,
           r->secret_unchanged,
           r->skipped_new_keys,
-          r->not_imported);
+          r->not_imported,
+          r->skipped_v3_keys);
 }
 
 }