From a3f8a46da84de8dfc70dedd8bc6d3e5639177a6f Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 31 Mar 2012 23:53:57 +0100 Subject: [PATCH] [PATCH v2 1/6] lib: change default for notmuch_query_set_omit_excluded --- 89/7c1313d60518a219e48bf5f59f881fb9a27e75 | 137 ++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 89/7c1313d60518a219e48bf5f59f881fb9a27e75 diff --git a/89/7c1313d60518a219e48bf5f59f881fb9a27e75 b/89/7c1313d60518a219e48bf5f59f881fb9a27e75 new file mode 100644 index 000000000..d2f2b5ff1 --- /dev/null +++ b/89/7c1313d60518a219e48bf5f59f881fb9a27e75 @@ -0,0 +1,137 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 9DEFC431E82 + for ; Sat, 31 Mar 2012 15:54:12 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 4SoRV1WITlrX for ; + Sat, 31 Mar 2012 15:54:12 -0700 (PDT) +Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com + [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id CD3E0431FAE + for ; Sat, 31 Mar 2012 15:54:11 -0700 (PDT) +Received: by wibhn6 with SMTP id hn6so1346075wib.2 + for ; Sat, 31 Mar 2012 15:54:10 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=eo4x3qOniAZtifC3PD1Jdj4s5WHERevlsxTnlNI1qyY=; + b=KGJwrKHEG5kKzilRLXVqt8ADeqLNWMmqBhY09Cejpx1XvdvOBPksLnnaxsfL98+Uqu + kJAO1omtPRcLHmn/3IWz3FFhVhqhlY355pEGw/DTJX8rqGosoC05saDM+m1zgZ3O0GYo + t+ZKYVgGXTdFCSJIq8sAnqjRlMWIDOt/pp1jmedrXs1xqhiGPr7FuiiZHsg3e/7sSvlZ + q+kzfUqXdhrOloINPvlymNNkjy7y4j/XSC/iMT9Reps+Bj0VPvz28OPiHksgfbcuqceJ + PLpRjAQoaSa60xxyvQwD3P938YXzg5gmLAE5LdFvUubVGv4agKJIiApJWGIl5P5/Hw3f + Wdcg== +Received: by 10.180.97.4 with SMTP id dw4mr10377024wib.18.1333234450555; + Sat, 31 Mar 2012 15:54:10 -0700 (PDT) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + 17sm29017490wis.0.2012.03.31.15.54.09 (version=TLSv1/SSLv3 cipher=OTHER); + Sat, 31 Mar 2012 15:54:09 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2 1/6] lib: change default for + notmuch_query_set_omit_excluded +Date: Sat, 31 Mar 2012 23:53:57 +0100 +Message-Id: <1333234442-28616-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com> +References: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 31 Mar 2012 22:54:12 -0000 + +--- + lib/notmuch.h | 11 ++++++----- + lib/query.cc | 10 +++++----- + 2 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/lib/notmuch.h b/lib/notmuch.h +index babd208..029a2c3 100644 +--- a/lib/notmuch.h ++++ b/lib/notmuch.h +@@ -449,12 +449,13 @@ 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 omit the excluded results or just flag ++ * them. Note when calling notmuch_query_search_threads, the returned ++ * thread will contain all messages regardless of this setting but, ++ * unless this is unset, 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_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit_excluded); + + /* Specify the sorting desired for this query. */ + void +diff --git a/lib/query.cc b/lib/query.cc +index 68ac1e4..f7c7099 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 omit_excluded; + }; + + typedef struct _notmuch_mset_messages { +@@ -92,7 +92,7 @@ notmuch_query_create (notmuch_database_t *notmuch, + + query->exclude_terms = _notmuch_string_list_create (query); + +- query->omit_excluded_messages = FALSE; ++ query->omit_excluded = TRUE; + + return query; + } +@@ -104,9 +104,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_omit_excluded_messages (notmuch_query_t *query, notmuch_bool_t omit_excluded) + { +- query->omit_excluded_messages = omit; ++ query->omit_excluded = omit_excluded; + } + + void +@@ -220,7 +220,7 @@ notmuch_query_search_messages (notmuch_query_t *query) + if (query->exclude_terms) { + exclude_query = _notmuch_exclude_tags (query, final_query); + +- if (query->omit_excluded_messages) ++ if (query->omit_excluded) + final_query = Xapian::Query (Xapian::Query::OP_AND_NOT, + final_query, exclude_query); + else { +-- +1.7.9.1 + -- 2.26.2