(Patch) Better attachment detection in pop3 backend



	Hi,

	This patch is similar to the one for imap I sent some weeks ago. It
simply tries to track better the attachment flags also in pop3 backend.

Changelog entry:
* Respect better the attachment flag headers also in POP (equivalent
  to previous change in imap.

-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3539)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2008-04-02  Jose Dapena Paz  <jdapena igalia com>
+
+	* Respect better the attachment flag headers also in POP (equivalent
+	to previous change in imap.
+
 2008-04-02  Philip Van Hoof <pvanhoof gnome org>
 
 	* Added a name file, just like the url_string file, to each account
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(revision 3539)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(working copy)
@@ -385,17 +385,30 @@
 
 			if (msg)
 			{
-				mi = (CamelMessageInfoBase*) camel_folder_summary_uid (folder->summary, fi->uid);
+
 				if (mi) {
-				    mi->size = (fi->size);
-				   /* TNY TODO: This is a hack! But else we need to parse
-				    * BODYSTRUCTURE (and I'm lazy). It needs fixing though. */
-				    if (mi->size > 102400)
-					mi->flags |= CAMEL_MESSAGE_ATTACHMENTS;
-				    /* ... it does */
-				    camel_message_info_free (mi);
+					struct _camel_header_raw *h;
+					
+					h = ((CamelMimePart *)msg)->headers;
+					if (camel_header_raw_find(&h, "X-MSMail-Priority", NULL) &&
+					    !camel_header_raw_find(&h, "X-MS-Has-Attach", NULL)) {
+						
+						((CamelMessageInfoBase *)mi)->flags &= ~CAMEL_MESSAGE_ATTACHMENTS;
+
+					} else if (!camel_header_raw_find (&h, "X-MS-Has-Attach", NULL)) {
+						
+						mi = (CamelMessageInfoBase*) camel_folder_summary_uid (folder->summary, fi->uid);
+						mi->size = (fi->size);
+						/* TNY TODO: This is a hack! But else we need to parse
+						 * BODYSTRUCTURE (and I'm lazy). It needs fixing though. */
+						if (mi->size > 102400)
+							mi->flags |= CAMEL_MESSAGE_ATTACHMENTS;
+						/* ... it does */
+						camel_message_info_free (mi);
+					}
 				}
 
+
 				camel_object_unref (CAMEL_OBJECT (msg));
 
 				if (!changes)


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