From e04b18cf3624e1ba29a45cd1f15715e1da244021 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sat, 26 May 2012 11:45:46 -0700 Subject: cli: use new notmuch_crypto_get_context in mime-node.c This has the affect of lazily creating the crypto contexts only when needed. This removes code duplication from notmuch-show and notmuch-reply, and should speed up these functions considerably if the crypto flags are provided but the messages don't have any cryptographic parts. --- notmuch-reply.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'notmuch-reply.c') diff --git a/notmuch-reply.c b/notmuch-reply.c index 1ab3db94..3a038ed7 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -741,25 +741,6 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) else reply_format_func = notmuch_reply_format_default; - if (params.crypto.decrypt) { -#ifdef GMIME_ATLEAST_26 - /* TODO: GMimePasswordRequestFunc */ - params.crypto.gpgctx = g_mime_gpg_context_new (NULL, "gpg"); -#else - GMimeSession* session = g_object_new (g_mime_session_get_type(), NULL); - params.crypto.gpgctx = g_mime_gpg_context_new (session, "gpg"); -#endif - if (params.crypto.gpgctx) { - g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.crypto.gpgctx, FALSE); - } else { - params.crypto.decrypt = FALSE; - fprintf (stderr, "Failed to construct gpg context.\n"); - } -#ifndef GMIME_ATLEAST_26 - g_object_unref (session); -#endif - } - config = notmuch_config_open (ctx, NULL, NULL); if (config == NULL) return 1; -- cgit v1.2.3