1 Return-Path: <jani@nikula.org>
\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 arlo.cworth.org (Postfix) with ESMTP id 971D56DE1607
\r
6 for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:33 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
10 X-Spam-Score: -0.422
\r
12 X-Spam-Status: No, score=-0.422 tagged_above=-999 required=5 tests=[AWL=0.298,
\r
13 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id iRT_XOhNR8o4 for <notmuch@notmuchmail.org>;
\r
18 Thu, 3 Sep 2015 12:40:30 -0700 (PDT)
\r
19 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id 54C956DE1601
\r
22 for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:16 -0700 (PDT)
\r
23 Received: by wicfx3 with SMTP id fx3so1163164wic.1
\r
24 for <notmuch@notmuchmail.org>; Thu, 03 Sep 2015 12:40:14 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=hSwKYqPHO7+9nkGxYYNyXcN4RX89T7x7GJPaAR5dNYg=;
\r
30 b=bGRuOSwHHkd/YMuowWF84q3M0m1elXTWB9C4Xc0PwmrS5VIetKgpZaAgvVDwJhw3c4
\r
31 67EYhIv9Qmx849jOtZ6Pbh5nKojohBZ7umNTa3gkvfKz9kzIRWsVqVhokfcwBrNyWSH2
\r
32 JE3DbJaXTxWNOg3r+j/dmvJ3/mCoRGlI5+FlaenRTn9KSpznMDMIUBz+xV6d0s+oWfGP
\r
33 1zJ5G4wp8frAi9LcaTmcgZ8kcIMPRv0F0ZVP2IE/99CLUx+ixaxy+OSdRH8CiD/Z/p3n
\r
34 WGN9g8YDrPN/8ipKdS62W981PDLVD3Od52KBGrYggkAZ/Kjvdhq93QvfjKEBuH7Pokv5
\r
37 ALoCoQlaEuF0IG80aLWP/8NIjqrDVeecBRTgcnTq+D1AKBKJpuxnzMH/iSsbI6K3neYZkxDQJQCt
\r
38 X-Received: by 10.180.99.66 with SMTP id eo2mr2475724wib.88.1441309214443;
\r
39 Thu, 03 Sep 2015 12:40:14 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id eu10sm646836wib.5.2015.09.03.12.40.13
\r
43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
44 Thu, 03 Sep 2015 12:40:14 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [PATCH v2 3/9] cli: add support for not deduplicating notmuch address
\r
49 Date: Thu, 3 Sep 2015 22:39:59 +0300
\r
51 <fd59eadee26a770097517bee038e2b126e11aa90.1441308761.git.jani@nikula.org>
\r
52 X-Mailer: git-send-email 2.1.4
\r
53 In-Reply-To: <cover.1441308761.git.jani@nikula.org>
\r
54 References: <cover.1441308761.git.jani@nikula.org>
\r
55 In-Reply-To: <cover.1441308761.git.jani@nikula.org>
\r
56 References: <cover.1441308761.git.jani@nikula.org>
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.18
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Thu, 03 Sep 2015 19:40:33 -0000
\r
71 Make it possible to use notmuch address as part of a | sort | uniq -c
\r
72 pipe instead of forcing --output=count. This is useful for combining
\r
73 results from multiple notmuch address queries.
\r
75 notmuch-search.c | 21 ++++++++++++++++++++-
\r
76 1 file changed, 20 insertions(+), 1 deletion(-)
\r
78 diff --git a/notmuch-search.c b/notmuch-search.c
\r
79 index 36f58eb8d54c..66404b561679 100644
\r
80 --- a/notmuch-search.c
\r
81 +++ b/notmuch-search.c
\r
82 @@ -37,12 +37,18 @@ typedef enum {
\r
91 NOTMUCH_FORMAT_JSON,
\r
92 NOTMUCH_FORMAT_TEXT,
\r
93 NOTMUCH_FORMAT_TEXT0,
\r
99 notmuch_database_t *notmuch;
\r
100 format_sel_t format_sel;
\r
101 @@ -55,6 +61,7 @@ typedef struct {
\r
104 GHashTable *addresses;
\r
106 } search_context_t;
\r
109 @@ -355,7 +362,9 @@ process_address_list (const search_context_t *ctx,
\r
113 - if (is_duplicate (ctx, mbx.name, mbx.addr))
\r
114 + /* OUTPUT_COUNT only works with deduplication */
\r
115 + if (ctx->dedup != DEDUP_NONE &&
\r
116 + is_duplicate (ctx, mbx.name, mbx.addr))
\r
119 if (ctx->output & OUTPUT_COUNT)
\r
120 @@ -656,6 +665,7 @@ static search_context_t search_context = {
\r
122 .limit = -1, /* unlimited */
\r
124 + .dedup = DEDUP_MAILBOX,
\r
127 static const notmuch_opt_desc_t common_options[] = {
\r
128 @@ -755,6 +765,10 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
\r
129 (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
\r
130 { "false", NOTMUCH_EXCLUDE_FALSE },
\r
132 + { NOTMUCH_OPT_KEYWORD, &ctx->dedup, "deduplicate", 'D',
\r
133 + (notmuch_keyword_t []){ { "no", DEDUP_NONE },
\r
134 + { "mailbox", DEDUP_MAILBOX },
\r
136 { NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
\r
137 { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
\r
139 @@ -769,6 +783,11 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
\r
140 if (! (ctx->output & (OUTPUT_SENDER | OUTPUT_RECIPIENTS)))
\r
141 ctx->output |= OUTPUT_SENDER;
\r
143 + if (ctx->output & OUTPUT_COUNT && ctx->dedup == DEDUP_NONE) {
\r
144 + fprintf (stderr, "--output=count is not applicable with --deduplicate=no\n");
\r
145 + return EXIT_FAILURE;
\r
148 if (_notmuch_search_prepare (ctx, config,
\r
149 argc - opt_index, argv + opt_index))
\r
150 return EXIT_FAILURE;
\r