From 896d495a2a8cbfdf948a56d92a0516e375d656d7 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 9 Feb 2001 02:21:18 +0000 Subject: Reworked some keep-mail-on-server logic so that we ALWAYS look for a 2001-02-08 Jeffrey Stedfast * 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 --- mail/ChangeLog | 8 +++++++ mail/folder-browser-factory.c | 2 +- mail/mail-ops.c | 56 ++++++++++++++++++++++--------------------- 3 files changed, 38 insertions(+), 28 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 4b1183ec52..55038648cb 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-02-08 Jeffrey Stedfast + + * 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. + 2001-02-09 Not Zed * mail-ops.c (filter_folder_free): only free driver, if set. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 32d5bd11d4..febef09397 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -85,7 +85,7 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("MessageFilterSubj", filter_subject), BONOBO_UI_UNSAFE_VERB ("MessageFilterSndr", filter_sender), BONOBO_UI_UNSAFE_VERB ("MessageFilterRecip", filter_recipient), - + BONOBO_UI_UNSAFE_VERB ("MessageHideClear", hide_none), BONOBO_UI_UNSAFE_VERB ("MessageHideRead", hide_read), BONOBO_UI_UNSAFE_VERB ("MessageHideDeleted", hide_deleted), 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;ilen;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) -- cgit v1.2.3