1 Return-Path: <markwalters1009@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 67917431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 1 Mar 2012 14:29:49 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 3M05NCoJKB2C for <notmuch@notmuchmail.org>;
\r
18 Thu, 1 Mar 2012 14:29:47 -0800 (PST)
\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
20 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 00F66431E84
\r
23 for <notmuch@notmuchmail.org>; Thu, 1 Mar 2012 14:29:37 -0800 (PST)
\r
24 Received: by werm13 with SMTP id m13so775491wer.26
\r
25 for <notmuch@notmuchmail.org>; Thu, 01 Mar 2012 14:29:36 -0800 (PST)
\r
26 Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates
\r
27 10.180.92.34 as permitted sender) client-ip=10.180.92.34;
\r
28 Authentication-Results: mr.google.com; spf=pass (google.com: domain of
\r
29 markwalters1009@gmail.com designates 10.180.92.34 as permitted
\r
30 sender) smtp.mail=markwalters1009@gmail.com;
\r
31 dkim=pass header.i=markwalters1009@gmail.com
\r
32 Received: from mr.google.com ([10.180.92.34])
\r
33 by 10.180.92.34 with SMTP id cj2mr14729645wib.20.1330640976929
\r
34 (num_hops = 1); Thu, 01 Mar 2012 14:29:36 -0800 (PST)
\r
35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
36 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
37 bh=/OoCuaAIfo+tvXBIvnzH51XDY+Q5JnFOC2VH9QyfpDk=;
\r
38 b=IkfWDiLJ53dWT0zkOle/tTAuhbFWgrrumLwAeqbhgp6+RdodvXiOzJdzhdPzoJf2W2
\r
39 gSTPsAurg2cbhj6IqmWjAusVvxQ8bD366vJi/8gs9kpTgSfeLg6hTFiy45cN6/2Ox072
\r
40 opnIjOF5QQOlVmhaNNzArmjBCCuEwjbNhyuTGq/AAHt1dfPb+skLuZqeDGogfVHacyyK
\r
41 rpFgDuaGRiPVlUk5Ljzvk/G+3ifVVq7Qu104QG5Wd5bJic47gvZi0maa9hq9pxpStQ/t
\r
42 2ni851vklkVABGSpOC8BFlHIKcSpbZQQfW0pvYR+TAbzASnVGjTnlLwu+7d9AA3PDd1g
\r
44 Received: by 10.180.92.34 with SMTP id cj2mr11832353wib.20.1330640976865;
\r
45 Thu, 01 Mar 2012 14:29:36 -0800 (PST)
\r
46 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
47 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
48 fl2sm16591301wib.4.2012.03.01.14.29.35 (version=TLSv1/SSLv3 cipher=OTHER);
\r
49 Thu, 01 Mar 2012 14:29:35 -0800 (PST)
\r
50 From: Mark Walters <markwalters1009@gmail.com>
\r
51 To: notmuch@notmuchmail.org
\r
52 Subject: [Patch v7 08/13] cli: Make notmuch-show respect excludes.
\r
53 Date: Thu, 1 Mar 2012 22:30:40 +0000
\r
54 Message-Id: <1330641045-27416-9-git-send-email-markwalters1009@gmail.com>
\r
55 X-Mailer: git-send-email 1.7.2.3
\r
56 In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>
\r
57 References: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.13
\r
61 List-Id: "Use and development of the notmuch mail system."
\r
62 <notmuch.notmuchmail.org>
\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
66 List-Post: <mailto:notmuch@notmuchmail.org>
\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
70 X-List-Received-Date: Thu, 01 Mar 2012 22:29:49 -0000
\r
72 This adds the excludes to notmuch-show.c. We do not exclude when only
\r
73 a single message (or part) is requested. notmuch-show will output the
\r
74 exclude information when either text or json format is requested. As
\r
75 this changes the output from notmuch-show it breaks many tests (in a
\r
76 trivial and expected fashion).
\r
78 notmuch-show.c | 25 +++++++++++++++++++++----
\r
79 1 files changed, 21 insertions(+), 4 deletions(-)
\r
81 diff --git a/notmuch-show.c b/notmuch-show.c
\r
82 index 6a171a4..8c0b925 100644
\r
83 --- a/notmuch-show.c
\r
84 +++ b/notmuch-show.c
\r
85 @@ -143,9 +143,10 @@ format_message_json (const void *ctx, notmuch_message_t *message)
\r
86 date = notmuch_message_get_date (message);
\r
87 relative_date = notmuch_time_relative_date (ctx, date);
\r
89 - printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",
\r
90 + printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",
\r
91 json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),
\r
92 notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",
\r
93 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",
\r
94 json_quote_str (ctx_quote, notmuch_message_get_filename (message)),
\r
95 date, relative_date);
\r
97 @@ -579,11 +580,12 @@ format_part_text (const void *ctx, mime_node_t *node,
\r
98 notmuch_message_t *message = node->envelope_file;
\r
100 part_type = "message";
\r
101 - printf ("\f%s{ id:%s depth:%d match:%d filename:%s\n",
\r
102 + printf ("\f%s{ id:%s depth:%d match:%d excluded:%d filename:%s\n",
\r
104 notmuch_message_get_message_id (message),
\r
106 - notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),
\r
107 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,
\r
108 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,
\r
109 notmuch_message_get_filename (message));
\r
111 GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (meta);
\r
112 @@ -984,6 +986,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
113 notmuch_show_params_t params = { .part = -1 };
\r
114 int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
115 notmuch_bool_t verify = FALSE;
\r
116 + notmuch_bool_t no_exclude = FALSE;
\r
118 notmuch_opt_desc_t options[] = {
\r
119 { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
120 @@ -996,6 +999,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
121 { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
122 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
123 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
124 + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },
\r
128 @@ -1083,10 +1087,23 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
132 + /* If a single message is requested we do not use search_excludes. */
\r
133 if (params.part >= 0)
\r
134 ret = do_show_single (ctx, query, format, ¶ms);
\r
137 + if (!no_exclude) {
\r
138 + const char **search_exclude_tags;
\r
139 + size_t search_exclude_tags_length;
\r
142 + search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
143 + (config, &search_exclude_tags_length);
\r
144 + for (i = 0; i < search_exclude_tags_length; i++)
\r
145 + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
147 ret = do_show (ctx, query, format, ¶ms);
\r
151 notmuch_query_destroy (query);
\r
152 notmuch_database_close (notmuch);
\r