aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/mail-folder-cache.c18
-rw-r--r--mail/mail-folder-cache.h15
-rw-r--r--mail/mail-ops.c15
4 files changed, 54 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 2a66aca77e..37bf8528c2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+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.
+
2001-08-10 Peter Williams <peterw@ximian.com>
* mail-accounts.c (news_add_destroyed): Whoops, compile fix.
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 208b231e40..9e7d0f2e0f 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -574,6 +574,24 @@ mail_folder_cache_set_update_lstorage (const gchar *uri,
}
void
+mail_folder_cache_remove_folder (const gchar *uri)
+{
+ if (uri && *uri) {
+ mail_folder_info *mfi;
+
+ mfi = g_hash_table_lookup (folders, uri);
+
+ /* Free everything we've allocated for this folder info */
+ g_free (mfi->uri);
+ g_free (mfi->path);
+ g_free (mfi->name);
+
+ /* Remove it from the hash */
+ g_hash_table_remove (folders, uri);
+ }
+}
+
+void
mail_folder_cache_note_folder (const gchar *uri, CamelFolder *folder)
{
mail_folder_info *mfi;
diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h
index a3dcec526b..9902933cf8 100644
--- a/mail/mail-folder-cache.h
+++ b/mail/mail-folder-cache.h
@@ -32,18 +32,21 @@
#include "folder-browser.h"
-/* No real order that these functions should be called. The idea is that whenever a
- * chunk of the mailer gets some up-to-date information about a URI, it calls one
- * of the _note_ functions and the folder cache sees to it that the information is
- * put to good use.
+/* No real order that these functions should be called. The idea is
+ * that whenever a chunk of the mailer gets some up-to-date
+ * information about a URI, it calls one of the _note_ functions and
+ * the folder cache sees to it that the information is put to good
+ * use.
*
- * Thus there is no way to remove items from the cache. So it leaks a lot.
- */
+ * Thus there is no way to remove items from the cache. So it leaks a lot. */
void mail_folder_cache_set_update_estorage (const gchar *uri, EvolutionStorage *estorage);
void mail_folder_cache_set_update_lstorage (const gchar *uri,
GNOME_Evolution_Storage lstorage,
const gchar *path);
+
+void mail_folder_cache_remove_folder (const gchar *uri);
+
/* We always update the shell view */
/*void mail_folder_cache_set_update_shellview (const gchar *uri);*/
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)