+2002-08-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.texi (Importing Keys): Document gpgme_op_import_ext.
+
2002-08-14 Werner Koch <wk@gnupg.org>
* gpgme.texi (Information About Keys): Changed GPGME_ATTR_TYPE.
@code{GPGME_No_Data} if @var{keydata} is an empty data buffer.
@end deftypefun
+@deftypefun GpgmeError gpgme_op_import_ext (@w{GpgmeCtx @var{ctx}}, @w{GpgmeData @var{keydata}}, @w{int *@var{nr}})
+The function @code{gpgme_op_import_ext} is like
+@code{gpgme_op_import}, but also returns the number of processed keys
+in @var{nr}. This is the same as the @code{count} information in the
+detailed results available with @code{gpgme_get_op_info}.
+@end deftypefun
+
@node Deleting Keys
@subsection Deleting Keys
+2002-08-20 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.h: Add prototype for gpgme_op_import_ext.
+ * import.c (struct import_result_s): New member `nr_considered'.
+ Rename `any_imported' to `nr_imported'.
+ (import_status_handler): Increment nr_imported. Set nr_considered
+ if appropriate.
+ (gpgme_op_import_ext): New function.
+ (gpgme_op_import): Implement in terms of gpgme_op_import_ext.
+
2002-08-20 Werner Koch <wk@gnupg.org>
* vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s.
/* Import the key in KEYDATA into the keyring. */
GpgmeError gpgme_op_import_start (GpgmeCtx ctx, GpgmeData keydata);
GpgmeError gpgme_op_import (GpgmeCtx ctx, GpgmeData keydata);
+GpgmeError gpgme_op_import_ext (GpgmeCtx ctx, GpgmeData keydata, int *nr);
/* Export the keys listed in RECP into KEYDATA. */
GpgmeError gpgme_op_export_start (GpgmeCtx ctx, GpgmeRecipients recp,
struct import_result_s
{
- int any_imported;
+ int nr_imported;
+ int nr_considered;
GpgmeData xmlinfo;
};
break;
case GPGME_STATUS_IMPORTED:
- ctx->result.import->any_imported = 1;
+ ctx->result.import->nr_imported++;
+ append_xml_impinfo (&ctx->result.import->xmlinfo, code, args);
+ break;
+
case GPGME_STATUS_IMPORT_RES:
+ ctx->result.import->nr_considered = strtol (args, 0, 0);
append_xml_impinfo (&ctx->result.import->xmlinfo, code, args);
break;
* gpgme_op_import:
* @c: Context
* @keydata: Data object
+ * @nr: Will contain number of considered keys.
*
* Import all key material from @keydata into the key database.
*
* Return value: 0 on success or an error code.
**/
GpgmeError
-gpgme_op_import (GpgmeCtx ctx, GpgmeData keydata)
+gpgme_op_import_ext (GpgmeCtx ctx, GpgmeData keydata, int *nr)
{
GpgmeError err = _gpgme_op_import_start (ctx, 1, keydata);
if (!err)
err = _gpgme_wait_one (ctx);
- if (!err && (!ctx->result.import || !ctx->result.import->any_imported))
- err = -1; /* Nothing at all imported. */
+ if (!err && nr)
+ {
+ if (ctx->result.import)
+ *nr = ctx->result.import->nr_considered;
+ else
+ *nr = 0;
+ }
return err;
}
+GpgmeError
+gpgme_op_import (GpgmeCtx ctx, GpgmeData keydata)
+{
+ return gpgme_op_import_ext (ctx, keydata, 0);
+}
+