* 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-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
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;
_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);
}
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);
}
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;
+}
+
+\f
+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;
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,
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);
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);
}
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[],
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);
+
\f
/* Key management functions. */
struct _gpgme_op_keylist_result
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;
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)