+ if (node->envelope_file) {
+ notmuch_message_t *message = node->envelope_file;
+
+ part_type = "message";
+ g_mime_stream_printf (stream, "\f%s{ id:%s depth:%d match:%d excluded:%d filename:%s\n",
+ part_type,
+ notmuch_message_get_message_id (message),
+ indent,
+ notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,
+ notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,
+ notmuch_message_get_filename (message));
+ } else {
+ char *content_string;
+ const char *disposition = _get_disposition (meta);
+ const char *cid = g_mime_object_get_content_id (meta);
+ const char *filename = leaf ?
+ g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;
+
+ if (disposition &&
+ strcasecmp (disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+ part_type = "attachment";
+ else
+ part_type = "part";
+
+ g_mime_stream_printf (stream, "\f%s{ ID: %d", part_type, node->part_num);
+ if (filename)
+ g_mime_stream_printf (stream, ", Filename: %s", filename);
+ if (cid)
+ g_mime_stream_printf (stream, ", Content-id: %s", cid);
+
+ content_string = g_mime_content_type_to_string (content_type);
+ g_mime_stream_printf (stream, ", Content-type: %s\n", content_string);
+ g_free (content_string);
+ }
+
+ if (GMIME_IS_MESSAGE (node->part)) {
+ GMimeMessage *message = GMIME_MESSAGE (node->part);
+ InternetAddressList *recipients;
+ char *recipients_string;
+ char *date_string;
+
+ g_mime_stream_printf (stream, "\fheader{\n");
+ if (node->envelope_file)
+ g_mime_stream_printf (stream, "%s\n", _get_one_line_summary (ctx, node->envelope_file));
+ g_mime_stream_printf (stream, "Subject: %s\n", g_mime_message_get_subject (message));
+ g_mime_stream_printf (stream, "From: %s\n", g_mime_message_get_sender (message));
+ recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
+ recipients_string = internet_address_list_to_string (recipients, 0);
+ if (recipients_string)
+ g_mime_stream_printf (stream, "To: %s\n", recipients_string);
+ g_free (recipients_string);
+ recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
+ recipients_string = internet_address_list_to_string (recipients, 0);
+ if (recipients_string)
+ g_mime_stream_printf (stream, "Cc: %s\n", recipients_string);
+ g_free (recipients_string);
+ date_string = g_mime_message_get_date_as_string (message);
+ g_mime_stream_printf (stream, "Date: %s\n", date_string);
+ g_free (date_string);
+ g_mime_stream_printf (stream, "\fheader}\n");
+
+ g_mime_stream_printf (stream, "\fbody{\n");
+ }