From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] cli/show: add content-disposition to structured output message parts
Date: Sat, 28 Jan 2017 14:21:30 +0200 [thread overview]
Message-ID: <20170128122130.2935-2-jani@nikula.org> (raw)
In-Reply-To: <20170128122130.2935-1-jani@nikula.org>
Help the clients decide how to display parts.
---
I'm not sure if this should bump the version in schemata, because the
comment in notmuch-client.h says new map fields can be added without
increasing NOTMUCH_FORMAT_CUR. Yet the schemata version history says
thread_summary.query was added in v2... which looks like a change that
shouldn't need a version bump. Confused.
The problem could be avoided by conflating both this change and
id:20170110201929.21875-1-jani@nikula.org into v3... ;)
---
devel/schemata | 1 +
notmuch-show.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/devel/schemata b/devel/schemata
index 41dc4a60fff3..c94459eb783a 100644
--- a/devel/schemata
+++ b/devel/schemata
@@ -76,6 +76,7 @@ part = {
sigstatus?: sigstatus,
content-type: string,
+ content-disposition?: string,
content-id?: string,
# if content-type starts with "multipart/":
content: [part*],
diff --git a/notmuch-show.c b/notmuch-show.c
index 8b38fe6db136..8e69b3465886 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -582,6 +582,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
GMimeObject *meta = node->envelope_part ?
GMIME_OBJECT (node->envelope_part) : node->part;
GMimeContentType *content_type = g_mime_object_get_content_type (meta);
+ const char *disposition = _get_disposition (meta);
const char *cid = g_mime_object_get_content_id (meta);
const char *filename = GMIME_IS_PART (node->part) ?
g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;
@@ -611,6 +612,11 @@ 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));
+ if (disposition) {
+ sp->map_key (sp, "content-disposition");
+ sp->string (sp, disposition);
+ }
+
if (cid) {
sp->map_key (sp, "content-id");
sp->string (sp, cid);
--
2.11.0
next prev parent reply other threads:[~2017-01-28 12:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-28 12:21 [PATCH 1/2] cli/show: abstract get content disposition Jani Nikula
2017-01-28 12:21 ` Jani Nikula [this message]
2017-01-29 11:56 ` [PATCH 2/2] cli/show: add content-disposition to structured output message parts Mark Walters
2017-01-29 12:00 ` [PATCH] test: fix tests for content-disposition Mark Walters
2017-02-26 11:54 ` David Bremner
2017-02-26 18:39 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170128122130.2935-2-jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).