Patch: set the default content disposition of parts of a multipart/related as inline



	Hi,

	This patch sets the default content disposition of parts inside a
multipart/related to inline (for the parts that didn't get a disposition
before).

	This should improve the behavior of tny_mime_part_is_attachment as it
will detect more "real" inline attachments.
-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/tny-camel-mime-part.c
===================================================================
--- libtinymail-camel/tny-camel-mime-part.c	(revision 2427)
+++ libtinymail-camel/tny-camel-mime-part.c	(working copy)
@@ -113,6 +113,8 @@
 {
 	TnyCamelMimePartPriv *priv = TNY_CAMEL_MIME_PART_GET_PRIVATE (self);
 	CamelDataWrapper *containee;
+	gboolean is_related = FALSE;
+	CamelContentType *content_type = NULL;
 
 	g_assert (TNY_IS_LIST (list));
 
@@ -125,6 +127,14 @@
 		return;
 	}
 
+	content_type = camel_mime_part_get_content_type (priv->part);
+	if (content_type != NULL) {
+		if ((strcmp (content_type->type, "multipart")==0) &&
+		    (strcmp (content_type->subtype, "related") == 0)) {
+			is_related = TRUE;
+		}
+	}
+
 	if (CAMEL_IS_MULTIPART (containee))
 	{
 		guint i, parts = camel_multipart_get_number (CAMEL_MULTIPART (containee));
@@ -151,8 +161,12 @@
 					g_object_unref (G_OBJECT (nheader));
 				}
 
-			} else
+			} else {
 				newpart = tny_camel_mime_part_new_with_part (tpart);
+				if (is_related && (camel_mime_part_get_disposition (tpart) == NULL)) {
+					camel_mime_part_set_disposition (tpart, "inline");
+				}
+			}
 
 			tny_list_prepend (list, G_OBJECT (newpart));
 			g_object_unref (G_OBJECT (newpart));
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2427)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2007-07-09  Jose Dapena Paz  <jdapena igalia com>
+
+	* tny-camel-mime-part.c:
+	(tny_camel_mime_part_get_parts): now, if the mime part is a
+	multipart/related, it sets the content disposition of the children
+	to inline for parts that didn't get a disposition before. This
+	should improve handling of inline attached images.
+
 2007-07-09  Philip Van Hoof  <pvanhoof gnome org>
 
 	* Improvement for tny_camel_mime_part_is_attachment_default


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]