From: Richard Russon Date: Mon, 11 Sep 2017 14:08:16 +0000 (+0100) Subject: notmuch: add support for the v5 API X-Git-Tag: neomutt-20170912~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8dcb09bbcb929a8f7e9df585b82e565c0f24643;p=neomutt notmuch: add support for the v5 API Issue: #746 --- diff --git a/mutt_notmuch.c b/mutt_notmuch.c index 0e3ee7028..65c74eb48 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -1126,7 +1126,10 @@ static void progress_update(struct Context *ctx, notmuch_query_t *q) static char msg[STRING]; snprintf(msg, sizeof(msg), _("Reading messages...")); -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_count_messages(q, &count) != NOTMUCH_STATUS_SUCCESS) + count = 0; /* may not be defined on error */ +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_count_messages_st(q, &count) != NOTMUCH_STATUS_SUCCESS) count = 0; /* may not be defined on error */ #else @@ -1313,7 +1316,10 @@ static bool read_mesgs_query(struct Context *ctx, notmuch_query_t *q, int dedup) limit = get_limit(data); -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_search_messages(q, &msgs) != NOTMUCH_STATUS_SUCCESS) + return false; +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_search_messages_st(q, &msgs) != NOTMUCH_STATUS_SUCCESS) return false; #else @@ -1343,7 +1349,10 @@ static bool read_threads_query(struct Context *ctx, notmuch_query_t *q, int dedu if (!data) return false; -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_search_threads(q, &threads) != NOTMUCH_STATUS_SUCCESS) + return false; +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_search_threads_st(q, &threads) != NOTMUCH_STATUS_SUCCESS) return false; #else @@ -1704,7 +1713,10 @@ static unsigned count_query(notmuch_database_t *db, const char *qstr) if (q) { apply_exclude_tags(q); -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_count_messages(q, &res) != NOTMUCH_STATUS_SUCCESS) + res = 0; /* may not be defined on error */ +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_count_messages_st(q, &res) != NOTMUCH_STATUS_SUCCESS) res = 0; /* may not be defined on error */ #else @@ -2017,7 +2029,10 @@ bool nm_message_is_still_queried(struct Context *ctx, struct Header *hdr) case NM_QUERY_TYPE_MESGS: { notmuch_messages_t *messages = NULL; -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_search_messages(q, &messages) != NOTMUCH_STATUS_SUCCESS) + return false; +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_search_messages_st(q, &messages) != NOTMUCH_STATUS_SUCCESS) return false; #else @@ -2030,7 +2045,10 @@ bool nm_message_is_still_queried(struct Context *ctx, struct Header *hdr) case NM_QUERY_TYPE_THREADS: { notmuch_threads_t *threads = NULL; -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_search_threads(q, &threads) != NOTMUCH_STATUS_SUCCESS) + return false; +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_search_threads_st(q, &threads) != NOTMUCH_STATUS_SUCCESS) return false; #else @@ -2402,7 +2420,10 @@ static int nm_check_mailbox(struct Context *ctx, int *index_hint) limit = get_limit(data); -#if LIBNOTMUCH_CHECK_VERSION(4, 3, 0) +#if LIBNOTMUCH_CHECK_VERSION(5, 0, 0) + if (notmuch_query_search_messages(q, &msgs) != NOTMUCH_STATUS_SUCCESS) + return false; +#elif LIBNOTMUCH_CHECK_VERSION(4, 3, 0) if (notmuch_query_search_messages_st(q, &msgs) != NOTMUCH_STATUS_SUCCESS) goto done; #else