diff options
| author | Marcus Brinkmann <[email protected]> | 2003-10-02 15:03:02 +0000 | 
|---|---|---|
| committer | Marcus Brinkmann <[email protected]> | 2003-10-02 15:03:02 +0000 | 
| commit | 91f217b4b2f769c9d231e7c6ad7c214b3d9e688c (patch) | |
| tree | 9395e9c4a3e082ab8d13f4da23180b9c7aea4eff | |
| parent | 2003-09-30 Marcus Brinkmann <[email protected]> (diff) | |
| download | gpgme-91f217b4b2f769c9d231e7c6ad7c214b3d9e688c.tar.gz gpgme-91f217b4b2f769c9d231e7c6ad7c214b3d9e688c.zip | |
2003-10-02  Marcus Brinkmann  <[email protected]>
	* engine-backend.h (struct engine_ops): Add argument TYPE.
	* engine.c (_gpgme_engine_op_edit): Likewise.
	* engine.h: Likewise.
	* rungpg.c (gpg_edit): Likewise.  Use it.
	* edit.c (edit_start): Likewise.  Pass it on.
	(gpgme_op_edit_start, gpgme_op_edit): Likewise.
	(gpgme_op_card_edit_start, gpgme_op_card_edit): New functions.
Diffstat (limited to '')
| -rw-r--r-- | gpgme/ChangeLog | 11 | ||||
| -rw-r--r-- | gpgme/edit.c | 30 | ||||
| -rw-r--r-- | gpgme/engine-backend.h | 4 | ||||
| -rw-r--r-- | gpgme/engine.c | 6 | ||||
| -rw-r--r-- | gpgme/engine.h | 4 | ||||
| -rw-r--r-- | gpgme/gpgme.h | 9 | ||||
| -rw-r--r-- | gpgme/rungpg.c | 4 | 
7 files changed, 55 insertions, 13 deletions
| diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 93e2e3c2..b77492f3 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,14 @@ +2003-10-02  Marcus Brinkmann  <[email protected]> + +	* engine-backend.h (struct engine_ops): Add argument TYPE. +	* engine.c (_gpgme_engine_op_edit): Likewise. +	* engine.h: Likewise. +	* rungpg.c (gpg_edit): Likewise.  Use it. +	* edit.c (edit_start): Likewise.  Pass it on. +	(gpgme_op_edit_start, gpgme_op_edit): Likewise. +	(gpgme_op_card_edit_start, gpgme_op_card_edit): New functions. + +  2003-09-30  Marcus Brinkmann  <[email protected]>  	* gpgme.h (gpg_strerror_r): Change prototype to match diff --git a/gpgme/edit.c b/gpgme/edit.c index 5ea68b81..8c538f3a 100644 --- a/gpgme/edit.c +++ b/gpgme/edit.c @@ -93,7 +93,7 @@ command_handler (void *priv, gpgme_status_code_t status, const char *args,  static gpgme_error_t -edit_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, +edit_start (gpgme_ctx_t ctx, int synchronous, int type, gpgme_key_t key,  	    gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)  {    gpgme_error_t err; @@ -122,7 +122,7 @@ edit_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key,    _gpgme_engine_set_status_handler (ctx->engine, edit_status_handler, ctx); -  return _gpgme_engine_op_edit (ctx->engine, key, out, ctx); +  return _gpgme_engine_op_edit (ctx->engine, type, key, out, ctx);  } @@ -130,7 +130,7 @@ gpgme_error_t  gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,  		     gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)  { -  return edit_start (ctx, 0, key, fnc, fnc_value, out); +  return edit_start (ctx, 0, 0, key, fnc, fnc_value, out);  } @@ -140,7 +140,29 @@ gpgme_error_t  gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,  	       gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)  { -  gpgme_error_t err = edit_start (ctx, 1, key, fnc, fnc_value, out); +  gpgme_error_t err = edit_start (ctx, 1, 0, key, fnc, fnc_value, out); +  if (!err) +    err = _gpgme_wait_one (ctx); +  return err; +} + + +gpgme_error_t +gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, +			  gpgme_edit_cb_t fnc, void *fnc_value, +			  gpgme_data_t out) +{ +  return edit_start (ctx, 0, 1, key, fnc, fnc_value, out); +} + + +/* Edit the card for the key KEY.  Send status and command requests to +   FNC and output of edit commands to OUT.  */ +gpgme_error_t +gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, +		    gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out) +{ +  gpgme_error_t err = edit_start (ctx, 1, 1, key, fnc, fnc_value, out);    if (!err)      err = _gpgme_wait_one (ctx);    return err; diff --git a/gpgme/engine-backend.h b/gpgme/engine-backend.h index 0a59972d..0632fb66 100644 --- a/gpgme/engine-backend.h +++ b/gpgme/engine-backend.h @@ -49,8 +49,8 @@ struct engine_ops    gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,  			    gpgme_data_t plain);    gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret); -  gpgme_error_t (*edit) (void *engine, gpgme_key_t key, gpgme_data_t out, -			 gpgme_ctx_t ctx /* FIXME */); +  gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key, +			 gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);    gpgme_error_t (*encrypt) (void *engine, gpgme_key_t recp[],  			    gpgme_encrypt_flags_t flags,  			    gpgme_data_t plain, gpgme_data_t ciph, diff --git a/gpgme/engine.c b/gpgme/engine.c index 04cefc8c..4c525990 100644 --- a/gpgme/engine.c +++ b/gpgme/engine.c @@ -284,8 +284,8 @@ _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,  gpgme_error_t -_gpgme_engine_op_edit (engine_t engine, gpgme_key_t key, gpgme_data_t out, -		       gpgme_ctx_t ctx /* FIXME */) +_gpgme_engine_op_edit (engine_t engine, int type, gpgme_key_t key, +		       gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */)  {    if (!engine)      return gpg_error (GPG_ERR_INV_VALUE); @@ -293,7 +293,7 @@ _gpgme_engine_op_edit (engine_t engine, gpgme_key_t key, gpgme_data_t out,    if (!engine->ops->edit)      return gpg_error (GPG_ERR_NOT_IMPLEMENTED); -  return (*engine->ops->edit) (engine->engine, key, out, ctx); +  return (*engine->ops->edit) (engine->engine, type, key, out, ctx);  } diff --git a/gpgme/engine.h b/gpgme/engine.h index 563b35b0..d3a54036 100644 --- a/gpgme/engine.h +++ b/gpgme/engine.h @@ -56,8 +56,8 @@ gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,  					gpgme_data_t plain);  gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,  				       int allow_secret); -gpgme_error_t _gpgme_engine_op_edit (engine_t engine, gpgme_key_t key, -				     gpgme_data_t out, +gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type, +				     gpgme_key_t key, gpgme_data_t out,  				     gpgme_ctx_t ctx /* FIXME */);  gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,  					gpgme_key_t recp[], diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 921d57e5..bed03145 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -1349,6 +1349,15 @@ gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,  			     gpgme_edit_cb_t fnc, void *fnc_value,  			     gpgme_data_t out); +/* Edit the card for the key KEY.  Send status and command requests to +   FNC and output of edit commands to OUT.  */ +gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, +					gpgme_edit_cb_t fnc, void *fnc_value, +					gpgme_data_t out); +gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, +				  gpgme_edit_cb_t fnc, void *fnc_value, +				  gpgme_data_t out); +  /* Key management functions.  */  struct _gpgme_op_keylist_result diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index d13a9c1c..ba3e52ce 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -1224,7 +1224,7 @@ append_args_from_signers (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */)  static gpgme_error_t -gpg_edit (void *engine, gpgme_key_t key, gpgme_data_t out, +gpg_edit (void *engine, int type, gpgme_key_t key, gpgme_data_t out,  	  gpgme_ctx_t ctx /* FIXME */)  {    engine_gpg_t gpg = engine; @@ -1234,7 +1234,7 @@ gpg_edit (void *engine, gpgme_key_t key, gpgme_data_t out,    if (!err)      err = append_args_from_signers (gpg, ctx);    if (!err) -  err = add_arg (gpg, "--edit-key"); +  err = add_arg (gpg, type == 0 ? "--edit-key" : "--card-edit");    if (!err)      err = add_data (gpg, out, 1, 1);    if (!err) | 
