[PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t
Peter Wang
novalazy at gmail.com
Wed Jun 20 06:29:06 PDT 2012
Add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t so that it can
cover all four values of search --exclude in the cli.
---
lib/notmuch.h | 1 +
lib/query.cc | 6 ++++--
notmuch-search.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 1280afd..f4381ae 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -504,6 +504,7 @@ notmuch_query_get_query_string (notmuch_query_t *query);
typedef enum {
NOTMUCH_EXCLUDE_FALSE,
NOTMUCH_EXCLUDE_TRUE,
+ NOTMUCH_EXCLUDE_FLAG,
NOTMUCH_EXCLUDE_ALL
} notmuch_exclude_t;
diff --git a/lib/query.cc b/lib/query.cc
index f752452..1e0f292 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -221,10 +221,12 @@ notmuch_query_search_messages (notmuch_query_t *query)
if (query->exclude_terms) {
exclude_query = _notmuch_exclude_tags (query, final_query);
- if (query->omit_excluded != NOTMUCH_EXCLUDE_FALSE)
+ if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
+ query->omit_excluded == NOTMUCH_EXCLUDE_ALL)
+ {
final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
final_query, exclude_query);
- else {
+ } else {
exclude_query = Xapian::Query (Xapian::Query::OP_AND,
exclude_query, final_query);
diff --git a/notmuch-search.c b/notmuch-search.c
index 89b5bf9..027923d 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -527,7 +527,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
for (i = 0; i < search_exclude_tags_length; i++)
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
if (exclude == EXCLUDE_FLAG)
- notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);
+ notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FLAG);
if (exclude == EXCLUDE_ALL)
notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
}
--
1.7.4.4
More information about the notmuch
mailing list