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