From 75f035e9d0d6c2c73b288d7095a3c9ca2a95feb2 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 6 Nov 2009 00:44:44 +0000 Subject: [PATCH] 2009-11-06 Marcus Brinkmann * gpgme-tool.c (struct gpgme_tool): New members write_data and write_data_hook. (gt_write_data): New function. (gt_result): Output vfs_mount result. (server_write_data): New function. (gpgme_server): Initialize write_data members. --- src/ChangeLog | 9 +++++++++ src/gpgme-tool.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index c4793b1..943e7d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2009-11-06 Marcus Brinkmann + + * gpgme-tool.c (struct gpgme_tool): New members write_data and + write_data_hook. + (gt_write_data): New function. + (gt_result): Output vfs_mount result. + (server_write_data): New function. + (gpgme_server): Initialize write_data members. + 2009-11-05 Marcus Brinkmann * engine-g13.c (struct engine_g13): Remove members RESULT_CB and diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 54d793c..d274530 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -35,6 +35,8 @@ #include #endif +#include + #include "gpgme.h" @@ -509,6 +511,8 @@ struct gpgme_tool gpg_error_t (*write_status) (void *hook, const char *status, const char *msg); void *write_status_hook; + gpg_error_t (*write_data) (void *hook, const void *buf, size_t len); + void *write_data_hook; }; typedef struct gpgme_tool *gpgme_tool_t; @@ -738,6 +742,13 @@ gt_write_status (gpgme_tool_t gt, status_t status, ...) } +gpg_error_t +gt_write_data (gpgme_tool_t gt, void *buf, size_t len) +{ + return gt->write_data (gt->write_data_hook, buf, len); +} + + gpg_error_t gt_get_engine_info (gpgme_tool_t gt, gpgme_protocol_t proto) { @@ -1085,6 +1096,18 @@ gt_result (gpgme_tool_t gt, unsigned int flags) } } } + if (flags & GT_RESULT_VFS_MOUNT) + { + gpgme_vfs_mount_result_t res = gpgme_op_vfs_mount_result (gt->ctx); + if (res) + { + gt_write_data (gt, "vfs_mount\n", 10); + gt_write_data (gt, "mount_dir:", 10); + gt_write_data (gt, res->mount_dir, strlen (res->mount_dir)); + gt_write_data (gt, "\n", 1); + } + } + return 0; } @@ -1113,6 +1136,14 @@ server_write_status (void *hook, const char *status, const char *msg) } +gpg_error_t +server_write_data (void *hook, const void *buf, size_t len) +{ + struct server *server = hook; + return assuan_send_data (server->assuan_ctx, buf, len); +} + + static gpgme_data_encoding_t server_data_encoding (const char *line) { @@ -1999,6 +2030,8 @@ gpgme_server (gpgme_tool_t gt) server.gt = gt; gt->write_status = server_write_status; gt->write_status_hook = &server; + gt->write_data = server_write_data; + gt->write_data_hook = &server; /* We use a pipe based server so that we can work from scripts. assuan_init_pipe_server will automagically detect when we are -- 2.26.2