Index files on Maildir accounts are not updated
authorMilan Crha <mcrha@redhat.com>
Fri, 24 Apr 2009 17:45:42 +0000 (19:45 +0200)
committerMilan Crha <mcrha@redhat.com>
Fri, 24 Apr 2009 17:45:42 +0000 (19:45 +0200)
** Fix for bug #571206

The above and couple compiler warning fixes.

12 files changed:
camel/ChangeLog
camel/camel-folder-summary.c
camel/camel-folder-summary.h
camel/camel-vee-folder.c
camel/camel-vee-summary.c
camel/providers/local/ChangeLog
camel/providers/local/camel-local-summary.c
camel/providers/local/camel-local-summary.h
camel/providers/local/camel-maildir-store.c
camel/providers/local/camel-maildir-summary.c
camel/providers/local/camel-mh-store.c
camel/providers/local/camel-spool-summary.c

index fac7113..90c30d6 100644 (file)
@@ -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
index d947aca..eda5713 100644 (file)
@@ -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;
index c553971..dac18f1 100644 (file)
@@ -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 */
index 611cfb2..5d8ba71 100644 (file)
@@ -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);
index 6e2d7df..4260380 100644 (file)
@@ -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;
index 98cb0ff..8da29ab 100644 (file)
@@ -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
index ff4fba7..bac8c49 100644 (file)
@@ -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;
 }
 
index a837aec..e7dcb4e 100644 (file)
@@ -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);
index 566b3b5..3851dfd 100644 (file)
@@ -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;
                }
index 7928062..c4b5e93 100644 (file)
@@ -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);
index 71b7c05..d6bf5c6 100644 (file)
@@ -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;
                }
index 604f923..4ff0a19 100644 (file)
@@ -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;
 }