* mu-msg-gmime: bit of refactoring, to satisfy cc10
This commit is contained in:
@ -465,10 +465,31 @@ struct _GetBodyData {
|
|||||||
};
|
};
|
||||||
typedef struct _GetBodyData GetBodyData;
|
typedef struct _GetBodyData GetBodyData;
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_looks_like_attachment (GMimeObject *part)
|
||||||
|
{
|
||||||
|
const char *str;
|
||||||
|
GMimeContentDisposition *disp;
|
||||||
|
|
||||||
|
disp = g_mime_object_get_content_disposition (GMIME_OBJECT(part));
|
||||||
|
if (!GMIME_IS_CONTENT_DISPOSITION(disp))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
str = g_mime_content_disposition_get_disposition (disp);
|
||||||
|
if (!str)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (strcmp(str,GMIME_DISPOSITION_INLINE) == 0)
|
||||||
|
return FALSE; /* inline, so it's not an attachment */
|
||||||
|
|
||||||
|
return TRUE; /* looks like an attachment */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_body_cb (GMimeObject *parent, GMimeObject *part, GetBodyData *data)
|
get_body_cb (GMimeObject *parent, GMimeObject *part, GetBodyData *data)
|
||||||
{
|
{
|
||||||
GMimeContentDisposition *disp;
|
|
||||||
GMimeContentType *ct;
|
GMimeContentType *ct;
|
||||||
|
|
||||||
/* already found what we're looking for? */
|
/* already found what we're looking for? */
|
||||||
@ -482,14 +503,8 @@ get_body_cb (GMimeObject *parent, GMimeObject *part, GetBodyData *data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is it not an attachment? */
|
if (_looks_like_attachment (part))
|
||||||
disp = g_mime_object_get_content_disposition (GMIME_OBJECT(part));
|
return; /* not the body */
|
||||||
if (GMIME_IS_CONTENT_DISPOSITION(disp)) {
|
|
||||||
const char *str;
|
|
||||||
str = g_mime_content_disposition_get_disposition (disp);
|
|
||||||
if (str && (strcmp(str,GMIME_DISPOSITION_INLINE) != 0))
|
|
||||||
return; /* not inline, so it's not the body */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* is it right content type? */
|
/* is it right content type? */
|
||||||
if (g_mime_content_type_is_type (ct, "text", "plain"))
|
if (g_mime_content_type_is_type (ct, "text", "plain"))
|
||||||
|
|||||||
Reference in New Issue
Block a user