[evolution-data-server] Bug #663062 - Missing attachment icon on a message with it



commit 0d8e32409d11fa1e6b7f68149b5cd428f8f9d99b
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 1 12:33:26 2011 +0100

    Bug #663062 - Missing attachment icon on a message with it

 camel/providers/imap/camel-imap-folder.c     |   13 +++----------
 camel/providers/local/camel-maildir-folder.c |    9 ++++++---
 camel/providers/local/camel-mbox-folder.c    |    8 ++++++--
 camel/providers/local/camel-mh-folder.c      |    8 ++++++--
 4 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index ac48311..77faa64 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -3629,16 +3629,9 @@ done:
 		}
 
 		has_attachment = camel_mime_message_has_attachment (msg);
-		if (((mi->info.flags & CAMEL_MESSAGE_ATTACHMENTS) && !has_attachment) ||
-		    ((mi->info.flags & CAMEL_MESSAGE_ATTACHMENTS) == 0 && has_attachment)) {
-			if (has_attachment)
-				mi->info.flags = mi->info.flags | CAMEL_MESSAGE_ATTACHMENTS;
-			else
-				mi->info.flags = mi->info.flags & ~CAMEL_MESSAGE_ATTACHMENTS;
-			mi->info.dirty = TRUE;
-
-			if (mi->info.summary)
-				camel_folder_summary_touch (mi->info.summary);
+		if (((camel_message_info_flags ((CamelMessageInfo *) mi) & CAMEL_MESSAGE_ATTACHMENTS) && !has_attachment) ||
+		    ((camel_message_info_flags ((CamelMessageInfo *) mi) & CAMEL_MESSAGE_ATTACHMENTS) == 0 && has_attachment)) {
+			camel_message_info_set_flags ((CamelMessageInfo *) mi, CAMEL_MESSAGE_ATTACHMENTS, has_attachment ? CAMEL_MESSAGE_ATTACHMENTS : 0);
 		}
 	}
 
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index 7483546..cc8ef57 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -158,7 +158,7 @@ maildir_folder_append_message_sync (CamelFolder *folder,
 	CamelMessageInfo *mi;
 	CamelMaildirMessageInfo *mdi;
 	gchar *name, *dest = NULL;
-	gboolean success = TRUE;
+	gboolean success = TRUE, has_attachment;
 
 	d(printf("Appending message\n"));
 
@@ -173,8 +173,11 @@ maildir_folder_append_message_sync (CamelFolder *folder,
 	if (mi == NULL)
 		goto check_changed;
 
-	if ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !camel_mime_message_has_attachment (message))
-		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, 0);
+	has_attachment = camel_mime_message_has_attachment (message);
+	if (((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !has_attachment) ||
+	    ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) == 0 && has_attachment)) {
+		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, has_attachment ? CAMEL_MESSAGE_ATTACHMENTS : 0);
+	}
 
 	mdi = (CamelMaildirMessageInfo *) mi;
 
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index c5d3725..c52d30a 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -151,6 +151,7 @@ mbox_folder_append_message_sync (CamelFolder *folder,
 	gchar *fromline = NULL;
 	struct stat st;
 	gint retval;
+	gboolean has_attachment;
 #if 0
 	gchar *xev;
 #endif
@@ -172,8 +173,11 @@ mbox_folder_append_message_sync (CamelFolder *folder,
 
 	d(printf("Appending message: uid is %s\n", camel_message_info_uid(mi)));
 
-	if ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !camel_mime_message_has_attachment (message))
-		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, 0);
+	has_attachment = camel_mime_message_has_attachment (message);
+	if (((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !has_attachment) ||
+	    ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) == 0 && has_attachment)) {
+		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, has_attachment ? CAMEL_MESSAGE_ATTACHMENTS : 0);
+	}
 
 	output_stream = camel_stream_fs_new_with_name (
 		lf->folder_path, O_WRONLY | O_APPEND |
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index b99f283..a006100 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -64,6 +64,7 @@ mh_folder_append_message_sync (CamelFolder *folder,
 	CamelStream *output_stream;
 	CamelMessageInfo *mi;
 	gchar *name;
+	gboolean has_attachment;
 
 	/* FIXME: probably needs additional locking (although mh doesn't appear do do it) */
 
@@ -78,8 +79,11 @@ mh_folder_append_message_sync (CamelFolder *folder,
 	if (mi == NULL)
 		goto check_changed;
 
-	if ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !camel_mime_message_has_attachment (message))
-		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, 0);
+	has_attachment = camel_mime_message_has_attachment (message);
+	if (((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) && !has_attachment) ||
+	    ((camel_message_info_flags (mi) & CAMEL_MESSAGE_ATTACHMENTS) == 0 && has_attachment)) {
+		camel_message_info_set_flags (mi, CAMEL_MESSAGE_ATTACHMENTS, has_attachment ? CAMEL_MESSAGE_ATTACHMENTS : 0);
+	}
 
 	d(printf("Appending message: uid is %s\n", camel_message_info_uid(mi)));
 



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