diff --git a/lib/mu-msg-part.c b/lib/mu-msg-part.c index 08782433..b6bbffc3 100644 --- a/lib/mu-msg-part.c +++ b/lib/mu-msg-part.c @@ -322,6 +322,15 @@ mu_msg_part_get_filename (MuMsgPart *mpart, gboolean construct_if_needed) mpart->index, construct_if_needed); } +const gchar* +mu_msg_part_get_content_id (MuMsgPart *mpart) +{ + g_return_val_if_fail (mpart, NULL); + g_return_val_if_fail (GMIME_IS_OBJECT(mpart->data), NULL); + return g_mime_object_get_content_id((GMimeObject*)mpart->data); +} + + static MuMsgPartType get_disposition (GMimeObject *mobj) diff --git a/lib/mu-msg-part.h b/lib/mu-msg-part.h index 5dd82a16..23bfaac8 100644 --- a/lib/mu-msg-part.h +++ b/lib/mu-msg-part.h @@ -114,6 +114,17 @@ char *mu_msg_part_get_filename (MuMsgPart *mpart, gboolean construct_if_needed) G_GNUC_WARN_UNUSED_RESULT; +/** + * get appropriate content id for the mime-part + * + * @param mpart a MuMsgPart + * + * @return const content id + */ +const gchar* +mu_msg_part_get_content_id (MuMsgPart *mpart) + G_GNUC_WARN_UNUSED_RESULT; + /** * get the text in the MuMsgPart (ie. in its GMimePart) * diff --git a/lib/mu-msg-sexp.c b/lib/mu-msg-sexp.c index a5629c50..a3740cdd 100644 --- a/lib/mu-msg-sexp.c +++ b/lib/mu-msg-sexp.c @@ -354,16 +354,17 @@ static void each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) { char *name, *tmp, *parttype; - char *tmpfile; + char *tmpfile, *cid; name = mu_msg_part_get_filename (part, TRUE); tmpfile = get_temp_file_maybe (msg, part, pinfo->opts); parttype = get_part_type_string (part->part_type); + cid = mu_str_escape_c_literal(mu_msg_part_get_content_id(part), TRUE); tmp = g_strdup_printf ("%s(:index %d :name \"%s\" :mime-type \"%s/%s\"%s%s " ":type %s " - ":attachment %s :size %i %s %s)", + ":attachment %s %s%s :size %i %s %s)", pinfo->parts ? pinfo->parts: "", part->index, name ? mu_str_escape_c_literal(name, FALSE) : "noname", @@ -372,6 +373,7 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) tmpfile ? " :temp" : "", tmpfile ? tmpfile : "", parttype, mu_msg_part_maybe_attachment (part) ? "t" : "nil", + cid ? " :cid" : "", cid ? cid : "", (int)part->size, sig_verdict (part), dec_verdict (part)); @@ -379,6 +381,7 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) g_free (name); g_free (tmpfile); g_free (parttype); + g_free (cid); g_free (pinfo->parts); pinfo->parts = tmp;