[PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t
authorPeter Wang <novalazy@gmail.com>
Wed, 20 Jun 2012 13:29:06 +0000 (23:29 +1000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:44 +0000 (09:47 -0800)
66/2cc4045f4eb03ebc8fb4c27fc53010bfbc8407 [new file with mode: 0644]

diff --git a/66/2cc4045f4eb03ebc8fb4c27fc53010bfbc8407 b/66/2cc4045f4eb03ebc8fb4c27fc53010bfbc8407
new file mode 100644 (file)
index 0000000..bc7a241
--- /dev/null
@@ -0,0 +1,117 @@
+Return-Path: <novalazy@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7CF66431FD9\r
+       for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:22 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id oY+9lM0NMQbv for <notmuch@notmuchmail.org>;\r
+       Wed, 20 Jun 2012 06:30:21 -0700 (PDT)\r
+Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com\r
+       [209.85.210.53]) (using TLSv1 with cipher RC4-MD5 (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0CFBF431FDB\r
+       for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:10 -0700 (PDT)\r
+Received: by mail-pz0-f53.google.com with SMTP id g9so12291942dad.26\r
+       for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:10 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=qeK3JsuG++4SIJ2oKRpMtb7svc/cvMCELKKPjgtCX4Y=;\r
+       b=y70GaxpWPaizfgajaqCnu5sTMUAm/I1jso86OpUjrrDSNO1bLnvocM60gUCjPFvSEp\r
+       rdjGxpd4FAJ1dOyGkYT6+b42S5Dq77j88jjL/BocgoElM9yA56tKbl2N56NfP0NCW7WV\r
+       XC6mM30cUFyRAUK4bm0/6igdqGqvmi+/WQvd7eC7joDcQLVi3z5/p6eOsd6oTV2x8Vtv\r
+       sX6rDeeavCpV1Zhddxd2kYU/qcEPVyjX8tpukAyUht86gkdHeKlm4h79jt+jfJkoV61s\r
+       1bmhPjbPDTT0PvDaE8a7zPvze+E2N/zR38GpL3Wk8l0r+/wkYmxlF/3PPWz641WRAq42\r
+       0Dbg==\r
+Received: by 10.68.226.65 with SMTP id rq1mr3224564pbc.25.1340199010873;\r
+       Wed, 20 Jun 2012 06:30:10 -0700 (PDT)\r
+Received: from localhost (215.42.233.220.static.exetel.com.au.\r
+       [220.233.42.215])\r
+       by mx.google.com with ESMTPS id mt9sm31949288pbb.14.2012.06.20.06.30.08\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 20 Jun 2012 06:30:09 -0700 (PDT)\r
+From: Peter Wang <novalazy@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t\r
+Date: Wed, 20 Jun 2012 23:29:06 +1000\r
+Message-Id: <1340198947-29370-8-git-send-email-novalazy@gmail.com>\r
+X-Mailer: git-send-email 1.7.4.4\r
+In-Reply-To: <1340198947-29370-1-git-send-email-novalazy@gmail.com>\r
+References: <1340198947-29370-1-git-send-email-novalazy@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 20 Jun 2012 13:30:22 -0000\r
+\r
+Add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t so that it can\r
+cover all four values of search --exclude in the cli.\r
+---\r
+ lib/notmuch.h    |    1 +\r
+ lib/query.cc     |    6 ++++--\r
+ notmuch-search.c |    2 +-\r
+ 3 files changed, 6 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 1280afd..f4381ae 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -504,6 +504,7 @@ notmuch_query_get_query_string (notmuch_query_t *query);\r
+ typedef enum {\r
+     NOTMUCH_EXCLUDE_FALSE,\r
+     NOTMUCH_EXCLUDE_TRUE,\r
++    NOTMUCH_EXCLUDE_FLAG,\r
+     NOTMUCH_EXCLUDE_ALL\r
+ } notmuch_exclude_t;\r
+ \r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index f752452..1e0f292 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -221,10 +221,12 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
+       if (query->exclude_terms) {\r
+           exclude_query = _notmuch_exclude_tags (query, final_query);\r
+ \r
+-          if (query->omit_excluded != NOTMUCH_EXCLUDE_FALSE)\r
++          if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||\r
++              query->omit_excluded == NOTMUCH_EXCLUDE_ALL)\r
++          {\r
+               final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,\r
+                                            final_query, exclude_query);\r
+-          else {\r
++          } else {\r
+               exclude_query = Xapian::Query (Xapian::Query::OP_AND,\r
+                                          exclude_query, final_query);\r
+ \r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 89b5bf9..027923d 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -527,7 +527,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+       for (i = 0; i < search_exclude_tags_length; i++)\r
+           notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
+       if (exclude == EXCLUDE_FLAG)\r
+-          notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);\r
++          notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FLAG);\r
+       if (exclude == EXCLUDE_ALL)\r
+           notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);\r
+     }\r
+-- \r
+1.7.4.4\r
+\r