2003-10-02 Marcus Brinkmann <marcus@g10code.de>

* 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.
This commit is contained in:
Marcus Brinkmann 2003-10-02 15:03:02 +00:00
parent 2f91a25865
commit 91f217b4b2
7 changed files with 55 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2003-10-02 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de>
* gpgme.h (gpg_strerror_r): Change prototype to match

View File

@ -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;

View File

@ -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,

View File

@ -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);
}

View File

@ -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[],

View File

@ -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

View File

@ -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)