From 6eab7895dc3e33172cc4e6b18be60d7dc9befcc2 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 10 Mar 2012 00:33:30 +0200 Subject: [PATCH] [PATCH 3/3] cli: allow switching off entire thread mode in notmuch show json format --- 6d/8667d6db501fea8c2f9967731a5cf12190b3b4 | 125 ++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 6d/8667d6db501fea8c2f9967731a5cf12190b3b4 diff --git a/6d/8667d6db501fea8c2f9967731a5cf12190b3b4 b/6d/8667d6db501fea8c2f9967731a5cf12190b3b4 new file mode 100644 index 000000000..1445965f3 --- /dev/null +++ b/6d/8667d6db501fea8c2f9967731a5cf12190b3b4 @@ -0,0 +1,125 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 9F155431FC4 + for ; Fri, 9 Mar 2012 14:33:48 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 4XSyrHvBP9-Q for ; + Fri, 9 Mar 2012 14:33:47 -0800 (PST) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D3723431FC3 + for ; Fri, 9 Mar 2012 14:33:46 -0800 (PST) +Received: by lbok6 with SMTP id k6so623371lbo.26 + for ; Fri, 09 Mar 2012 14:33:45 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references + :in-reply-to:references:x-gm-message-state; + bh=n+9p7/IQeUvZcGm2SxpHWk1zC39BMGEi/8BlNeN/LLM=; + b=gD4RY3fhGhNJbkC++MU+iOYjGR4ZOvC1S3Htd7/HbGLQHtZ14wveIWpuoOCxcHAr+k + RWR/AGzGiOVfoSIez00f2SrVJKCYe6LCZMGyiNzugixIHF0fNhJdSa0rWeyqpjDIY0XN + vEwOIk1js7iJj4gWbAeIbkN3qzKtwJO/+8D3vLH8BR9UWkMxP3tJ/cki5Ok151ljMk6v + +2WM/ju3FX5IBHjlRguV++Mc04Y06wGhBDXzS1S4dyQ9E1e4k4tTHSUTNzzxxzZ8ErdU + c1kJA8LMWERGueyp5AIjErHIHLEw+SZDVAqR+6axyhjqAnfmU3EnIubPIKky6guIS+7l + Y99g== +Received: by 10.112.8.201 with SMTP id t9mr1484163lba.51.1331332425225; + Fri, 09 Mar 2012 14:33:45 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi. + [84.248.80.253]) + by mx.google.com with ESMTPS id a8sm7964141lba.15.2012.03.09.14.33.43 + (version=SSLv3 cipher=OTHER); Fri, 09 Mar 2012 14:33:44 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org, + markwalters1009@gmail.com +Subject: [PATCH 3/3] cli: allow switching off entire thread mode in notmuch + show json format +Date: Sat, 10 Mar 2012 00:33:30 +0200 +Message-Id: + <7000ede2763163976d19072c9b73a253e01c6ca5.1331329406.git.jani@nikula.org> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: +References: <87399iicit.fsf@qmul.ac.uk> +In-Reply-To: +References: +X-Gm-Message-State: + ALoCoQmuFEh0aMJ3jwOJiLK0Fze/MhMEUtAFVn2bWH7xNOsMuFvMmiXNHZCiZagOHN4CMcmqXB6X +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: Fri, 09 Mar 2012 22:33:48 -0000 + +Previously --format=json implied --entire-thread with no way to switch +it off. Add support for --entire-thread=false usable with json format. + +Signed-off-by: Jani Nikula +--- + notmuch-show.c | 12 ++++++++++-- + 1 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/notmuch-show.c b/notmuch-show.c +index 05d51b2..19e0119 100644 +--- a/notmuch-show.c ++++ b/notmuch-show.c +@@ -985,6 +985,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) + const notmuch_show_format_t *format = &format_text; + notmuch_show_params_t params = { .part = -1 }; + int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED; ++ int entire_thread = -1; + notmuch_bool_t verify = FALSE; + notmuch_bool_t no_exclude = FALSE; + +@@ -996,7 +997,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) + { "raw", NOTMUCH_FORMAT_RAW }, + { 0, 0 } } }, + { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 }, +- { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 }, ++ { NOTMUCH_OPT_KEYWORD_DEFAULT, &entire_thread, "entire-thread", 't', ++ (notmuch_keyword_t []){ { "true", TRUE }, ++ { "false", FALSE }, ++ { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 }, + { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 }, + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 }, +@@ -1020,7 +1024,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) + switch (format_sel) { + case NOTMUCH_FORMAT_JSON: + format = &format_json; +- params.entire_thread = TRUE; ++ if (entire_thread == -1) ++ params.entire_thread = TRUE; + break; + case NOTMUCH_FORMAT_TEXT: + format = &format_text; +@@ -1043,6 +1048,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) + break; + } + ++ if (entire_thread != -1) ++ params.entire_thread = entire_thread; ++ + if (params.decrypt || verify) { + #ifdef GMIME_ATLEAST_26 + /* TODO: GMimePasswordRequestFunc */ +-- +1.7.5.4 + -- 2.26.2