diff --git a/lib/mu-msg-part.c b/lib/mu-msg-part.c index 4f53524c..451ec4d2 100644 --- a/lib/mu-msg-part.c +++ b/lib/mu-msg-part.c @@ -362,6 +362,20 @@ handle_encrypted_part (MuMsg *msg, return TRUE; } +static gboolean +looks_like_body (GMimeObject *parent, MuMsgPart *msgpart) +{ + if (parent && + !GMIME_IS_MESSAGE_PART(parent) && + !GMIME_IS_MULTIPART(parent)) + return FALSE; /* probably not a body */ + + if (g_strcmp0 (msgpart->type, "text") != 0) + return FALSE; /* probably not a body */ + + return TRUE; /* maybe a body part */ +} + /* call 'func' with information about this MIME-part */ static gboolean handle_part (MuMsg *msg, GMimePart *part, GMimeObject *parent, @@ -385,9 +399,7 @@ handle_part (MuMsg *msg, GMimePart *part, GMimeObject *parent, msgpart.part_type |= get_disposition ((GMimeObject*)part); /* a top-level non-attachment text part is probably a body */ - if ((!parent || GMIME_IS_MESSAGE(parent)) && - ((msgpart.part_type & MU_MSG_PART_TYPE_ATTACHMENT) == 0) && - g_strcmp0 (msgpart.type, "text") == 0) + if (looks_like_body (parent, &msgpart)) msgpart.part_type |= MU_MSG_PART_TYPE_BODY; msgpart.data = (gpointer)part; diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 07434d42..c4bcb7a4 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -378,7 +378,8 @@ is nil, and otherwise open it." ;; numbers and the part indices (remove-if (lambda (part) - (member 'inline (plist-get part :type))) + (or (member 'body (plist-get part :type)) + (member 'inline (plist-get part :type)))) (plist-get msg :parts))) (attstr (mapconcat