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 7CF66431FD9 for ; Wed, 20 Jun 2012 06:30:22 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.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 oY+9lM0NMQbv for ; Wed, 20 Jun 2012 06:30:21 -0700 (PDT) Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com [209.85.210.53]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0CFBF431FDB for ; Wed, 20 Jun 2012 06:30:10 -0700 (PDT) Received: by mail-pz0-f53.google.com with SMTP id g9so12291942dad.26 for ; Wed, 20 Jun 2012 06:30: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=qeK3JsuG++4SIJ2oKRpMtb7svc/cvMCELKKPjgtCX4Y=; b=y70GaxpWPaizfgajaqCnu5sTMUAm/I1jso86OpUjrrDSNO1bLnvocM60gUCjPFvSEp rdjGxpd4FAJ1dOyGkYT6+b42S5Dq77j88jjL/BocgoElM9yA56tKbl2N56NfP0NCW7WV XC6mM30cUFyRAUK4bm0/6igdqGqvmi+/WQvd7eC7joDcQLVi3z5/p6eOsd6oTV2x8Vtv sX6rDeeavCpV1Zhddxd2kYU/qcEPVyjX8tpukAyUht86gkdHeKlm4h79jt+jfJkoV61s 1bmhPjbPDTT0PvDaE8a7zPvze+E2N/zR38GpL3Wk8l0r+/wkYmxlF/3PPWz641WRAq42 0Dbg== Received: by 10.68.226.65 with SMTP id rq1mr3224564pbc.25.1340199010873; Wed, 20 Jun 2012 06:30:10 -0700 (PDT) Received: from localhost (215.42.233.220.static.exetel.com.au. [220.233.42.215]) by mx.google.com with ESMTPS id mt9sm31949288pbb.14.2012.06.20.06.30.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 06:30:09 -0700 (PDT) From: Peter Wang To: notmuch@notmuchmail.org Subject: [PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t Date: Wed, 20 Jun 2012 23:29:06 +1000 Message-Id: <1340198947-29370-8-git-send-email-novalazy@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1340198947-29370-1-git-send-email-novalazy@gmail.com> References: <1340198947-29370-1-git-send-email-novalazy@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: Wed, 20 Jun 2012 13:30:22 -0000 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