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 EDBE16DE0EA6 for ; Sat, 22 Dec 2018 04:11:03 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.341 X-Spam-Level: X-Spam-Status: No, score=0.341 tagged_above=-999 required=5 tests=[AWL=-0.312, DKIMWL_WL_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] 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 cCtXrzz_RqiT for ; Sat, 22 Dec 2018 04:11:03 -0800 (PST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by arlo.cworth.org (Postfix) with ESMTPS id 08CDA6DE0C3B for ; Sat, 22 Dec 2018 04:11:03 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id l9so7697218wrt.13 for ; Sat, 22 Dec 2018 04:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Awo+T4QY3xa9KjKSuW/wQikvSZXvx650/SPUJG//kag=; b=i9WUgIXb5Es7/NaQvhBqzWeB/WchZ5k+94WFOGU7VRKhtI0enIopLvJJiXPiJQeTbK ifJq21Eyks01HvMf05+fqhKElTfz2isVqzW94lAvya3XHGzq8LT9OPi1o/X+yQnJJvnG gncnHraUKkcy+/voy78HchQYwH22iPSx1JdefObkPL8oAGR7nGq1b/J+jvRAVPbLGzfI gIGBQdRe2fDJtCNu60Cp0i1hsVggOL9yU2aHTXtUZJAMjzZkeFCsIv+KsoD6OnghG6nc jvsR95Z9t420sD2/o7uG03DUJZ4Mw4e2VJZrRlICAnVEx9xor5aK6ZRNXGV3UT09omBQ AvmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Awo+T4QY3xa9KjKSuW/wQikvSZXvx650/SPUJG//kag=; b=q1uo55NA1fD2n//BaAMMYISOMLV2PHKD5OsUjsIMsXXyEKee1AF4nnAmiq/1qgd327 3zXley5DHSHaiahrLmg7qMZtGyMRefwlZVyQgl9xwPUg/iRXUFZeT3K7HguReArxyL78 sh5V3O1foU4uORYgZjIPO7uIDwMgNCb3Xj8q3LbWqMCtTQan0wqu5c17GcxSXhAoymR7 PTDPdFCDrRTF4z4NUHE3+CQps3zHTaW1sM1VDTP9JGn7wquZrfJeR4dQDqM8L4XfJST0 UE2P8o8Eqg8bQZxWpmcsQryBsknuIFRUZ0N2zmxuDbhHKbgJ9Fz+XqixjGOZx6/fFyf9 4obQ== X-Gm-Message-State: AJcUukeR4uIQDXXF+n7BG51q+X8uCI4mRQk1lHFnlJWgXGNe6nkF/L/V 1ynF+R9bEOuWS51fkTqCQ2+uBRrdzis= X-Google-Smtp-Source: ALg8bN601R4zoLgfk5DbTSpfDLitcFGZLrA8bL/J+RoBwLeHPjh7MxBB1gBclPpxxI2jFIBJi3iSVg== X-Received: by 2002:adf:83a7:: with SMTP id 36mr6069216wre.13.1545480661375; Sat, 22 Dec 2018 04:11:01 -0800 (PST) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id e19sm22127550wrc.25.2018.12.22.04.10.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Dec 2018 04:11:00 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id bb53fb00 for ; Sat, 22 Dec 2018 12:10:58 +0000 (UTC) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v2 1/3] notmuch: Include the format parameter of text/plain parts Date: Sat, 22 Dec 2018 12:10:56 +0000 Message-Id: <20181222121058.5892-2-dme@dme.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181222121058.5892-1-dme@dme.org> References: <20181222121058.5892-1-dme@dme.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Sat, 22 Dec 2018 12:11:04 -0000 During formatted output, if a content type of a text/plain part has a "format" paramter, include it in the output. --- devel/schemata | 2 ++ notmuch-show.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/devel/schemata b/devel/schemata index 42b1bcf3..194933d4 100644 --- a/devel/schemata +++ b/devel/schemata @@ -93,6 +93,8 @@ part = { # otherwise (leaf parts): filename?: string, content-charset?: string, + # if content-type is "text/plain" and a "format" parameter exists: + format?: string, # A leaf part's body content is optional, but may be included if # it can be correctly encoded as a string. Consumers should use # this in preference to fetching the part content separately. diff --git a/notmuch-show.c b/notmuch-show.c index 07e9a5db..92d18bb8 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -708,6 +708,19 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, } if (GMIME_IS_PART (node->part)) { + /* Include the format parameter of text/plain parts if it + * exists, allowing the UI to adapt the display of the part as + * appropriate. + */ + if (g_mime_content_type_is_type (content_type, "text", "plain")) { + const char *format = + g_mime_object_get_content_type_parameter (node->part, "format"); + if (format) { + sp->map_key (sp, "format"); + sp->string (sp, format); + } + } + /* For non-HTML text parts, we include the content in the * JSON. Since JSON must be Unicode, we handle charset * decoding here and do not report a charset to the caller. -- 2.11.0