From e88c7782bf6917dd01bd55a1ff4275644cae823b Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 10 Nov 2009 14:54:39 +0000 Subject: [PATCH] 2009-11-10 Marcus Brinkmann * gpgme.c (gpgme_new): Set default sub protocol. * gpgme-tool.c: Implement get sub protocol. --- src/ChangeLog | 3 +++ src/gpgme-tool.c | 20 ++++++++++++++++---- src/gpgme.c | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 91ea9da..2443c2f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2009-11-10 Marcus Brinkmann + * gpgme.c (gpgme_new): Set default sub protocol. + * gpgme-tool.c: Implement get sub protocol. + * gpgme.h.in (gpgme_get_sub_protocol): Add prototype. * gpgme.def, libgpgme.vers: Add gpgme_get_sub_protocol. * context.h (struct gpgme_context): New member sub_protocol. diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 0283ffd..ccb2ae4 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -798,6 +798,18 @@ gt_set_protocol (gpgme_tool_t gt, gpgme_protocol_t proto) } +gpg_error_t +gt_get_protocol (gpgme_tool_t gt) +{ + gpgme_protocol_t proto = gpgme_get_protocol (gt->ctx); + + gt_write_status (gt, STATUS_PROTOCOL, gpgme_get_protocol_name (proto), + NULL); + + return 0; +} + + gpg_error_t gt_set_sub_protocol (gpgme_tool_t gt, gpgme_protocol_t proto) { @@ -806,9 +818,9 @@ gt_set_sub_protocol (gpgme_tool_t gt, gpgme_protocol_t proto) gpg_error_t -gt_get_protocol (gpgme_tool_t gt) +gt_get_sub_protocol (gpgme_tool_t gt) { - gpgme_protocol_t proto = gpgme_get_protocol (gt->ctx); + gpgme_protocol_t proto = gpgme_get_sub_protocol (gt->ctx); gt_write_status (gt, STATUS_PROTOCOL, gpgme_get_protocol_name (proto), NULL); @@ -1268,8 +1280,8 @@ cmd_sub_protocol (assuan_context_t ctx, char *line) struct server *server = assuan_get_pointer (ctx); if (line && *line) return gt_set_sub_protocol (server->gt, gt_protocol_from_name (line)); - /* FIXME. */ - return 0; + else + return gt_get_sub_protocol (server->gt); } diff --git a/src/gpgme.c b/src/gpgme.c index 7c52385..2d709e4 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -77,6 +77,7 @@ gpgme_new (gpgme_ctx_t *r_ctx) ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL; ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT; ctx->protocol = GPGME_PROTOCOL_OpenPGP; + ctx->sub_protocol = GPGME_PROTOCOL_DEFAULT; _gpgme_fd_table_init (&ctx->fdt); LOCK (def_lc_lock); -- 2.26.2