mirror of https://github.com/djcb/mu.git
* mu4e/mu-msg-part: better detection of body / attachments
This commit is contained in:
parent
99778d1314
commit
b71a27b7c0
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue