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 988DA431E64
\r
6 for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 19:04:35 -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 bRn06gNPYSFW for <notmuch@notmuchmail.org>;
\r
18 Sat, 25 Feb 2012 19:04:34 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.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 935C8416390
\r
23 for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 18:44:55 -0800 (PST)
\r
24 Received: by wibhi8 with SMTP id hi8so2530505wib.26
\r
25 for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 18:44:54 -0800 (PST)
\r
26 Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates
\r
27 10.180.99.7 as permitted sender) client-ip=10.180.99.7;
\r
28 Authentication-Results: mr.google.com; spf=pass (google.com: domain of
\r
29 markwalters1009@gmail.com designates 10.180.99.7 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.99.7])
\r
33 by 10.180.99.7 with SMTP id em7mr17111907wib.7.1330224294455 (num_hops
\r
34 = 1); Sat, 25 Feb 2012 18:44:54 -0800 (PST)
\r
35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
36 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
37 bh=KwGuv2DPIrD1wJHtGp0d6TK/okOoXyvJNKYPLe6U0so=;
\r
38 b=SJEb62fLR40sfOr6P0tEZwWydOea1XM1/Q8zrdOJTpM0nq8MUWknbHCutJRyEWaR18
\r
39 dqAX4RzO+2Nkxj2wk6YvxLnus/tKzcUp8XEidt2TiZjbUScJk7hoK/FKpYzp8zKJ+CtW
\r
40 0PG7pPf/2eMVZfErs8PdgD89SNKGmZm7FvD7o=
\r
41 Received: by 10.180.99.7 with SMTP id em7mr9349881wib.7.1330157144348;
\r
42 Sat, 25 Feb 2012 00:05:44 -0800 (PST)
\r
43 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
44 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
45 by4sm2316267wib.3.2012.02.25.00.05.43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
46 Sat, 25 Feb 2012 00:05:43 -0800 (PST)
\r
47 From: Mark Walters <markwalters1009@gmail.com>
\r
48 To: notmuch@notmuchmail.org,
\r
49 Austin Clements <amdragon@MIT.EDU>
\r
50 Subject: [Patch v6 08/13] cli: Make notmuch-show respect excludes.
\r
51 Date: Sat, 25 Feb 2012 08:06:39 +0000
\r
52 Message-Id: <1330157204-26094-9-git-send-email-markwalters1009@gmail.com>
\r
53 X-Mailer: git-send-email 1.7.2.3
\r
54 In-Reply-To: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com>
\r
55 References: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Sun, 26 Feb 2012 03:04:35 -0000
\r
70 This adds the excludes to notmuch-show.c. We do not exclude when only
\r
71 a single message (or part) is requested. notmuch-show will output the
\r
72 exclude information when either text or json format is requested. As
\r
73 this changes the output from notmuch-show it breaks many tests (in a
\r
74 trivial and expected fashion).
\r
76 notmuch-show.c | 25 +++++++++++++++++++++----
\r
77 1 files changed, 21 insertions(+), 4 deletions(-)
\r
79 diff --git a/notmuch-show.c b/notmuch-show.c
\r
80 index d930f94..2a634e9 100644
\r
81 --- a/notmuch-show.c
\r
82 +++ b/notmuch-show.c
\r
83 @@ -179,9 +179,10 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in
\r
84 date = notmuch_message_get_date (message);
\r
85 relative_date = notmuch_time_relative_date (ctx, date);
\r
87 - printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",
\r
88 + printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",
\r
89 json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),
\r
90 notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",
\r
91 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",
\r
92 json_quote_str (ctx_quote, notmuch_message_get_filename (message)),
\r
93 date, relative_date);
\r
95 @@ -735,11 +736,12 @@ format_part_text (const void *ctx, mime_node_t *node,
\r
96 notmuch_message_t *message = node->envelope_file;
\r
98 part_type = "message";
\r
99 - printf ("\f%s{ id:%s depth:%d match:%d filename:%s\n",
\r
100 + printf ("\f%s{ id:%s depth:%d match:%d excluded:%d filename:%s\n",
\r
102 notmuch_message_get_message_id (message),
\r
104 - notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),
\r
105 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,
\r
106 + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,
\r
107 notmuch_message_get_filename (message));
\r
109 GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (meta);
\r
110 @@ -1034,6 +1036,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
111 notmuch_show_params_t params = { .part = -1 };
\r
112 int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
113 notmuch_bool_t verify = FALSE;
\r
114 + notmuch_bool_t no_exclude = FALSE;
\r
116 notmuch_opt_desc_t options[] = {
\r
117 { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
118 @@ -1046,6 +1049,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
119 { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
120 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
121 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
122 + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },
\r
126 @@ -1133,10 +1137,23 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
130 + /* If a single message is requested we do not use search_excludes. */
\r
131 if (params.part >= 0)
\r
132 ret = do_show_single (ctx, query, format, ¶ms);
\r
135 + if (!no_exclude) {
\r
136 + const char **search_exclude_tags;
\r
137 + size_t search_exclude_tags_length;
\r
140 + search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
141 + (config, &search_exclude_tags_length);
\r
142 + for (i = 0; i < search_exclude_tags_length; i++)
\r
143 + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
145 ret = do_show (ctx, query, format, ¶ms);
\r
149 notmuch_query_destroy (query);
\r
150 notmuch_database_close (notmuch);
\r