From 17b15d553997df67e72df705e5799ad5b050f04d Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 14 Sep 2000 05:50:31 +0000 Subject: Only use the cache if the user plans to keep_on_server. 2000-09-14 Jeffrey Stedfast * mail-ops.c (do_fetch_mail): Only use the cache if the user plans to keep_on_server. svn path=/trunk/; revision=5422 --- mail/ChangeLog | 5 +++++ mail/mail-ops.c | 42 ++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3121a431c9..f25be5eab6 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-09-14 Jeffrey Stedfast + + * mail-ops.c (do_fetch_mail): Only use the cache if the user plans + to keep_on_server. + 2000-09-14 Michael Meeks * folder-browser-factory.c (control_deactivate): kill diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 7e5d567f10..cf513df8d0 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -142,7 +142,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) if (camel_folder_get_message_count (folder) == 0) { data->empty = TRUE; } else { - CamelUIDCache *cache; + CamelUIDCache *cache = NULL; gchar *userrules; gchar *systemrules; FilterContext *fc; @@ -153,7 +153,7 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); - fc = filter_context_new(); + fc = filter_context_new (); rule_context_load ((RuleContext *)fc, systemrules, userrules, NULL, NULL); g_free (userrules); g_free (systemrules); @@ -168,23 +168,25 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) uids = camel_folder_get_uids (folder); - /* get the mail source's uid cache file */ - url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, FALSE); - for (p = url; *p; p++) { - if (!isascii ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p)) - *p = '_'; - } - - filename = g_strdup_printf ("%s/config/cache-%s", evolution_dir, url); - g_free (url); - - cache = camel_uid_cache_new (filename); - - if (cache) { - /* determine the new uids */ - new_uids = camel_uid_cache_get_new_uids (cache, uids); - camel_folder_free_uids (folder, uids); - uids = new_uids; + if (!input->keep_on_server) { + /* get the mail source's uid cache file */ + url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, FALSE); + for (p = url; *p; p++) { + if (!isascii ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p)) + *p = '_'; + } + + filename = g_strdup_printf ("%s/config/cache-%s", evolution_dir, url); + g_free (url); + + cache = camel_uid_cache_new (filename); + + if (cache) { + /* determine the new uids */ + new_uids = camel_uid_cache_get_new_uids (cache, uids); + camel_folder_free_uids (folder, uids); + uids = new_uids; + } } /* get/filter the new messages */ @@ -237,8 +239,8 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) camel_object_unhook_event (CAMEL_OBJECT (input->destination), "folder_changed", input->hook_func, input->hook_data); - /* save the cache for the next time we fetch mail! */ if (cache) { + /* save the cache for the next time we fetch mail! */ camel_uid_cache_free_uids (uids); if (!camel_exception_is_set (ex)) -- cgit