From bb2af981843efad96dac9d48015e88fdd0a26085 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 29 May 2002 02:35:42 +0000 Subject: Implement. Run a summary check to update for any newly arrived messages. 2002-05-28 Not Zed * providers/local/camel-maildir-folder.c (maildir_refresh_info): Implement. Run a summary check to update for any newly arrived messages. * providers/local/camel-maildir-store.c (scan_dir): If we have a folder, execute a refresh_info on it, to suck in any new stuff. svn path=/trunk/; revision=17029 --- camel/providers/local/camel-maildir-folder.c | 16 ++++++++++++++++ camel/providers/local/camel-maildir-store.c | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'camel/providers/local') diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c index 05fdd70e10..3b1ba7ef86 100644 --- a/camel/providers/local/camel-maildir-folder.c +++ b/camel/providers/local/camel-maildir-folder.c @@ -54,6 +54,7 @@ static CamelLocalSummary *maildir_create_summary(const char *path, const char *f static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, char **appended_uid, CamelException * ex); static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex); +static void maildir_refresh_info(CamelFolder *folder, CamelException *ex); static void maildir_finalize(CamelObject * object); @@ -67,6 +68,7 @@ static void camel_maildir_folder_class_init(CamelObjectClass * camel_maildir_fol /* virtual method definition */ /* virtual method overload */ + camel_folder_class->refresh_info = maildir_refresh_info; camel_folder_class->append_message = maildir_append_message; camel_folder_class->get_message = maildir_get_message; @@ -125,6 +127,20 @@ static CamelLocalSummary *maildir_create_summary(const char *path, const char *f return (CamelLocalSummary *)camel_maildir_summary_new(path, folder, index); } +static void +maildir_refresh_info(CamelFolder *folder, CamelException *ex) +{ + CamelLocalFolder *lf = (CamelLocalFolder *)folder; + + if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) + return; + + if (camel_folder_change_info_changed(lf->changes)) { + camel_object_trigger_event((CamelObject *)folder, "folder_changed", lf->changes); + camel_folder_change_info_clear(lf->changes); + } +} + static void maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex) { diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index ef152b132f..caae276e14 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -276,8 +276,11 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch CAMEL_STORE_LOCK(store, cache_lock); folder = g_hash_table_lookup(store->folders, path); - if (folder) + if (folder) { + if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0) + camel_folder_refresh_info(folder, NULL); unread = camel_folder_get_unread_message_count(folder); + } CAMEL_STORE_UNLOCK(store, cache_lock); /* if we dont have a folder, then scan the directory and get the unread -- cgit