diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-02-09 10:21:18 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-02-09 10:21:18 +0800 |
commit | 896d495a2a8cbfdf948a56d92a0516e375d656d7 (patch) | |
tree | 5637decc284213a55556adfaf2d97f28d5c91743 /mail/mail-ops.c | |
parent | cd101b3ffcbe06d7b40bc19adbc66b2ad843a1c9 (diff) | |
download | gsoc2013-evolution-896d495a2a8cbfdf948a56d92a0516e375d656d7.tar.gz gsoc2013-evolution-896d495a2a8cbfdf948a56d92a0516e375d656d7.tar.zst gsoc2013-evolution-896d495a2a8cbfdf948a56d92a0516e375d656d7.zip |
Reworked some keep-mail-on-server logic so that we ALWAYS look for a
2001-02-08 Jeffrey Stedfast <fejj@ximian.com>
* mail-ops.c (fetch_mail_fetch): Reworked some keep-mail-on-server
logic so that we ALWAYS look for a cached array of UIDs that we
may have downloaded previously so as not to download them again
even if we will be deleting them off the server. This fixes bug
#1344.
svn path=/trunk/; revision=8135
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 231b22ad95..48443f3d7c 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -288,41 +288,43 @@ fetch_mail_fetch(struct _mail_msg *mm) g_free (path); } else { CamelFolder *folder = fm->source_folder = mail_tool_get_inbox(m->source_uri, &mm->ex); - CamelUIDCache *cache = NULL; - + if (folder) { /* this handles 'keep on server' stuff, if we have any new uid's to copy across, we need to copy them to a new array 'cause of the way fetch_mail_free works */ - if (!fm->delete) { - char *cachename = mail_config_folder_to_cachename (folder, "cache-"); - - cache = camel_uid_cache_new (cachename); - if (cache) { - GPtrArray *folder_uids, *cache_uids, *uids; + CamelUIDCache *cache = NULL; + char *cachename; + + cachename = mail_config_folder_to_cachename (folder, "cache-"); + cache = camel_uid_cache_new (cachename); + g_free (cachename); + + if (cache) { + GPtrArray *folder_uids, *cache_uids, *uids; + + folder_uids = camel_folder_get_uids (folder); + cache_uids = camel_uid_cache_get_new_uids (cache, folder_uids); + if (cache_uids) { + /* need to copy this, sigh */ + fm->source_uids = uids = g_ptr_array_new (); + g_ptr_array_set_size (uids, cache_uids->len); + for (i = 0; i < cache_uids->len; i++) + uids->pdata[i] = g_strdup (cache_uids->pdata[i]); + camel_uid_cache_free_uids (cache_uids); + + filter_folder_filter (mm); - folder_uids = camel_folder_get_uids(folder); - cache_uids = camel_uid_cache_get_new_uids(cache, folder_uids); - if (cache_uids) { - /* need to copy this, sigh */ - fm->source_uids = uids = g_ptr_array_new(); - g_ptr_array_set_size(uids, cache_uids->len); - for (i=0;i<cache_uids->len;i++) - uids->pdata[i] = g_strdup(cache_uids->pdata[i]); - camel_uid_cache_free_uids (cache_uids); - - filter_folder_filter(mm); - if (!camel_exception_is_set (&mm->ex)) - camel_uid_cache_save (cache); - camel_uid_cache_destroy (cache); - } - camel_folder_free_uids(folder, folder_uids); + /* if we are not to delete the messages, save the UID cache */ + if (!fm->delete && !camel_exception_is_set (&mm->ex)) + camel_uid_cache_save (cache); + + camel_uid_cache_destroy (cache); } - g_free (cachename); + camel_folder_free_uids (folder, folder_uids); } else { - filter_folder_filter(mm); + filter_folder_filter (mm); } } - } if (m->cancel) |