Patch: fix pop3 attachment heuristics



	Hi,

	This patch fixes a somehow trivial error in pop3 attachment heuristics.
With the current code it seems they never play as the if (mi) is always
false because mi is NULL. That condition seems to be wrong.

Changelog entry would be:
* libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c:
	* Fix attachment heuristics.

-- 
José 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 3665)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-folder.c	(working copy)
@@ -386,26 +386,24 @@
 			if (msg)
 			{
 
-				if (mi) {
-					struct _camel_header_raw *h;
+				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)) {
 					
-					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);
-					}
+					((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);
 				}
 
 


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