[evolution-data-server] Index files on Maildir accounts are not updated



commit 05fe41d118798fc7e12bfe5b1671a004ca0da320
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 24 19:45:42 2009 +0200

    Index files on Maildir accounts are not updated
    
    	** Fix for bug #571206
    
    	The above and couple compiler warning fixes.
---
 camel/ChangeLog                               |   13 +++++++++++++
 camel/camel-folder-summary.c                  |    1 -
 camel/camel-folder-summary.h                  |    1 -
 camel/camel-vee-folder.c                      |    4 ++--
 camel/camel-vee-summary.c                     |    8 ++++++--
 camel/providers/local/ChangeLog               |   17 +++++++++++++++++
 camel/providers/local/camel-local-summary.c   |    4 ++--
 camel/providers/local/camel-local-summary.h   |    2 +-
 camel/providers/local/camel-maildir-store.c   |    2 +-
 camel/providers/local/camel-maildir-summary.c |    8 ++++++--
 camel/providers/local/camel-mh-store.c        |    2 +-
 camel/providers/local/camel-spool-summary.c   |    4 ++--
 12 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/camel/ChangeLog b/camel/ChangeLog
index fac7113..90c30d6 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,16 @@
+2009-04-24  Milan Crha  <mcrha redhat com>
+
+	** Part of fix for bug #571206
+
+	* camel-vee-folder.c: (camel_vee_folder_add_folder), (vee_sync):
+	* camel-vee-summary.c: (camel_vee_summary_load_check_unread_vfolder),
+	(vee_info_set_flags):
+	* camel-folder-summary.c: (camel_folder_summary_class_init):
+	Various compiler warning cleanup.
+
+	* camel-folder-summary.h: (camel_folder_summary_reload_from_db):
+	Function prototype double-declared.
+
 2009-04-24  Sergio Villar Senin  <svillar igalia com>
 
 	** Fix for bug #578822 - fixed potential invalid dereference
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index d947aca..eda5713 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -4866,7 +4866,6 @@ camel_message_info_dump (CamelMessageInfo *mi)
 static void
 camel_folder_summary_class_init (CamelFolderSummaryClass *klass)
 {
-	CamelObjectClass *camel_object_class = CAMEL_OBJECT_CLASS (klass);
 	camel_folder_summary_parent = camel_type_get_global_classfuncs (camel_object_get_type ());
 
 	klass->summary_header_load = summary_header_load;
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index c553971..dac18f1 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -394,7 +394,6 @@ void camel_folder_summary_remove_range(CamelFolderSummary *summary, int start, i
 void camel_folder_summary_clear(CamelFolderSummary *summary);
 void camel_folder_summary_clear_db (CamelFolderSummary *s);
 
-int camel_folder_summary_reload_from_db (CamelFolderSummary *s, CamelException *ex);
 int camel_folder_summary_cache_size (CamelFolderSummary *s);
 
 /* lookup functions */
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 611cfb2..5d8ba71 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -177,7 +177,7 @@ void
 camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
 {
 	struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
-	int i, cache;
+	int i;
 	CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
 	
 	if (vf == (CamelVeeFolder *)sub) {
@@ -618,7 +618,7 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
 		GSList *del = NULL;
 
 		for (i=0; i < count; i++) {
-			CamelVeeMessageInfo *mi = camel_folder_summary_index (folder->summary, i);
+			CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index (folder->summary, i);
 			if (mi->old_flags & CAMEL_MESSAGE_DELETED) {
 				del = g_slist_prepend (del, (gpointer) camel_pstring_strdup(((CamelMessageInfo *)mi)->uid));
 				camel_folder_summary_remove_index_fast (folder->summary, i);
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index 6e2d7df..4260380 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -178,7 +178,11 @@ camel_vee_summary_load_check_unread_vfolder (CamelVeeSummary *vs)
 	static char *exp = NULL;
 	char *meta;
 	gboolean hacked_unread_folder = FALSE;
-	CamelVeeFolder *vf = (CamelVeeFolder *) ((CamelFolderSummary *)vs)->folder;
+	CamelVeeFolder *vf;
+
+	g_return_if_fail (vs != NULL);
+
+	vf = (CamelVeeFolder *) ((CamelFolderSummary *)vs)->folder;
 
 	/* HACK: Ugliest of all hacks. Its virtually not possible now
 	 * to maintain counts and the non matching uids of unread vfolder here.
@@ -216,7 +220,7 @@ vee_info_set_flags(CamelMessageInfo *mi, guint32 flags, guint32 set)
 		printf("Expression for vfolder '%s' is '%s'\n", mi->summary->folder->full_name, g_strescape(vf->expression, ""));
 
 	if (vf->priv->unread_vfolder == -1)
-		camel_vee_summary_load_check_unread_vfolder (mi->summary);
+		camel_vee_summary_load_check_unread_vfolder (CAMEL_VEE_SUMMARY (mi->summary));
 
 	if (vf->priv->unread_vfolder == 1)
 		hacked_unread_folder = TRUE;
diff --git a/camel/providers/local/ChangeLog b/camel/providers/local/ChangeLog
index 98cb0ff..8da29ab 100644
--- a/camel/providers/local/ChangeLog
+++ b/camel/providers/local/ChangeLog
@@ -1,3 +1,20 @@
+2009-04-24  Milan Crha  <mcrha redhat com>
+
+	** Fix for bug #571206
+
+	* camel-maildir-summary.c: (message_info_new_from_header):
+	Peek info from summary.
+	* camel-maildir-summary.c: (maildir_summary_check),
+	Reload summary from db if necessary.
+	* camel-maildir-store.c: (fill_fi):
+	* camel-mh-store.c: (fill_fi):
+	Use 'camel_folder_summary_header_load_from_db'.
+
+	* camel-local-summary.h: (struct _CamelLocalSummaryClass):
+	* camel-local-summary.c: (local_summary_need_index):
+	* camel-spool-summary.c: (spool_summary_need_index):
+	Declare function prototype properly.
+
 2009-04-24  Sergio Villar Senin  <svillar igalia com>
 
 	** Fixes bug #573183
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index ff4fba7..bac8c49 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -65,7 +65,7 @@ static int local_summary_load(CamelLocalSummary *cls, int forceindex, CamelExcep
 static int local_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
 static int local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
 static CamelMessageInfo *local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const CamelMessageInfo *info, CamelFolderChangeInfo *, CamelException *ex);
-static int local_summary_need_index();
+static int local_summary_need_index(void);
 
 static void camel_local_summary_class_init (CamelLocalSummaryClass *klass);
 static void camel_local_summary_init       (CamelLocalSummary *obj);
@@ -425,7 +425,7 @@ local_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeIn
 }
 
 static int
-local_summary_need_index() {
+local_summary_need_index(void) {
 	return 1;
 }
 
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index a837aec..e7dcb4e 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -70,7 +70,7 @@ struct _CamelLocalSummaryClass {
 
 	char *(*encode_x_evolution)(CamelLocalSummary *cls, const CamelLocalMessageInfo *info);
 	int (*decode_x_evolution)(CamelLocalSummary *cls, const char *xev, CamelLocalMessageInfo *info);
-	int (*need_index)();
+	int (*need_index)(void);
 };
 
 CamelType	camel_local_summary_get_type	(void);
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 566b3b5..3851dfd 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -322,7 +322,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
 		path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name);
 		folderpath = g_strdup_printf("%s/%s", root, fi->full_name);
 		s = (CamelFolderSummary *)camel_maildir_summary_new(NULL, path, folderpath, NULL);
-		if (camel_folder_summary_header_load(s) != -1) {
+		if (camel_folder_summary_header_load_from_db (s, store, fi->full_name, NULL) != -1) {
 			fi->unread = s->unread_count;
 			fi->total = s->saved_count;
 		}
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 7928062..c4b5e93 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -294,7 +294,7 @@ static CamelMessageInfo *message_info_new_from_header(CamelFolderSummary * s, st
 			mdi->info.info.uid = camel_pstring_add (camel_folder_summary_next_uid_string(s), TRUE);
 
 		/* handle 'duplicates' */
-		info = camel_folder_summary_uid(s, uid);
+		info = camel_folder_summary_peek_info (s, uid);
 		if (info) {
 			d(printf("already seen uid '%s', just summarising instead\n", uid));
 			camel_message_info_free(mi);
@@ -566,7 +566,11 @@ maildir_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Ca
 
 	/* keeps track of all uid's that have not been processed */
 	left = g_hash_table_new(g_str_hash, g_str_equal);
-	count = camel_folder_summary_count((CamelFolderSummary *)cls);
+	count = camel_folder_summary_count (s);
+	if (count != camel_folder_summary_cache_size (s)) {
+		camel_folder_summary_reload_from_db (s, ex);
+		count = camel_folder_summary_count (s);
+	}
 	forceindex = count == 0;
 	for (i=0;i<count;i++) {
 		info = camel_folder_summary_index((CamelFolderSummary *)cls, i);
diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c
index 71b7c05..d6bf5c6 100644
--- a/camel/providers/local/camel-mh-store.c
+++ b/camel/providers/local/camel-mh-store.c
@@ -336,7 +336,7 @@ fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
 		path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name);
 		folderpath = g_strdup_printf("%s/%s", root, fi->full_name);
 		s = (CamelFolderSummary *)camel_mh_summary_new(NULL, path, folderpath, NULL);
-		if (camel_folder_summary_header_load(s) != -1) {
+		if (camel_folder_summary_header_load_from_db (s, store, fi->full_name, NULL) != -1) {
 			fi->unread = s->unread_count;
 			fi->total = s->saved_count;
 		}
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index 604f923..4ff0a19 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -52,7 +52,7 @@ static int spool_summary_load(CamelLocalSummary *cls, int forceindex, CamelExcep
 static int spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, CamelException *ex);
 
 static int spool_summary_sync_full(CamelMboxSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, CamelException *ex);
-static int spool_summary_need_index();
+static int spool_summary_need_index(void);
 
 static void camel_spool_summary_class_init (CamelSpoolSummaryClass *klass);
 static void camel_spool_summary_init       (CamelSpoolSummary *obj);
@@ -346,6 +346,6 @@ spool_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, C
 }
 
 static int
-spool_summary_need_index() {
+spool_summary_need_index(void) {
 	return 0;
 }



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