From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D9890431FAE for ; Sat, 11 May 2013 12:51:05 -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 1ib3ImFTFC-2 for ; Sat, 11 May 2013 12:51:01 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id ACD26431FDD for ; Sat, 11 May 2013 12:50:31 -0700 (PDT) Received: by mail-wi0-f173.google.com with SMTP id hi5so281109wib.12 for ; Sat, 11 May 2013 12:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=981UU8GE8YiXCbx03ngSal7tvfZmodaJoP/W04TkoKE=; b=wKyAayTVuMpaE9UTy3Blcv9b2E/KKX/ueuCi+4Ie6UTjOyeqK24wttD2j6m06t9OfH SU5/aFv5nwd68ajKQyYUx1/9Vo0bEi8D5PfKa8za/xmq61kjLe/Rl3vQadSqAH8GXNo+ HdCEM9bJ/Z4jqU5NDDvQlHaAp4PziZ3yZL7OpMQMYxdszN3HLYx2kevYkPkBzqTD1Z3O 67qWQeWX148Ioo0TxwzhIBlpIUdOTThr/Ymtv1aF9HQijzWu5iW+fMWeqm3dvZTAasMy YZaxd0QQhsPP7ULN+/0tvf5h3M4t66WIrGHFPqcS4lHxBpCIX2/Yy5iF9stC4tZzoBWB x3/Q== X-Received: by 10.194.61.45 with SMTP id m13mr31461375wjr.20.1368301830645; Sat, 11 May 2013 12:50:30 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id ek7sm5689751wic.4.2013.05.11.12.50.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 11 May 2013 12:50:30 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v2 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t Date: Sat, 11 May 2013 20:50:08 +0100 Message-Id: <1368301809-12532-8-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1368301809-12532-1-git-send-email-markwalters1009@gmail.com> References: <1368301809-12532-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, 11 May 2013 19:51:06 -0000 From: Peter Wang 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