Do ignore empty recipients when checking names
[modest] / src / modest-tny-mime-part.c
index 766a1c6..e567b14 100644 (file)
@@ -142,16 +142,20 @@ gboolean
 modest_tny_mime_part_is_msg (TnyMimePart *part)
 {
        const gchar *content_type;
+       gchar *down_content_type;
 
        if (!TNY_IS_MSG (part))
                return FALSE;
 
        content_type = tny_mime_part_get_content_type (part);
-       if ((g_str_has_prefix (content_type, "message/rfc822") ||
-            g_str_has_prefix (content_type, "multipart/") ||
-            g_str_has_prefix (content_type, "text/"))) {
+       down_content_type = g_ascii_strdown (content_type, -1);
+       if ((g_str_has_prefix (down_content_type, "message/rfc822") ||
+            g_str_has_prefix (down_content_type, "multipart/") ||
+            g_str_has_prefix (down_content_type, "text/"))) {
+               g_free (down_content_type);
                return TRUE;
        } else {
+               g_free (down_content_type);
                return FALSE;
        }
 }
@@ -217,8 +221,9 @@ modest_tny_mime_part_get_headers_content_type (TnyMimePart *part)
 
        header_content_type = modest_tny_mime_part_get_header_value (part, "Content-Type");
 
+       /* See RFC2045 sec 5.2 */
        if (!header_content_type)
-               return NULL;
+               return g_strdup ("text/plain; charset=us-ascii");
 
        header_content_type = g_strstrip (header_content_type);