From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A63AC6DE1E9F for ; Sun, 5 Mar 2017 03:17:12 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.167 X-Spam-Level: X-Spam-Status: No, score=-0.167 tagged_above=-999 required=5 tests=[AWL=-0.147, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SXu2CaWcHbFa for ; Sun, 5 Mar 2017 03:17:11 -0800 (PST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by arlo.cworth.org (Postfix) with ESMTPS id 1CD1C6DE1E9E for ; Sun, 5 Mar 2017 03:17:10 -0800 (PST) Received: by mail-lf0-f65.google.com with SMTP id r36so10978761lfi.0 for ; Sun, 05 Mar 2017 03:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mmyG66N2Gg6+XdLdgUwW5S5rqLgkfxJJr7so7kx2pVU=; b=Gd0B8p49l7yLhwKcYbCXQhonrFPUo9dlrtp+k+kLGr4dwnQAi55INKqP1H3DoTxKHu ZiCQuuDJZcziQfKk5nWauVIvfwwFFk87O+XwuhQ+0kmWu3ISH2h4zn/KH2aU4tnValff O/UX5nthwsoyo7eCL62T4MIO8ara4boSnURqEjONYdZHfJ8RN5wKCqyNV9D7/NdiIdnk 2iRxN8I3QTFn69EQv9RiccmGnaEtyF5xgPDriGCBe3o6Glabc90MSNZVeg5R3Qj2TB+h atGxSZxfmTh80NvDZgGoUM3qU+QYYv5qxOjhT+nMhiKghqEMwsLKoXyHzhRQmjEfPNzc wuUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mmyG66N2Gg6+XdLdgUwW5S5rqLgkfxJJr7so7kx2pVU=; b=FcjgAtbzSFp/6wnaJXxDKeg0TS3hAOKHV+ExUh9s2+kVEbf2YFLMvJK03/wSWe0PKG 5cP/VSdy+sUJFnZQZ/v0Dt2ZYnDcxwqMjNARI4+mD8DFc0tuQ/Yh21KXuDr7ycvx04HZ 9HfuzitjeYjY21eKWdgh6znavNWuJ623pbO2cTwVfkSmR8+cZkVmnXzuizXmHAqzJ46Y HshNP0KonKCPC48d0XIAkQ3kE+/CRGXNyZRMzII5jFnIKbg1b6gLUXaCaW6zDhTDbBAB +X9IAui1+3wrS85CG9r94m2QxTyE6oeYjA1NxdzcEn9uDSjfWGn51MRAzAycU+AGXd75 Q3Fw== X-Gm-Message-State: AMke39nlcl2XVX6E7L89Kf0BcFGw75Qy0NNeG7CEgY9bG8uoNPM11DBS9Tq0NNEMAbhHwA== X-Received: by 10.25.152.208 with SMTP id a199mr3115164lfe.155.1488712627898; Sun, 05 Mar 2017 03:17:07 -0800 (PST) Received: from localhost (mobile-access-bcee58-4.dhcp.inet.fi. [188.238.88.4]) by smtp.gmail.com with ESMTPSA id h13sm3518629ljh.5.2017.03.05.03.17.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Mar 2017 03:17:07 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Cc: Damien Cassou , jani@nikula.org Subject: [REBASED RFC PATCH] cli/show: include content type parameters in formatted output Date: Sun, 5 Mar 2017 13:17:05 +0200 Message-Id: <20170305111705.6449-1-jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170222214058.26209-1-jani@nikula.org> References: <20170222214058.26209-1-jani@nikula.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 05 Mar 2017 11:17:12 -0000 This is primarily to be able to handle "text/plain; format=flowed", but I don't see much point in making this specific to format=flowed. Just include all content type parameters in the formatted output, like this: "content-type" : "text/plain", "content-type-params" : [ { "format" : "flowed" } ], It might make sense to change the content-type key in schemata to include the parameters in a more structured fashion instead of adding a separate key like here, but this doesn't require a change in consumers or schemata version bump. This was just a quick proof of concept, and obviously lacks tests, schemata updates, etc. --- notmuch-show.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/notmuch-show.c b/notmuch-show.c index 744b62727c26..866b974fcefa 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -625,6 +625,19 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, sp->map_key (sp, "content-type"); sp->string (sp, g_mime_content_type_to_string (content_type)); + const GMimeParam *params = g_mime_content_type_get_params (content_type); + if (params) { + sp->map_key (sp, "content-type-params"); + sp->begin_list (sp); + sp->begin_map (sp); + for (; params; params = params->next) { + sp->map_key (sp, params->name); + sp->string (sp, params->value); + } + sp->end (sp); + sp->end (sp); + } + if (disposition) { sp->map_key (sp, "content-disposition"); sp->string (sp, disposition); -- 2.11.0