mirror of https://github.com/djcb/mu.git
* mu-msg.c: improve attachment detection
This commit is contained in:
parent
4019965d8e
commit
de77c4b5ad
32
src/mu-msg.c
32
src/mu-msg.c
|
@ -278,31 +278,32 @@ static gboolean
|
||||||
part_is_inline (GMimeObject *part)
|
part_is_inline (GMimeObject *part)
|
||||||
{
|
{
|
||||||
GMimeContentDisposition *disp;
|
GMimeContentDisposition *disp;
|
||||||
gboolean result;
|
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
g_return_val_if_fail (GMIME_IS_PART(part), FALSE);
|
|
||||||
|
|
||||||
disp = g_mime_object_get_content_disposition (part);
|
disp = g_mime_object_get_content_disposition (part);
|
||||||
if (!GMIME_IS_CONTENT_DISPOSITION(disp))
|
if (!GMIME_IS_CONTENT_DISPOSITION(disp))
|
||||||
return FALSE;
|
return TRUE;
|
||||||
|
|
||||||
str = g_mime_content_disposition_get_disposition (disp);
|
str = g_mime_content_disposition_get_disposition (disp);
|
||||||
|
|
||||||
/* if it's not inline, it's an attachment */
|
if (str && (strcmp (str, GMIME_DISPOSITION_ATTACHMENT) == 0))
|
||||||
result = (str && (strcmp(str,GMIME_DISPOSITION_INLINE) == 0));
|
return FALSE;
|
||||||
|
|
||||||
return result;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
msg_cflags_cb (GMimeObject *parent, GMimeObject *part, MuMsgFlags *flags)
|
msg_cflags_cb (GMimeObject *parent, GMimeObject *part, MuMsgFlags *flags)
|
||||||
{
|
{
|
||||||
if (GMIME_IS_PART(part))
|
if (*flags & MU_MSG_FLAG_HAS_ATTACH)
|
||||||
if ((*flags & MU_MSG_FLAG_HAS_ATTACH) == 0)
|
return;
|
||||||
if (!part_is_inline(part))
|
|
||||||
*flags |= MU_MSG_FLAG_HAS_ATTACH;
|
if (!GMIME_IS_PART(part))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!part_is_inline(part))
|
||||||
|
*flags |= MU_MSG_FLAG_HAS_ATTACH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -311,12 +312,13 @@ static MuMsgFlags
|
||||||
get_content_flags (MuMsg *msg)
|
get_content_flags (MuMsg *msg)
|
||||||
{
|
{
|
||||||
GMimeContentType *ctype;
|
GMimeContentType *ctype;
|
||||||
MuMsgFlags flags = 0;
|
MuMsgFlags flags;
|
||||||
GMimeObject *part;
|
GMimeObject *part;
|
||||||
|
|
||||||
if (!GMIME_IS_MESSAGE(msg->_mime_msg))
|
if (!GMIME_IS_MESSAGE(msg->_mime_msg))
|
||||||
return MU_MSG_FLAG_NONE;
|
return MU_MSG_FLAG_NONE;
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
g_mime_message_foreach (msg->_mime_msg,
|
g_mime_message_foreach (msg->_mime_msg,
|
||||||
(GMimeObjectForeachFunc)msg_cflags_cb,
|
(GMimeObjectForeachFunc)msg_cflags_cb,
|
||||||
&flags);
|
&flags);
|
||||||
|
|
Loading…
Reference in New Issue