diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-10 20:27:19 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-10 20:27:19 -0500 |
commit | 1f5f6a4bf0163f4dcf0fd6778611891165c334ff (patch) | |
tree | b4211330b96a89b66c838c116dbc379159c62ed6 /mailnews/base/util | |
parent | 4d20783c0aa26ced30b55c3eaaab76f46a01a803 (diff) | |
download | UXP-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.tar UXP-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.tar.gz UXP-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.tar.lz UXP-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.tar.xz UXP-1f5f6a4bf0163f4dcf0fd6778611891165c334ff.zip |
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/util')
-rw-r--r-- | mailnews/base/util/nsMsgDBFolder.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 81790c69a..c6356f83d 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, |