summaryrefslogtreecommitdiff
path: root/mailnews/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 20:27:19 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 20:27:19 -0500
commit1f5f6a4bf0163f4dcf0fd6778611891165c334ff (patch)
treeb4211330b96a89b66c838c116dbc379159c62ed6 /mailnews/base
parent4d20783c0aa26ced30b55c3eaaab76f46a01a803 (diff)
downloaduxp-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.tar.gz
Bug 1317117 - call msgStore folder deletion during imap/news empty trash.
Also factors out some common code into nsMSgDBFolder::Delete(), and makes a couple of incidental changes to try and clarify the responsibilies of nsIMsgPluggableStore::DeleteFolder(). Tag #1273
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,