aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-reply.c
diff options
context:
space:
mode:
authorGravatar Thomas Jost <schnouki@schnouki.net>2012-01-20 10:39:24 +0100
committerGravatar David Bremner <bremner@debian.org>2012-01-21 08:52:34 -0400
commit00b5623d1a21d886b564d031e30749e5d02e4ae6 (patch)
tree68e97bcdc3bb57fb450f1dae112a629f821f88ca /notmuch-reply.c
parentd3aa6848da4519f6229426b1d0432afacf748f8b (diff)
Add compatibility with gmime 2.6
There are lots of API changes in gmime 2.6 crypto handling. By adding preprocessor directives, it is however possible to add gmime 2.6 compatibility while preserving compatibility with gmime 2.4 too. This is mostly based on id:"8762i8hrb9.fsf@bookbinder.fernseed.info". This was tested against both gmime 2.6.4 and 2.4.31. With gmime 2.4.31, the crypto tests all work fine (as expected). With gmime 2.6.4, one crypto test is currently broken (signature verification with signer key unavailable), most likely because of a bug in gmime which will hopefully be fixed in a future version.
Diffstat (limited to 'notmuch-reply.c')
-rw-r--r--notmuch-reply.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 0f682db4..bf679601 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -688,15 +688,22 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
reply_format_func = notmuch_reply_format_default;
if (decrypt) {
+#ifdef GMIME_ATLEAST_26
+ /* TODO: GMimePasswordRequestFunc */
+ params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");
+#else
GMimeSession* session = g_object_new (g_mime_session_get_type(), NULL);
params.cryptoctx = g_mime_gpg_context_new (session, "gpg");
+#endif
if (params.cryptoctx) {
g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);
params.decrypt = TRUE;
} else {
fprintf (stderr, "Failed to construct gpg context.\n");
}
+#ifndef GMIME_ATLEAST_26
g_object_unref (session);
+#endif
}
config = notmuch_config_open (ctx, NULL, NULL);