diff options
author | Jameson Graef Rollins <jrollins@finestructure.net> | 2012-05-26 11:45:46 -0700 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-06-10 20:09:42 -0300 |
commit | e04b18cf3624e1ba29a45cd1f15715e1da244021 (patch) | |
tree | dc47a8a961c58a90191352ca6db7c881d7ff2429 /notmuch-show.c | |
parent | b2c8fdee53a1b06dd19fafe23e53ac8555d294af (diff) |
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.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r-- | notmuch-show.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/notmuch-show.c b/notmuch-show.c index 3c067924..8247f1d5 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1056,29 +1056,6 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) break; } - if (params.crypto.decrypt || params.crypto.verify) { -#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 { - /* If we fail to create the gpgctx set the verify and - * decrypt flags to FALSE so we don't try to do any - * further verification or decryption */ - params.crypto.verify = FALSE; - 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; |