diff options
author | David Edmondson <dme@dme.org> | 2010-05-17 13:38:06 +0100 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2011-05-18 15:51:46 -0700 |
commit | 97bc272b9ca88ebace722a1c06c656939f277e56 (patch) | |
tree | aa679ca318f4b4e0b82120cebc7871d16bd27c29 /notmuch-show.c | |
parent | 22443de7891ca54cc199c30bdaf2725395062462 (diff) |
notmuch: Add the content-id of a part to the JSON output if it is known.
It's simply one more property of a MIME part that might be useful, and
json makes it so easy to add additional properties.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
Diffstat (limited to 'notmuch-show.c')
-rw-r--r-- | notmuch-show.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/notmuch-show.c b/notmuch-show.c index 8f485eff..7220dd97 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -458,6 +458,7 @@ format_part_json (GMimeObject *part, int *part_count, int first) void *ctx = talloc_new (NULL); GMimeStream *stream_memory = g_mime_stream_mem_new (); GByteArray *part_content; + const char *cid; content_type = g_mime_object_get_content_type (GMIME_OBJECT (part)); @@ -468,6 +469,11 @@ format_part_json (GMimeObject *part, int *part_count, int first) *part_count, json_quote_str (ctx, g_mime_content_type_to_string (content_type))); + cid = g_mime_object_get_content_id (part); + if (cid != NULL) + printf(", \"content-id\": %s", + json_quote_str (ctx, cid)); + disposition = g_mime_object_get_content_disposition (part); if (disposition && strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) |