diff --git a/NEWS b/NEWS index 5f5b02fe..f59de902 100644 --- a/NEWS +++ b/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/gpgme/ChangeLog b/gpgme/ChangeLog index 8bccdb9a..38846b0d 100644 --- a/gpgme/ChangeLog +++ b/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/gpgme/engine.h b/gpgme/engine.h index e7b7cbc5..c7a83425 100644 --- a/gpgme/engine.h +++ b/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/gpgme/genkey.c b/gpgme/genkey.c index 033369ae..295cd7a6 100644 --- a/gpgme/genkey.c +++ b/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/gpgme/gpgme.h b/gpgme/gpgme.h index 7a0f657d..971b1bdf 100644 --- a/gpgme/gpgme.h +++ b/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/gpgme/keylist.c b/gpgme/keylist.c index ca0cae09..65bded37 100644 --- a/gpgme/keylist.c +++ b/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; +}