[PATCH v2 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t
Mark Walters
markwalters1009 at gmail.com
Sat May 11 12:50:08 PDT 2013
From: Peter Wang <novalazy at gmail.com>
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 27b43ff..35795bb 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 1cc768f..e61d11e 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 4323201..a20791a 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -411,7 +411,7 @@ notmuch_search_command (notmuch_config_t *config, 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.9.1
More information about the notmuch
mailing list