Patch: fix attachments detection heuristics in pop3 provider



	Hi,

	This patch is a fix for attachments detection heuristics in pop3
provider:
	* Now we detect attached messages
	* Instead of using name= string, we use filename=. This should avoid
false positives with html mime parts with meta name available.

-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(revision 2986)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(working copy)
@@ -767,9 +767,11 @@
 		/* heuristics */
 		if (camel_strstrcase (buffer, "Content-Disposition: attachment") != NULL)
 			fi->has_attachments = TRUE;
-
-		if (camel_strstrcase (buffer, "name=") != NULL && strchr (buffer, '.'))
+		else if (camel_strstrcase (buffer, "filename=") != NULL &&
+			 strchr (buffer, '.'))
 			fi->has_attachments = TRUE;
+		else if (camel_strstrcase (buffer, "Content-Type: message/rfc822") != NULL)
+			fi->has_attachments = TRUE;
 
 		w += n;
 		if (w > fi->size)
@@ -826,11 +828,12 @@
 		/* heuristics */
 		if (camel_strstrcase (buffer, "Content-Disposition: attachment") != NULL)
 			fi->has_attachments = TRUE;
-
-		if (camel_strstrcase (buffer, "name=") != NULL && strchr (buffer, '.'))
+		else if (camel_strstrcase (buffer, "filename=") != NULL &&
+			 strchr (buffer, '.'))
 			fi->has_attachments = TRUE;
+		else if (camel_strstrcase (buffer, "Content-Type: message/rfc822") != NULL)
+			fi->has_attachments = TRUE;
 
-
 		if (boundary == NULL)
 		{
 			   CamelContentType *ct = NULL;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2986)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-11-21  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c:
+	(cmd_tocache, cmd_tocache_partial). Modify the attachments detection
+	heuristics to avoid false positives on processing html messages with
+	meta name.
+
 2007-11-21  Sergio Villar Senin  <svillar igalia com>
 
 	* libtinymail-camel/tny-camel-account.c:


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