From b9c8017728f58079251915b113ba26550a2f5ae4 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 18 Dec 2001 22:54:49 +0000 Subject: [PATCH] 2001-12-18 Marcus Brinkmann * keylist.c (gpgme_op_keylist_end): New function. * gpgme.h (gpgme_op_keylist_end): New prototype. * engine.h (gpgme_engine_check_version): Move prototype to ... * gpgme.h (gpgme_engine_check_version): ... here. * genkey.c (gpgme_op_genkey_start): Remove unused variable. --- trunk/NEWS | 5 +++++ trunk/gpgme/ChangeLog | 10 ++++++++++ trunk/gpgme/engine.h | 1 - trunk/gpgme/genkey.c | 1 - trunk/gpgme/gpgme.h | 16 +++++++++------- trunk/gpgme/keylist.c | 23 ++++++++++++++++++++++- 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/trunk/NEWS b/trunk/NEWS index 5f5b02f..f59de90 100644 --- a/trunk/NEWS +++ b/trunk/NEWS @@ -20,6 +20,10 @@ * New operation gpgme_op_decrypt_verify() to decrypt and verify signatures simultaneously. + * The new interface gpgme_op_keylist_end() terminates a pending + keylist operation. A keylist operation is also terminated when + gpgme_op_keylist_next() returns GPGME_EOF. + * GPGME can be compiled without GnuPG being installed (`--with-gpg=PATH'), cross-compiled, or even compiled without support for GnuPG (`--without-gpg'). @@ -43,6 +47,7 @@ gpgme_get_engine_info CHANGED: New format, extended content. gpgme_engine_check_version NEW gpgme_decrypt_verify_start NEW gpgme_decrypt_verify NEW +gpgme_op_keylist_next NEW gpgme_set_protocol NEW ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 8bccdb9..38846b0 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,13 @@ +2001-12-18 Marcus Brinkmann + + * keylist.c (gpgme_op_keylist_end): New function. + * gpgme.h (gpgme_op_keylist_end): New prototype. + + * engine.h (gpgme_engine_check_version): Move prototype to ... + * gpgme.h (gpgme_engine_check_version): ... here. + + * genkey.c (gpgme_op_genkey_start): Remove unused variable. + 2001-12-18 Marcus Brinkmann * version.c (gpgme_get_engine_info): Reimplemented. diff --git a/trunk/gpgme/engine.h b/trunk/gpgme/engine.h index e7b7cbc..c7a8342 100644 --- a/trunk/gpgme/engine.h +++ b/trunk/gpgme/engine.h @@ -27,7 +27,6 @@ const char *_gpgme_engine_get_path (GpgmeProtocol proto); const char *_gpgme_engine_get_version (GpgmeProtocol proto); -GpgmeError gpgme_engine_check_version (GpgmeProtocol proto); const char * _gpgme_engine_get_info (GpgmeProtocol proto); GpgmeError _gpgme_engine_new (GpgmeProtocol proto, EngineObject *r_engine); void _gpgme_engine_release (EngineObject engine); diff --git a/trunk/gpgme/genkey.c b/trunk/gpgme/genkey.c index 033369a..295cd7a 100644 --- a/trunk/gpgme/genkey.c +++ b/trunk/gpgme/genkey.c @@ -109,7 +109,6 @@ gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms, GpgmeData pubkey, GpgmeData seckey) { int err = 0; - int i; const char *s, *s2, *sx; fail_on_pending_request (ctx); diff --git a/trunk/gpgme/gpgme.h b/trunk/gpgme/gpgme.h index 7a0f657..971b1bd 100644 --- a/trunk/gpgme/gpgme.h +++ b/trunk/gpgme/gpgme.h @@ -165,7 +165,6 @@ typedef void (*GpgmeProgressCb)(void *opaque, const char *what, int type, int current, int total ); - /* Context management */ GpgmeError gpgme_new (GpgmeCtx *r_ctx); void gpgme_release (GpgmeCtx c); @@ -277,12 +276,13 @@ GpgmeError gpgme_op_delete_start ( GpgmeCtx c, const GpgmeKey key, /* Key management functions */ -GpgmeError gpgme_op_keylist_start ( GpgmeCtx c, - const char *pattern, int secret_only ); -GpgmeError gpgme_op_keylist_next ( GpgmeCtx c, GpgmeKey *r_key ); -GpgmeError gpgme_op_trustlist_start ( GpgmeCtx c, - const char *pattern, int max_level ); -GpgmeError gpgme_op_trustlist_next ( GpgmeCtx c, GpgmeTrustItem *r_item ); +GpgmeError gpgme_op_keylist_start (GpgmeCtx ctx, + const char *pattern, int secret_only); +GpgmeError gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key); +GpgmeError gpgme_op_keylist_end (GpgmeCtx ctx); +GpgmeError gpgme_op_trustlist_start (GpgmeCtx ctx, + const char *pattern, int max_level); +GpgmeError gpgme_op_trustlist_next (GpgmeCtx ctx, GpgmeTrustItem *r_item); @@ -313,6 +313,8 @@ const char *gpgme_get_engine_info (void); const char *gpgme_strerror (GpgmeError err); void gpgme_register_idle (void (*fnc)(void)); +/* Engine support functions. */ +GpgmeError gpgme_engine_check_version (GpgmeProtocol proto); #ifdef __cplusplus } diff --git a/trunk/gpgme/keylist.c b/trunk/gpgme/keylist.c index ca0cae0..65bded3 100644 --- a/trunk/gpgme/keylist.c +++ b/trunk/gpgme/keylist.c @@ -482,7 +482,7 @@ gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key) return mk_error (EOF); } ctx->key_cond = 0; - assert (ctx->key_queue); + assert (ctx->key_queue); } queue_item = ctx->key_queue; ctx->key_queue = queue_item->next; @@ -493,3 +493,24 @@ gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key) xfree (queue_item); return 0; } + +/** + * gpgme_op_keylist_end: + * @c: Context + * + * Ends the keylist operation and allows to use the context for some + * other operation next. + **/ +GpgmeError +gpgme_op_keylist_end (GpgmeCtx ctx) +{ + if (!ctx) + return mk_error (Invalid_Value); + if (!ctx->pending ) + return mk_error (No_Request); + if (ctx->out_of_core) + return mk_error (Out_Of_Core); + + ctx->pending = 0; + return 0; +} -- 2.26.2