[PATCH 1/5] lib: rename (and negate) set_omit_excluded set_with_excluded

Mark Walters markwalters1009 at gmail.com
Sat Mar 3 05:05:14 PST 2012


Rename the function notmuch_query_set_omit_excluded_messages to
notmuch_query_set_with_excluded_messages and negate its meaning.  Note
the suite will not compile currently as the callers of
notmuch_query_set_omit_excluded_messages have not been updated yet.
---
 lib/notmuch.h |   12 +++++++-----
 lib/query.cc  |   10 +++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index babd208..53ec82e 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -449,12 +449,14 @@ typedef enum {
 const char *
 notmuch_query_get_query_string (notmuch_query_t *query);
 
-/* Specify whether to results should omit the excluded results rather
- * than just marking them excluded. This is useful for passing a
- * notmuch_messages_t not containing the excluded messages to other
- * functions. */
+/* Specify whether to results should include the excluded results
+ * (marking them excluded) rather than just omitting them. Note when
+ * calling notmuch_query_search_threads, the returned thread will
+ * contain all messages regardless of this setting but, unless this is
+ * set, only threads matching in a non-excluded message will be
+ * returned. */
 void
-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit);
+notmuch_query_set_with_excluded_messages (notmuch_query_t *query, notmuch_bool_t with_excluded);
 
 /* Specify the sorting desired for this query. */
 void
diff --git a/lib/query.cc b/lib/query.cc
index ab18fbc..cf8dfd0 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -28,7 +28,7 @@ struct _notmuch_query {
     const char *query_string;
     notmuch_sort_t sort;
     notmuch_string_list_t *exclude_terms;
-    notmuch_bool_t omit_excluded_messages;
+    notmuch_bool_t with_excluded;
 };
 
 typedef struct _notmuch_mset_messages {
@@ -86,7 +86,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
 
     query->exclude_terms = _notmuch_string_list_create (query);
 
-    query->omit_excluded_messages = FALSE;
+    query->with_excluded = FALSE;
 
     return query;
 }
@@ -98,9 +98,9 @@ notmuch_query_get_query_string (notmuch_query_t *query)
 }
 
 void
-notmuch_query_set_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit)
+notmuch_query_set_with_excluded_messages (notmuch_query_t *query, notmuch_bool_t with_excluded)
 {
-    query->omit_excluded_messages = omit;
+    query->with_excluded = with_excluded;
 }
 
 void
@@ -216,7 +216,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
 	    exclude_query = Xapian::Query (Xapian::Query::OP_AND,
 					   exclude_query, final_query);
 
-	    if (query->omit_excluded_messages)
+	    if (!query->with_excluded)
 		final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
 					     final_query, exclude_query);
 	    else {
-- 
1.7.2.3



More information about the notmuch mailing list