1 Return-Path: <novalazy@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 5D5C7431FD8
\r
6 for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:23 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id cfpwXvqcYlTs for <notmuch@notmuchmail.org>;
\r
17 Wed, 20 Jun 2012 06:30:22 -0700 (PDT)
\r
18 Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com
\r
19 [209.85.160.53]) (using TLSv1 with cipher RC4-MD5 (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D94A2429E35
\r
22 for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:16 -0700 (PDT)
\r
23 Received: by mail-pb0-f53.google.com with SMTP id rr13so756934pbb.26
\r
24 for <notmuch@notmuchmail.org>; Wed, 20 Jun 2012 06:30:16 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=O2TKTmOLZd/DvpzmkmmNaNX8+pmc5tnjB0DJ20sFRiU=;
\r
28 b=DXTt1kZF6IVrZYY99KNeBRFh0CJpmv5YhHPq1bfT51pwRdyVO/iyF+WTAzeABztrox
\r
29 EV9X7yyS3/9xz/2QlpLvXKXfueHJF4b95LP5nbZTIxUtgUiCN9+N97htrN7qQjInZbfa
\r
30 NlAJUbhDMUDg789/7nIga3P4EeDz9qQYr7lKLGQTP7pCgTgxI+Wtl8lf+ZbH4VQtb+Oq
\r
31 T/pG0LJYUc716hfN7nJFdDQrKNqrAKeTKnth1xZ4GF5TjcYaqGALU17Uh/bi0RmGNt5j
\r
32 bChWAdogv2aNIypSmRDpb8c4h+TfoYmv2UZmRm/AJe8u13hHWM6sJoynhi7jXyfthNrR
\r
34 Received: by 10.68.224.70 with SMTP id ra6mr76383480pbc.11.1340199016721;
\r
35 Wed, 20 Jun 2012 06:30:16 -0700 (PDT)
\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
38 by mx.google.com with ESMTPS id tj4sm31943519pbc.33.2012.06.20.06.30.14
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Wed, 20 Jun 2012 06:30:15 -0700 (PDT)
\r
41 From: Peter Wang <novalazy@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 8/8] cli: use notmuch_exclude_t in option parser
\r
44 Date: Wed, 20 Jun 2012 23:29:07 +1000
\r
45 Message-Id: <1340198947-29370-9-git-send-email-novalazy@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.4.4
\r
47 In-Reply-To: <1340198947-29370-1-git-send-email-novalazy@gmail.com>
\r
48 References: <1340198947-29370-1-git-send-email-novalazy@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Wed, 20 Jun 2012 13:30:23 -0000
\r
63 Use notmuch_exclude_t constants directly instead of a redundant
\r
64 enumeration while parsing search --exclude keyword arguments.
\r
66 notmuch-search.c | 28 +++++++++-------------------
\r
67 1 files changed, 9 insertions(+), 19 deletions(-)
\r
69 diff --git a/notmuch-search.c b/notmuch-search.c
\r
70 index 027923d..23cf342 100644
\r
71 --- a/notmuch-search.c
\r
72 +++ b/notmuch-search.c
\r
73 @@ -416,13 +416,6 @@ do_search_tags (notmuch_database_t *notmuch,
\r
85 notmuch_search_command (void *ctx, int argc, char *argv[])
\r
87 @@ -436,7 +429,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
88 output_t output = OUTPUT_SUMMARY;
\r
90 int limit = -1; /* unlimited */
\r
91 - int exclude = EXCLUDE_TRUE;
\r
92 + notmuch_exclude_t exclude = NOTMUCH_EXCLUDE_TRUE;
\r
95 enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
\r
96 @@ -459,10 +452,10 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
97 { "tags", OUTPUT_TAGS },
\r
99 { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
\r
100 - (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
\r
101 - { "false", EXCLUDE_FALSE },
\r
102 - { "flag", EXCLUDE_FLAG },
\r
103 - { "all", EXCLUDE_ALL },
\r
104 + (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
\r
105 + { "false", NOTMUCH_EXCLUDE_FALSE },
\r
106 + { "flag", NOTMUCH_EXCLUDE_FLAG },
\r
107 + { "all", NOTMUCH_EXCLUDE_ALL },
\r
109 { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
\r
110 { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
\r
111 @@ -510,15 +503,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
113 notmuch_query_set_sort (query, sort);
\r
115 - if (exclude == EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {
\r
116 + if (exclude == NOTMUCH_EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {
\r
117 /* If we are not doing summary output there is nowhere to
\r
118 * print the excluded flag so fall back on including the
\r
119 * excluded messages. */
\r
120 fprintf (stderr, "Warning: this output format cannot flag excluded messages.\n");
\r
121 - exclude = EXCLUDE_FALSE;
\r
122 + exclude = NOTMUCH_EXCLUDE_FALSE;
\r
125 - if (exclude != EXCLUDE_FALSE) {
\r
126 + if (exclude != NOTMUCH_EXCLUDE_FALSE) {
\r
127 const char **search_exclude_tags;
\r
128 size_t search_exclude_tags_length;
\r
130 @@ -526,10 +519,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
131 (config, &search_exclude_tags_length);
\r
132 for (i = 0; i < search_exclude_tags_length; i++)
\r
133 notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
134 - if (exclude == EXCLUDE_FLAG)
\r
135 - notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FLAG);
\r
136 - if (exclude == EXCLUDE_ALL)
\r
137 - notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
\r
138 + notmuch_query_set_omit_excluded (query, exclude);
\r