summaryrefslogtreecommitdiff
path: root/mailnews/base
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/base')
-rw-r--r--mailnews/base/public/nsIMsgPluggableStore.idl4
-rw-r--r--mailnews/base/util/nsMsgDBFolder.cpp26
2 files changed, 27 insertions, 3 deletions
diff --git a/mailnews/base/public/nsIMsgPluggableStore.idl b/mailnews/base/public/nsIMsgPluggableStore.idl
index 18415d8011..12713b2362 100644
--- a/mailnews/base/public/nsIMsgPluggableStore.idl
+++ b/mailnews/base/public/nsIMsgPluggableStore.idl
@@ -51,8 +51,8 @@ interface nsIMsgPluggableStore : nsISupports {
nsIMsgFolder createFolder(in nsIMsgFolder aParent, in AString aFolderName);
/**
- * Delete the passed in folder. This is a real delete, not a move
- * to the trash folder.
+ * Delete storage for a folder and its subfolders, if any.
+ * This is a real delete, not a move to the trash folder.
*
* @param aFolder folder to delete
*/
diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp
index 81790c69a5..c6356f83de 100644
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -3559,7 +3559,31 @@ NS_IMETHODIMP nsMsgDBFolder::GetShowDeletedMessages(bool *showDeletedMessages)
NS_IMETHODIMP nsMsgDBFolder::Delete()
{
- return NS_OK;
+ ForceDBClosed();
+
+ // Delete the .msf file.
+ // NOTE: this doesn't remove .msf files in subfolders, but
+ // both nsMsgBrkMBoxStore::DeleteFolder() and
+ // nsMsgMaildirStore::DeleteFolder() will remove those .msf files
+ // as a side-effect of deleting the .sbd directory.
+ nsCOMPtr<nsIFile> summaryFile;
+ nsresult rv = GetSummaryFile(getter_AddRefs(summaryFile));
+ NS_ENSURE_SUCCESS(rv, rv);
+ bool exists = false;
+ summaryFile->Exists(&exists);
+ if (exists) {
+ rv = summaryFile->Remove(false);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ // Ask the msgStore to delete the actual storage (mbox, maildir or whatever
+ // else may be supported in future).
+ nsCOMPtr<nsIMsgPluggableStore> msgStore;
+ rv = GetMsgStore(getter_AddRefs(msgStore));
+ NS_ENSURE_SUCCESS(rv, rv);
+ rv = msgStore->DeleteFolder(this);
+
+ return rv;
}
NS_IMETHODIMP nsMsgDBFolder::DeleteSubFolders(nsIArray *folders,