[evolution-data-server] Bug #604305 - Attachments not properly indicated in message summary



commit e37b27f80e5bf888a8dde81fa279fb249672f420
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 14 14:35:25 2009 +0100

    Bug #604305 -  Attachments not properly indicated in message summary

 camel/camel-mime-message.c |   15 ++++++++-------
 camel/camel-mime-part.c    |   19 ++++++++++++++++++-
 camel/camel-mime-part.h    |    1 +
 3 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 578bb6a..11005d9 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -1161,20 +1161,21 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
 static gboolean
 find_attachment (CamelMimeMessage *msg, CamelMimePart *part, gpointer data)
 {
-	const gchar *disp;
+	const CamelContentDisposition *cd;
 	gboolean *found = (gboolean *)data;
 
 	g_return_val_if_fail (part != NULL, FALSE);
 
-	disp = camel_mime_part_get_disposition (part);
+	cd = camel_mime_part_get_content_disposition (part);
 
-	if (disp) {
-		CamelContentDisposition *cd = camel_content_disposition_decode (disp);
+	if (cd) {
+		const struct _camel_header_param *param;
 
-		if (cd) {
-			*found = (cd->disposition && g_ascii_strcasecmp (cd->disposition, "attachment") == 0);
+		*found = (cd->disposition && g_ascii_strcasecmp (cd->disposition, "attachment") == 0);
 
-			camel_content_disposition_unref (cd);
+		for (param = cd->params; param && !(*found); param = param->next) {
+			if (param->name && param->value && *param->value && g_ascii_strcasecmp (param->name, "filename") == 0)
+				*found = TRUE;
 		}
 	}
 
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 51eba22..37f8522 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -435,7 +435,7 @@ camel_mime_part_set_disposition (CamelMimePart *mime_part, const gchar *disposit
  *
  * Get the disposition of the MIME part.
  *
- * Returns: the dispisition
+ * Returns: the disposition
  **/
 const gchar *
 camel_mime_part_get_disposition (CamelMimePart *mime_part)
@@ -446,6 +446,23 @@ camel_mime_part_get_disposition (CamelMimePart *mime_part)
 		return NULL;
 }
 
+/**
+ * camel_mime_part_get_content_disposition:
+ * @mime_part: a #CamelMimePart object
+ *
+ * Get the disposition of the MIME part as a structure.
+ * Returned pointer is owned by #mime_part.
+ *
+ * Returns: the disposition structure
+ **/
+const CamelContentDisposition *
+camel_mime_part_get_content_disposition (CamelMimePart *mime_part)
+{
+	g_return_val_if_fail (mime_part != NULL, NULL);
+
+	return mime_part->disposition;
+}
+
 /* **** Content-Disposition: filename="xxx" */
 
 /**
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index 0b92db9..379287b 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -72,6 +72,7 @@ const     gchar  *camel_mime_part_get_description	(CamelMimePart *mime_part);
 
 void		 camel_mime_part_set_disposition	(CamelMimePart *mime_part, const gchar *disposition);
 const     gchar  *camel_mime_part_get_disposition	(CamelMimePart *mime_part);
+const CamelContentDisposition *camel_mime_part_get_content_disposition (CamelMimePart *mime_part);
 
 void		 camel_mime_part_set_filename		(CamelMimePart *mime_part, const gchar *filename);
 const	  gchar  *camel_mime_part_get_filename		(CamelMimePart *mime_part);



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