[evolution-data-server] Bug #640696 - Hidden new messages in On This Computer/Inbox



commit 1b3606a6c83254ecd2dbe9b6eb8013690c4e4bd3
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 3 13:13:52 2011 +0100

    Bug #640696 - Hidden new messages in On This Computer/Inbox

 camel/camel-folder-summary.c                |   59 ++++++++++++++-------------
 camel/providers/local/camel-local-summary.c |    3 +-
 2 files changed, 32 insertions(+), 30 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index c09ce55..b77c260 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -1253,7 +1253,6 @@ message_info_from_uid (CamelFolderSummary *s, const gchar *uid)
 		struct _db_pass_data data;
 
 		d(printf ("\ncamel_folder_summary_uid called \n"));
-		s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
 		folder_name = camel_folder_get_full_name (s->folder);
 		parent_store = camel_folder_get_parent_store (s->folder);
@@ -1804,9 +1803,10 @@ camel_folder_summary_load_from_db (CamelFolderSummary *s,
 	gint ret = 0;
 	GError *local_error = NULL;
 
+	camel_folder_summary_save_to_db (s, NULL);
+
 	/* struct _db_pass_data data; */
 	d(printf ("\ncamel_folder_summary_load_from_db called \n"));
-	s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
 	full_name = camel_folder_get_full_name (s->folder);
 	parent_store = camel_folder_get_parent_store (s->folder);
@@ -2208,6 +2208,9 @@ camel_folder_summary_save_to_db (CamelFolderSummary *s,
 	CamelFIRecord *record;
 	gint ret, count;
 
+	if (!(s->flags & CAMEL_SUMMARY_DIRTY))
+		return 0;
+
 	parent_store = camel_folder_get_parent_store (s->folder);
 	cdb = parent_store->cdb_w;
 
@@ -2221,9 +2224,6 @@ camel_folder_summary_save_to_db (CamelFolderSummary *s,
 		camel_db_end_transaction (parent_store->cdb_w, NULL);
 	}
 
-	if (!(s->flags & CAMEL_SUMMARY_DIRTY))
-		return 0;
-
 	s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
 	count = cfs_count_dirty (s);
@@ -2343,7 +2343,8 @@ camel_folder_summary_header_load_from_db (CamelFolderSummary *s,
 	gint ret = 0;
 
 	d(printf ("\ncamel_folder_summary_load_from_db called \n"));
-	s->flags &= ~CAMEL_SUMMARY_DIRTY;
+
+	camel_folder_summary_save_to_db (s, NULL);
 
 	cdb = store->cdb_r;
 
@@ -2983,30 +2984,30 @@ camel_folder_summary_remove_uid (CamelFolderSummary *s, const gchar *uid)
 void
 camel_folder_summary_remove_uid_fast (CamelFolderSummary *s, const gchar *uid)
 {
-		CamelMessageInfo *oldinfo;
-		gchar *olduid;
+	CamelMessageInfo *oldinfo;
+	gchar *olduid;
 
-		camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-		camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
-		if (g_hash_table_lookup_extended (s->loaded_infos, uid, (gpointer)&olduid, (gpointer)&oldinfo)) {
-				/* make sure it doesn't vanish while we're removing it */
-				camel_message_info_ref (oldinfo);
-				camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
-				g_hash_table_remove (s->loaded_infos, olduid);
-				summary_remove_uid (s, olduid);
-				s->flags |= CAMEL_SUMMARY_DIRTY;
-				s->meta_summary->msg_expunged = TRUE;
-				camel_message_info_free (oldinfo);
-				camel_message_info_free (oldinfo);
-				camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-		} else {
-				gchar *tmpid = g_strdup (uid);
-				/* Info isn't loaded into the memory. We must just remove the UID*/
-				summary_remove_uid (s, uid);
-				camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
-				camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-				g_free (tmpid);
-		}
+	camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+	camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
+	if (g_hash_table_lookup_extended (s->loaded_infos, uid, (gpointer)&olduid, (gpointer)&oldinfo)) {
+		/* make sure it doesn't vanish while we're removing it */
+		camel_message_info_ref (oldinfo);
+		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
+		g_hash_table_remove (s->loaded_infos, olduid);
+		summary_remove_uid (s, olduid);
+		s->flags |= CAMEL_SUMMARY_DIRTY;
+		s->meta_summary->msg_expunged = TRUE;
+		camel_message_info_free (oldinfo);
+		camel_message_info_free (oldinfo);
+		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+	} else {
+		gchar *tmpid = g_strdup (uid);
+		/* Info isn't loaded into the memory. We must just remove the UID*/
+		summary_remove_uid (s, uid);
+		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_REF_LOCK);
+		camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+		g_free (tmpid);
+	}
 }
 
 /**
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 63d5b47..7b67584 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -536,7 +536,7 @@ local_summary_add (CamelLocalSummary *cls,
 			g_object_unref (sn);
 		}
 
-		mi->info.flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_FLAGGED);
+		mi->info.flags &= ~(CAMEL_MESSAGE_FOLDER_NOXEV);
 		xev = camel_local_summary_encode_x_evolution (cls, mi);
 		camel_medium_set_header((CamelMedium *)msg, "X-Evolution", xev);
 		g_free (xev);
@@ -752,6 +752,7 @@ message_info_new_from_header (CamelFolderSummary *s, struct _camel_header_raw *h
 		if (xev==NULL || camel_local_summary_decode_x_evolution (cls, xev, mi) == -1) {
 			/* to indicate it has no xev header */
 			mi->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
+			mi->info.dirty = TRUE;
 			camel_pstring_free (mi->info.uid);
 			mi->info.uid = camel_pstring_add (camel_folder_summary_next_uid_string (s), TRUE);
 



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