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
This commit is contained in:
Jeffrey Stedfast
2001-02-09 02:21:18 +00:00
committed by Jeffrey Stedfast
parent cd101b3ffc
commit 896d495a2a
3 changed files with 38 additions and 28 deletions

View File

@ -1,3 +1,11 @@
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.
2001-02-09 Not Zed <NotZed@Ximian.com>
* mail-ops.c (filter_folder_free): only free driver, if set.

View File

@ -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),

View File

@ -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);
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);
filter_folder_filter (mm);
/* 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)