* mu4e/mu-msg-part: better detection of body / attachments
This commit is contained in:
@ -362,6 +362,20 @@ handle_encrypted_part (MuMsg *msg,
|
|||||||
return TRUE;
|
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 */
|
/* call 'func' with information about this MIME-part */
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_part (MuMsg *msg, GMimePart *part, GMimeObject *parent,
|
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);
|
msgpart.part_type |= get_disposition ((GMimeObject*)part);
|
||||||
|
|
||||||
/* a top-level non-attachment text part is probably a body */
|
/* a top-level non-attachment text part is probably a body */
|
||||||
if ((!parent || GMIME_IS_MESSAGE(parent)) &&
|
if (looks_like_body (parent, &msgpart))
|
||||||
((msgpart.part_type & MU_MSG_PART_TYPE_ATTACHMENT) == 0) &&
|
|
||||||
g_strcmp0 (msgpart.type, "text") == 0)
|
|
||||||
msgpart.part_type |= MU_MSG_PART_TYPE_BODY;
|
msgpart.part_type |= MU_MSG_PART_TYPE_BODY;
|
||||||
|
|
||||||
msgpart.data = (gpointer)part;
|
msgpart.data = (gpointer)part;
|
||||||
|
|||||||
@ -378,7 +378,8 @@ is nil, and otherwise open it."
|
|||||||
;; numbers and the part indices
|
;; numbers and the part indices
|
||||||
(remove-if
|
(remove-if
|
||||||
(lambda (part)
|
(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)))
|
(plist-get msg :parts)))
|
||||||
(attstr
|
(attstr
|
||||||
(mapconcat
|
(mapconcat
|
||||||
|
|||||||
Reference in New Issue
Block a user