summaryrefslogtreecommitdiffstats
path: root/mailnews/local/src/nsMsgBrkMBoxStore.cpp
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/local/src/nsMsgBrkMBoxStore.cpp
parent4d20783c0aa26ced30b55c3eaaab76f46a01a803 (diff)
downloadUXP-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/local/src/nsMsgBrkMBoxStore.cpp')
-rw-r--r--mailnews/local/src/nsMsgBrkMBoxStore.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/mailnews/local/src/nsMsgBrkMBoxStore.cpp b/mailnews/local/src/nsMsgBrkMBoxStore.cpp
index 31836dd3c..1ab464385 100644
--- a/mailnews/local/src/nsMsgBrkMBoxStore.cpp
+++ b/mailnews/local/src/nsMsgBrkMBoxStore.cpp
@@ -300,26 +300,30 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::SetSummaryFileValid(nsIMsgFolder *aFolder,
NS_IMETHODIMP nsMsgBrkMBoxStore::DeleteFolder(nsIMsgFolder *aFolder)
{
NS_ENSURE_ARG_POINTER(aFolder);
- //Delete mailbox
+ bool exists;
+
+ // Delete mbox file.
nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
- pathFile->Remove(false);
+ exists = false;
+ pathFile->Exists(&exists);
+ if (exists) {
+ rv = pathFile->Remove(false);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
- bool isDirectory = false;
- pathFile->IsDirectory(&isDirectory);
- if (!isDirectory)
- {
- nsAutoString leafName;
- pathFile->GetLeafName(leafName);
- leafName.AppendLiteral(FOLDER_SUFFIX);
- pathFile->SetLeafName(leafName);
+ // Delete any subfolders (.sbd-suffixed directories).
+ AddDirectorySeparator(pathFile);
+ exists = false;
+ pathFile->Exists(&exists);
+ if (exists) {
+ rv = pathFile->Remove(true);
+ NS_ENSURE_SUCCESS(rv, rv);
}
- isDirectory = false;
- pathFile->IsDirectory(&isDirectory);
- //If this is a directory, then remove it.
- return isDirectory ? pathFile->Remove(true) : NS_OK;
+
+ return NS_OK;
}
NS_IMETHODIMP nsMsgBrkMBoxStore::RenameFolder(nsIMsgFolder *aFolder,