diff options
author | Jason Leach <jleach@ximian.com> | 2001-08-11 02:25:31 +0800 |
---|---|---|
committer | Jacob Leach <jleach@src.gnome.org> | 2001-08-11 02:25:31 +0800 |
commit | 854fb9e9b0d6a603f4167b7fafe2a59854bdbec5 (patch) | |
tree | e3e8b53236cfbeb822cc4e08e93ff7b35fb065d4 /mail/mail-ops.c | |
parent | 7bad37e711be4c31e8880f28f067f046ac40aa33 (diff) | |
download | gsoc2013-evolution-854fb9e9b0d6a603f4167b7fafe2a59854bdbec5.tar.gz gsoc2013-evolution-854fb9e9b0d6a603f4167b7fafe2a59854bdbec5.tar.zst gsoc2013-evolution-854fb9e9b0d6a603f4167b7fafe2a59854bdbec5.zip |
Remove all the messages from a folder that's being deleted before actually
2001-08-10 Jason Leach <jleach@ximian.com>
* mail-ops.c (remove_folder_get): Remove all the messages from a
folder that's being deleted before actually doing the
camel_store_delete_folder, so it won't leave behind an mbox file
that's going to prevent the actual directory from being deleted,
and strange effects like new folders with the same name being made
in it's place. Bug #5618.
* mail-folder-cache.c (mail_folder_cache_remove_folder): New
function, a way to get something out of the folder cache, like
folders being deleted. Bug #6878.
svn path=/trunk/; revision=11887
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 6a7564cba9..0708fb3312 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1466,6 +1466,8 @@ remove_folder_get (struct _mail_msg *mm) struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; CamelStore *store; CamelFolder *folder; + GPtrArray *uids; + int i; m->removed = FALSE; @@ -1474,10 +1476,21 @@ remove_folder_get (struct _mail_msg *mm) store = camel_folder_get_parent_store (folder); if (!store) goto done; - + + /* Delete every message in this folder, then expunge it */ + uids = camel_folder_get_uids (folder); + for (i = 0; i < uids->len; i++) + camel_folder_delete_message (folder, uids->pdata[i]); + camel_folder_sync (folder, TRUE, &mm->ex); + camel_folder_free_uids (folder, uids); + + /* Then delete the folder from the store */ camel_store_delete_folder (store, camel_folder_get_full_name (folder), &mm->ex); m->removed = !camel_exception_is_set (&mm->ex); camel_object_unref (CAMEL_OBJECT (store)); + + /* Remove this folder from the folder cache */ + mail_folder_cache_remove_folder (m->uri); done: if (store) |