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

@ -495,41 +495,8 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const nsAString& newsgroupName,
NS_IMETHODIMP nsMsgNewsFolder::Delete()
{
nsresult rv = GetDatabase();
if(NS_SUCCEEDED(rv))
{
mDatabase->ForceClosed();
mDatabase = nullptr;
}
nsCOMPtr<nsIFile> folderPath;
rv = GetFilePath(getter_AddRefs(folderPath));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIFile> summaryPath;
rv = GetSummaryFileLocation(folderPath, getter_AddRefs(summaryPath));
if (NS_SUCCEEDED(rv))
{
bool exists = false;
rv = folderPath->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
rv = folderPath->Remove(false);
if (NS_FAILED(rv))
NS_WARNING("Failed to remove News Folder");
rv = summaryPath->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
rv = summaryPath->Remove(false);
if (NS_FAILED(rv))
NS_WARNING("Failed to remove News Folder Summary File");
}
}
nsresult rv = nsMsgDBFolder::Delete();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr <nsINntpIncomingServer> nntpServer;
rv = GetNntpServer(getter_AddRefs(nntpServer));