[RFC PATCH 3/5] cli: add support for not deduplicating notmuch address results
authorJani Nikula <jani@nikula.org>
Sat, 29 Aug 2015 14:56:34 +0000 (17:56 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:26 +0000 (14:49 -0700)
fc/32bad1c36e638ca1e93bab7bb188c6c60faacd [new file with mode: 0644]

diff --git a/fc/32bad1c36e638ca1e93bab7bb188c6c60faacd b/fc/32bad1c36e638ca1e93bab7bb188c6c60faacd
new file mode 100644 (file)
index 0000000..771abb2
--- /dev/null
@@ -0,0 +1,105 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id BCD566DE1642\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.34\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.34 tagged_above=-999 required=5 tests=[AWL=0.380, \r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id qOC9v2KLESAp for <notmuch@notmuchmail.org>;\r
+ Sat, 29 Aug 2015 07:56:54 -0700 (PDT)\r
+Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com\r
+ [209.85.212.182])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id BF9046DE17AA\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:46 -0700 (PDT)\r
+Received: by wicne3 with SMTP id ne3so39889912wic.0\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Aug 2015 07:56:45 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=VS0F33nn0W8Dq5aBj4p/4jMj4OonAboKUj6iZe5HoeE=;\r
+ b=E1rOE3DYyF5Q/C7l+3imy69Ahv2tftp+hRirrFFrnATLAvZi/3/+ef5aFZj+LKPbIY\r
+ fGnOklKaCY1UMXYjtOS9f4/k2CWJcQ4A0FBop3mCnBIDSTd3z2TJnNhEOesi5+ITS0cX\r
+ 0ibTf5EmhVzuPjbpOaShNBnyMHgbftJ7SjfHffWAql2astEAXrM19NSqIYh5BCd4dkfh\r
+ lV72tuC7qZ9fbL5QmdLDh31J0dJUq2F/W3h2ir7GF/IZGY5sLQd3Ow3yvqL4VnLBgNAh\r
+ wFhPjcaJ/4Krzmm51bz5eqN9nf2rut+HH2o6aTzqP27AaprHsx25gRKWrLdXcNecNvcW\r
+ jTfA==\r
+X-Gm-Message-State:\r
+ ALoCoQnDccizK3Awn8LBCYh7yLJXv1ekZHlsSKPlMobB30xY/6JQbz6JTv1EIFRK8ICiSFuAz4PQ\r
+X-Received: by 10.180.23.66 with SMTP id k2mr9903963wif.85.1440860205123;\r
+ Sat, 29 Aug 2015 07:56:45 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.\r
+ [188.238.79.131])\r
+ by smtp.gmail.com with ESMTPSA id p3sm8921417wib.16.2015.08.29.07.56.44\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 29 Aug 2015 07:56:44 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 3/5] cli: add support for not deduplicating notmuch\r
+ address results\r
+Date: Sat, 29 Aug 2015 17:56:34 +0300\r
+Message-Id:\r
+ <5badd1d1d46690987558dd2283efdc69be4c8c99.1440859765.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1440859765.git.jani@nikula.org>\r
+References: <cover.1440859765.git.jani@nikula.org>\r
+In-Reply-To: <cover.1440859765.git.jani@nikula.org>\r
+References: <cover.1440859765.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 29 Aug 2015 14:56:55 -0000\r
+\r
+Make it possible to use notmuch address as part of a | sort | uniq -c\r
+pipe instead of forcing --output=count. This is useful for combining\r
+results from multiple notmuch address queries.\r
+---\r
+ notmuch-search.c | 7 ++++++-\r
+ 1 file changed, 6 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 36f58eb8d54c..be8afcc0187b 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -355,7 +355,8 @@ process_address_list (const search_context_t *ctx,\r
+               .count = 0,\r
+           };\r
\r
+-          if (is_duplicate (ctx, mbx.name, mbx.addr))\r
++          if ((ctx->output & OUTPUT_COUNT || ctx->dupe) &&\r
++              is_duplicate (ctx, mbx.name, mbx.addr))\r
+               continue;\r
\r
+           if (ctx->output & OUTPUT_COUNT)\r
+@@ -755,6 +756,10 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])\r
+         (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },\r
+                                 { "false", NOTMUCH_EXCLUDE_FALSE },\r
+                                 { 0, 0 } } },\r
++      { NOTMUCH_OPT_KEYWORD, &ctx->dupe, "deduplicate", 'x',\r
++        (notmuch_keyword_t []){ { "yes", -1 },\r
++                                { "no", 0 },\r
++                                { 0, 0 } } },\r
+       { NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },\r
+       { NOTMUCH_OPT_INHERIT, (void *) &notmuch_shared_options, NULL, 0, 0 },\r
+       { 0, 0, 0, 0, 0 }\r
+-- \r
+2.1.4\r
+\r