In notmuch 0.13 the library's API has changed, so we explicitly test
for that with autoconf.
---
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index b6464da..3142ad5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,18 @@ AC_ARG_ENABLE(notmuch, AC_HELP_STRING([--enable-notmuch], [Enable
NOTMUCH suppor
NOTMUCH_LIBS="-lnotmuch"
OPS="$OPS \$(srcdir)/OPS.NOTMUCH"
need_notmuch="yes"
+
+ AC_MSG_CHECKING([for notmuch api version 3])
+ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM(
+ [[#include <notmuch.h>]],
+ [[notmuch_database_open("/path", NOTMUCH_DATABASE_MODE_READ_ONLY,
(notmuch_database_t**)NULL);]]
+ )],
+ [notmuch_api_3=yes
+ AC_DEFINE([NOTMUCH_API_3], 1, [Define to 1 if you have the notmuch api version 3.])
+ ],
+ [notmuch_api_3=no]
+ )
+ AC_MSG_RESULT([$notmuch_api_3])
fi
])
AM_CONDITIONAL(BUILD_NOTMUCH, test x$need_notmuch = xyes)
--
1.7.10
Show replies by date
As of notmuch 0.13 libnotmuch's api has changed. This makes use of it if the
new api was detected.
---
mutt_notmuch.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/mutt_notmuch.c b/mutt_notmuch.c
index bfd6247..22222e1 100644
--- a/mutt_notmuch.c
+++ b/mutt_notmuch.c
@@ -187,7 +187,11 @@ static void free_ctxdata(struct nm_ctxdata *data)
dprint(1, (debugfile, "nm: freeing context data %p\n", data));
if (data->db)
+#ifdef NOTMUCH_API_3
+ notmuch_database_destroy(data->db);
+#else
notmuch_database_close(data->db);
+#endif
data->db = NULL;
FREE(&data->db_filename);
@@ -368,13 +372,20 @@ static notmuch_database_t *do_database_open(const char *filename,
{
notmuch_database_t *db = NULL;
unsigned int ct = 0;
+ int status = 0;
dprint(1, (debugfile, "nm: db open '%s' %s (timeout %d)\n", filename,
writable ? "[WRITE]" : "[READ]", NotmuchOpenTimeout));
do {
+#ifdef NOTMUCH_API_3
+ status = notmuch_database_open(filename,
+ writable ? NOTMUCH_DATABASE_MODE_READ_WRITE :
+ NOTMUCH_DATABASE_MODE_READ_ONLY, &db);
+#else
db = notmuch_database_open(filename,
writable ? NOTMUCH_DATABASE_MODE_READ_WRITE :
NOTMUCH_DATABASE_MODE_READ_ONLY);
+#endif
if (db || !NotmuchOpenTimeout || ct / 2 > NotmuchOpenTimeout)
break;
@@ -410,7 +421,11 @@ static int release_db(struct nm_ctxdata *data)
{
if (data && data->db) {
dprint(1, (debugfile, "nm: db close\n"));
+#ifdef NOTMUCH_API_3
+ notmuch_database_destroy(data->db);
+#else
notmuch_database_close(data->db);
+#endif
data->db = NULL;
data->longrun = FALSE;
return 0;
--
1.7.10
On Tue, Jun 26, 2012 at 08:48:48PM +0200, David Riebenbauer wrote:
mutt_notmuch.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Applied, thanks.
--
Karel Zak <kzak(a)redhat.com>
http://karelzak.blogspot.com
On Tue, Jun 26, 2012 at 08:48:47PM +0200, David Riebenbauer wrote:
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
Applied, thanks.
--
Karel Zak <kzak(a)redhat.com>
http://karelzak.blogspot.com