]> git.notmuchmail.org Git - notmuch/commitdiff
notmuch: Add the content-id of a part to the JSON output if it is known.
authorDavid Edmondson <dme@dme.org>
Mon, 17 May 2010 12:38:06 +0000 (13:38 +0100)
committerCarl Worth <cworth@cworth.org>
Wed, 18 May 2011 22:51:46 +0000 (15:51 -0700)
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>
notmuch-show.c

index 8f485eff7248f076de99228946f57ec3f16e81ea..7220dd973803a624e12eb978a9b013c79fbe59ff 100644 (file)
@@ -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)