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
This commit is contained in:
Matt A. Tobin 2019-11-10 20:27:19 -05:00 • committed by Roy Tam
commit 0f885aaad1
8 changed files with 77 additions and 139 deletions

View file

@ -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,