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 6AF026DE1DA9 for ; Wed, 22 Feb 2017 13:41:05 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.186 X-Spam-Level: X-Spam-Status: No, score=-0.186 tagged_above=-999 required=5 tests=[AWL=-0.166, 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 9qlow4ROwhPc for ; Wed, 22 Feb 2017 13:41:04 -0800 (PST) Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by arlo.cworth.org (Postfix) with ESMTPS id 439BF6DE1C40 for ; Wed, 22 Feb 2017 13:41:04 -0800 (PST) Received: by mail-lf0-f66.google.com with SMTP id 97so1368722lft.0 for ; Wed, 22 Feb 2017 13:41:04 -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; bh=uw/JFwH8AKYAPFq8maWxGaytYpnOFAiDGVrnKit/bGc=; b=Yvp7CYQ1XZWTIjKOEdImutOrYtIK4VflxICpDjZAODUfjZJW5U9nHPsiXhGsevMQnq EfZyZ27J65PfaVG1Wrp3VlpB2t9TUmPfQkew1vlEvKoeutnKwe2gwLASFynRgVB592eX kdI6yfqGDJEl0YpoSqB8F6sUx20f+0jqxdE4mXP6/o7x/Zra1VpszCi1/M7gD3pFI6YG oNn92ZFtjPWOcYYW6IPcpQgaLlwv0PxbPPmS4krwiMdiVAQFQFC2/UqWnnq1eBAj2dNg 6SS2/jpcEJPo7jl+bNY72RVMTeV5j4OokewjsK4qjGTrjDSl2d7XJqWa59/JkvUKzsly hzjQ== 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; bh=uw/JFwH8AKYAPFq8maWxGaytYpnOFAiDGVrnKit/bGc=; b=j7J9oSO3V32tzLA6QZ9YJpZmEPzrEBmwnVQwrJKgI4AYHP4p/IcYrxbqeUocKelauS sXylMpRXknYT5dTw/B0ED46vfZMXDtZMpx/IkBMDEj/8Ags08/x9bxX0LvFFt6SB39RA 0IIuZx3Z5hab9+CkPSibq3NRSlXiSQhHtLUTEe3YmvBcTwyDXcgNqOhuox1/FO96LdUo gcYNMU5NEvyJNn/d4iW90YJc1M+v/ibs2pSG8GM41rd1+/honi+VMajD7O1QlEqIVETS Wr96via+VR7cPIH23ACzkVYiwX0JmRF6UHU6KVi9UaGLYhov/16RsB3v4YhX22LLvaN1 qkeg== X-Gm-Message-State: AMke39k3WNyVz5qj2Sdl0et5M6ssjZaPuvpT0+aznjld0z0xwVOAiGUeRRkCqBESz5LtRw== X-Received: by 10.46.21.13 with SMTP id s13mr9030325ljd.83.1487799661386; Wed, 22 Feb 2017 13:41:01 -0800 (PST) Received: from localhost (mobile-access-bcee80-14.dhcp.inet.fi. [188.238.128.14]) by smtp.gmail.com with ESMTPSA id s28sm764470ljd.6.2017.02.22.13.41.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Feb 2017 13:41:00 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Cc: Damien Cassou , jani@nikula.org Subject: [RFC PATCH] cli/show: include content type parameters in formatted output Date: Wed, 22 Feb 2017 23:40:58 +0200 Message-Id: <20170222214058.26209-1-jani@nikula.org> X-Mailer: git-send-email 2.11.0 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: Wed, 22 Feb 2017 21:41:05 -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 22fa655ad20d..7100b2d0b578 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -601,6 +601,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 (cid) { sp->map_key (sp, "content-id"); sp->string (sp, cid); -- 2.11.0