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