--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 3A2E1431FB6\r
+ for <notmuch@notmuchmail.org>; Wed, 27 Feb 2013 00:45:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Yw73fe-1ICYf for <notmuch@notmuchmail.org>;\r
+ Wed, 27 Feb 2013 00:45:41 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id C40EE431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 27 Feb 2013 00:45:41 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 15572100044;\r
+ Wed, 27 Feb 2013 10:45:29 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] cli: crypto: tell gmime to use gpg-agent\r
+In-Reply-To: <1361950838-22919-1-git-send-email-jani@nikula.org>\r
+References: <1361950838-22919-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.15.2+45~g5d28a00 (http://notmuchmail.org) Emacs/24.2.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Wed, 27 Feb 2013 10:45:28 +0200\r
+Message-ID: <m2obf6no0n.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 27 Feb 2013 08:45:43 -0000\r
+\r
+On Wed, Feb 27 2013, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> For decryption, we expect there to be a functioning gpg-agent, and we\r
+> want gpg to talk to it for any needed credentials. There's a gmime\r
+> function to declare that: g_mime_gpg_context_set_use_agent() [1], [2].\r
+> Start using it.\r
+>\r
+> I had gpg-agent running, but gpg "use-agent" configuration option\r
+> disabled. This resulted in an error message from 'notmuch show':\r
+>\r
+> Failed to decrypt part: Canceled.\r
+>\r
+> and json had this:\r
+>\r
+> "encstatus" : [ { "status" : "bad" } ]\r
+>\r
+> One could argue the "use-agent" option should be enabled, but I'd like\r
+> to use the agent only as a last resort. I think that's irrelevant\r
+> though. There's a gmime function to declare what we expect, so we\r
+> should use it. Conveniently it also fixes the problem in a user\r
+> friendly way.\r
+\r
+I agree fully. The code looks good to me.\r
+\r
+Tomi\r
+\r
+>\r
+> [1] http://git.gnome.org/browse/gmime/commit/?id=ed985397843a9da3745a8b5de3d1d652acd24724\r
+> [2] https://bugzilla.gnome.org/show_bug.cgi?id=651826\r
+> ---\r
+> crypto.c | 3 +++\r
+> 1 file changed, 3 insertions(+)\r
+>\r
+> diff --git a/crypto.c b/crypto.c\r
+> index fbe5aeb..cb361e1 100644\r
+> --- a/crypto.c\r
+> +++ b/crypto.c\r
+> @@ -45,6 +45,9 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)\r
+> g_object_unref (session);\r
+> #endif\r
+> if (crypto->gpgctx) {\r
+> +#ifdef GMIME_ATLEAST_26\r
+> + g_mime_gpg_context_set_use_agent ((GMimeGpgContext*) crypto->gpgctx, TRUE);\r
+> +#endif\r
+> g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) crypto->gpgctx, FALSE);\r
+> } else {\r
+> fprintf (stderr, "Failed to construct gpg context.\n");\r
+> -- \r
+> 1.7.10.4\r