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 3BD746DE182F
\r
6 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:57:12 -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.371
\r
12 X-Spam-Status: No, score=-0.371 tagged_above=-999 required=5 tests=[AWL=0.349,
\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 a9dUjBl5yLQV for <notmuch@notmuchmail.org>;
\r
18 Sat, 29 Aug 2015 07:57:10 -0700 (PDT)
\r
19 Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id 35D326DE1422
\r
22 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:50 -0700 (PDT)
\r
23 Received: by wicfv10 with SMTP id fv10so28398027wic.1
\r
24 for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:48 -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=tOhkooD7NhsNpnCbCtRQLQLFm3P9oiALB4kanGyOPjE=;
\r
30 b=ZnwfENGpRrt3GTLW7i7gmf8nDaHDvjV9RPcaIGjqkOygX0rlh+ZmxzCA3COC6JVuli
\r
31 VqXCJgBbG1ybBFXbssOufWBB06bzc1Uaqd3TvQnPJQU7rfEgmrWo1Po7CB51VwUv8EYs
\r
32 S7KV6LgFaeNDFecSBwAgKpYOcMvsDOX83din5FRZfYDJNR5CuKdvG0depSc2MKKASINE
\r
33 S+8hSHTgoXkO7kpDRV2b2i+HO3j8q3P0lEIm5xnoy7+wOEAlxc9DzKmNfrtDift0swLP
\r
34 FWNf/zu8q5XSwhGhnhzupUvEUPJfFQCr6gWKHXSwyZCSnRb73okTEEpJz41AWtfDxCou
\r
37 ALoCoQkhzykwUuZOiRHj4/L1cZHUcdvJfyympfRTsbSa80VpbUdvhtidHwUmbLNYHMrzTqg0rI6z
\r
38 X-Received: by 10.180.107.39 with SMTP id gz7mr10158673wib.82.1440860208383;
\r
39 Sat, 29 Aug 2015 07:56:48 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id k2sm8933331wif.4.2015.08.29.07.56.47
\r
43 (version=TLSv1/SSLv3 cipher=OTHER);
\r
44 Sat, 29 Aug 2015 07:56:47 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [RFC PATCH 5/5] cli: add support for deduplicating based on case
\r
49 Date: Sat, 29 Aug 2015 17:56:36 +0300
\r
51 <b33abd9a0117628932b3f197f536cf1a58793779.1440859765.git.jani@nikula.org>
\r
52 X-Mailer: git-send-email 2.1.4
\r
53 In-Reply-To: <cover.1440859765.git.jani@nikula.org>
\r
54 References: <cover.1440859765.git.jani@nikula.org>
\r
55 In-Reply-To: <cover.1440859765.git.jani@nikula.org>
\r
56 References: <cover.1440859765.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: Sat, 29 Aug 2015 14:57:12 -0000
\r
71 Consider all variants of an email address as one, and print the most
\r
74 notmuch-search.c | 33 ++++++++++++++++++++++++++++++++-
\r
75 1 file changed, 32 insertions(+), 1 deletion(-)
\r
77 diff --git a/notmuch-search.c b/notmuch-search.c
\r
78 index 60311393198d..537298788ab9 100644
\r
79 --- a/notmuch-search.c
\r
80 +++ b/notmuch-search.c
\r
81 @@ -447,6 +447,31 @@ _list_free_for_g_hash (void *ptr)
\r
82 g_list_free_full (ptr, _talloc_free_for_g_hash);
\r
85 +/* Print the most common variant of a list of unique mailboxes, and
\r
86 + * conflate the counts. */
\r
88 +print_popular (const search_context_t *ctx, GList *list)
\r
91 + mailbox_t *mailbox = NULL, *m;
\r
95 + for (l = list; l; l = l->next) {
\r
97 + total += m->count;
\r
98 + if (m->count > max) {
\r
104 + /* The original count is no longer needed, so overwrite. */
\r
105 + mailbox->count = total;
\r
107 + print_mailbox (ctx, mailbox);
\r
111 print_list_value (void *mailbox, void *context)
\r
113 @@ -456,7 +481,12 @@ print_list_value (void *mailbox, void *context)
\r
115 print_hash_value (unused (void *key), void *list, void *context)
\r
117 - g_list_foreach (list, print_list_value, context);
\r
118 + const search_context_t *ctx = context;
\r
120 + if (ctx->dupe == 1)
\r
121 + print_popular (ctx, list);
\r
123 + g_list_foreach (list, print_list_value, context);
\r
127 @@ -817,6 +847,7 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
\r
128 { NOTMUCH_OPT_KEYWORD, &ctx->dupe, "deduplicate", 'x',
\r
129 (notmuch_keyword_t []){ { "yes", -1 },
\r
131 + { "address", 1 },
\r
133 { NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
\r
134 { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
\r