* lib: refactor attachment checking

This commit is contained in:
djcb
2012-08-09 11:45:04 +03:00
parent ea86b71294
commit 51fe7fcae8
4 changed files with 31 additions and 187 deletions

View File

@ -821,12 +821,20 @@ mu_msg_find_files (MuMsg *msg, MuMsgOptions opts, const GRegex *pattern)
gboolean
mu_msg_part_looks_like_attachment (MuMsgPart *part, gboolean include_inline)
mu_msg_part_maybe_attachment (MuMsgPart *part)
{
g_return_val_if_fail (part, FALSE);
if (!include_inline && (part->part_type & MU_MSG_PART_TYPE_INLINE))
/* attachments must be leaf parts */
if (!part->part_type && MU_MSG_PART_TYPE_LEAF)
return FALSE;
return TRUE;
/* non-textual inline parts are considered attachments as
* well */
if (part->part_type & MU_MSG_PART_TYPE_INLINE &&
!(part->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN) &&
!(part->part_type & MU_MSG_PART_TYPE_TEXT_HTML))
return TRUE;
return FALSE;
}