diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-14 13:50:31 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-14 13:50:31 +0800 |
commit | 17b15d553997df67e72df705e5799ad5b050f04d (patch) | |
tree | 0265643e306975c157142509df8a8e1c8ca72c75 /mail/mail-ops.c | |
parent | 21a24c0e53c0b4f8b0898ad7430ab27985bd446c (diff) | |
download | gsoc2013-evolution-17b15d553997df67e72df705e5799ad5b050f04d.tar.gz gsoc2013-evolution-17b15d553997df67e72df705e5799ad5b050f04d.tar.zst gsoc2013-evolution-17b15d553997df67e72df705e5799ad5b050f04d.zip |
Only use the cache if the user plans to keep_on_server.
2000-09-14 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c (do_fetch_mail): Only use the cache if the user plans
to keep_on_server.
svn path=/trunk/; revision=5422
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 42 |
1 files changed, 22 insertions, 20 deletions
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)) |