[PATCH 4/4] Add exclude flag
authorMark Walters <markwalters1009@gmail.com>
Sun, 29 Jan 2012 00:04:04 +0000 (00:04 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:29 +0000 (09:43 -0800)
06/33b3366e569a4527d075039d7dc55b14e607ba [new file with mode: 0644]

diff --git a/06/33b3366e569a4527d075039d7dc55b14e607ba b/06/33b3366e569a4527d075039d7dc55b14e607ba
new file mode 100644 (file)
index 0000000..7dff578
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0C0F4431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id kfls08WHxdDn for <notmuch@notmuchmail.org>;\r
+       Sat, 28 Jan 2012 16:03:38 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8096D431FCF\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:38 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so2596577wib.26\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 16:03:34 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=krUCqqz0X2fnmr20vCWL+6+gJcYb2WFd5dLJsgUEqtg=;\r
+       b=D4OfPNlEsI9IazHYFVbOkAKxhIyFCkNbMMVtK7sVkHKehmFleaUNA0TeJzhNzfeUVM\r
+       9VFxbq+60moUWQFM+4aHpCOu3c/JtxFkBfF0REbOKWrJ8zUkfZ9AEum/IFyNHSCuWFBS\r
+       FSpzi5o9RU4znRpK7WzoYgF/BQnq+h66Ua9jY=\r
+Received: by 10.180.94.97 with SMTP id db1mr19295174wib.16.1327795414708;\r
+       Sat, 28 Jan 2012 16:03:34 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ dr5sm37507743wib.0.2012.01.28.16.03.33        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 28 Jan 2012 16:03:33 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+       amdragon@MIT.EDU\r
+Subject: [PATCH 4/4] Add exclude flag\r
+Date: Sun, 29 Jan 2012 00:04:04 +0000\r
+Message-Id: <1327795444-18745-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <8739azqt2j.fsf@qmul.ac.uk>\r
+References: <8739azqt2j.fsf@qmul.ac.uk>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sun, 29 Jan 2012 00:03:40 -0000\r
+\r
+Make notmuch-show.c respect the EXCLUDE flag.\r
+\r
+---\r
+ notmuch-show.c |   20 +++++++++++++++++---\r
+ 1 files changed, 17 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index dec799c..b55d2ba 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -193,10 +193,12 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)\r
+ static void\r
+ format_message_text (unused (const void *ctx), notmuch_message_t *message, int indent)\r
+ {\r
+-    printf ("id:%s depth:%d match:%d filename:%s\n",\r
++    /* Could changing this could break users ? */\r
++    printf ("id:%s depth:%d match:%d excluded:%d filename:%s\n",\r
+           notmuch_message_get_message_id (message),\r
+           indent,\r
+           notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),\r
++          notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED),\r
+           notmuch_message_get_filename (message));\r
+ }\r
\r
+@@ -212,9 +214,10 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
+     date = notmuch_message_get_date (message);\r
+     relative_date = notmuch_time_relative_date (ctx, date);\r
\r
+-    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
++    printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
+           json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
+           notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
++          notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",\r
+           json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
+           date, relative_date);\r
\r
+@@ -293,6 +296,7 @@ _is_from_line (const char *line)\r
+  *\r
+  * http://qmail.org/qmail-manual-html/man5/mbox.html\r
+  */\r
++/* should this do something with the exclude flag? */\r
+ static void\r
+ format_message_mbox (const void *ctx,\r
+                    notmuch_message_t *message,\r
+@@ -947,9 +951,11 @@ do_show_single (void *ctx,\r
+     notmuch_messages_t *messages;\r
+     notmuch_message_t *message;\r
\r
++    /* we need to fix something in notmuch_query_count for now just\r
++     * comment this out*/\r
+     if (notmuch_query_count_messages (query) != 1) {\r
+       fprintf (stderr, "Error: search term did not match precisely one message.\n");\r
+-      return 1;\r
++      /* return 1; */\r
+     }\r
\r
+     messages = notmuch_query_search_messages (query);\r
+@@ -1059,9 +1065,12 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+     char *opt;\r
+     const notmuch_show_format_t *format = &format_text;\r
+     notmuch_show_params_t params;\r
++    const char **search_exclude_tags;\r
++    size_t search_exclude_tags_length;\r
+     int mbox = 0;\r
+     int format_specified = 0;\r
+     int i;\r
++    unsigned int j;\r
\r
+     params.entire_thread = 0;\r
+     params.raw = 0;\r
+@@ -1158,6 +1167,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+       return 1;\r
+     }\r
\r
++    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
++        (config, &search_exclude_tags_length);\r
++    for (j = 0; j < search_exclude_tags_length; j++)\r
++        notmuch_query_add_tag_exclude (query, search_exclude_tags[j]);\r
++\r
+     /* if part was requested and format was not specified, use format=raw */\r
+     if (params.part >= 0 && !format_specified)\r
+       format = &format_raw;\r
+-- \r
+1.7.2.3\r
+\r