summaryrefslogtreecommitdiffstats
path: root/mailnews/local/src
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/local/src')
-rw-r--r--mailnews/local/src/nsLocalMailFolder.cpp39
-rw-r--r--mailnews/local/src/nsLocalMailFolder.h1
-rw-r--r--mailnews/local/src/nsMsgBrkMBoxStore.cpp32
-rw-r--r--mailnews/local/src/nsMsgMaildirStore.cpp23
4 files changed, 35 insertions, 60 deletions
diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp
index 00244ca87..78991ebfd 100644
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -653,8 +653,6 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
if (NS_SUCCEEDED(rv))
{
uint32_t flags;
- nsCString trashUri;
- trashFolder->GetURI(trashUri);
trashFolder->GetFlags(&flags);
int32_t totalMessages = 0;
rv = trashFolder->GetTotalMessages(true, &totalMessages);
@@ -750,43 +748,6 @@ nsresult nsMsgLocalMailFolder::IsChildOfTrash(bool *result)
return rv;
}
-NS_IMETHODIMP nsMsgLocalMailFolder::Delete()
-{
- nsresult rv;
- nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- msgDBService->CachedDBForFolder(this, getter_AddRefs(mDatabase));
- if (mDatabase)
- {
- mDatabase->ForceClosed();
- mDatabase = nullptr;
- }
-
- nsCOMPtr<nsIMsgIncomingServer> server;
- rv = GetServer(getter_AddRefs(server));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIMsgPluggableStore> msgStore;
-
- rv = server->GetMsgStore(getter_AddRefs(msgStore));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr <nsIFile> summaryFile;
- rv = GetSummaryFile(getter_AddRefs(summaryFile));
- NS_ENSURE_SUCCESS(rv, rv);
-
- //Clean up .sbd folder if it exists.
- // Remove summary file.
- rv = summaryFile->Remove(false);
- NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Could not delete msg summary file");
-
- rv = msgStore->DeleteFolder(this);
- if (rv == NS_ERROR_FILE_NOT_FOUND ||
- rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
- rv = NS_OK; // virtual folders do not have a msgStore file
- return rv;
-}
-
NS_IMETHODIMP nsMsgLocalMailFolder::DeleteSubFolders(nsIArray *folders, nsIMsgWindow *msgWindow)
{
nsresult rv;
diff --git a/mailnews/local/src/nsLocalMailFolder.h b/mailnews/local/src/nsLocalMailFolder.h
index b2503a157..1ed964b16 100644
--- a/mailnews/local/src/nsLocalMailFolder.h
+++ b/mailnews/local/src/nsLocalMailFolder.h
@@ -120,7 +120,6 @@ public:
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow) override;
NS_IMETHOD CompactAll(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow, bool aCompactOfflineAlso) override;
NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow, nsIUrlListener *aListener) override;
- NS_IMETHOD Delete () override;
NS_IMETHOD DeleteSubFolders(nsIArray *folders, nsIMsgWindow *msgWindow) override;
NS_IMETHOD CreateStorageIfMissing(nsIUrlListener* urlListener) override;
NS_IMETHOD Rename (const nsAString& aNewName, nsIMsgWindow *msgWindow) override;
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,
diff --git a/mailnews/local/src/nsMsgMaildirStore.cpp b/mailnews/local/src/nsMsgMaildirStore.cpp
index 7a4633367..993abbad5 100644
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -323,19 +323,30 @@ NS_IMETHODIMP nsMsgMaildirStore::SetSummaryFileValid(nsIMsgFolder *aFolder,
NS_IMETHODIMP nsMsgMaildirStore::DeleteFolder(nsIMsgFolder *aFolder)
{
NS_ENSURE_ARG_POINTER(aFolder);
+ bool exists;
- // Delete Maildir structure
+ // Delete the Maildir itself.
nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
- rv = pathFile->Remove(true); // recursive
+ exists = false;
+ pathFile->Exists(&exists);
+ if (exists) {
+ rv = pathFile->Remove(true);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ // Delete any subfolders (.sbd-suffixed directories).
AddDirectorySeparator(pathFile);
- bool exists;
+ exists = false;
pathFile->Exists(&exists);
- if (exists)
- pathFile->Remove(true);
- return rv;
+ if (exists) {
+ rv = pathFile->Remove(true);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ return NS_OK;
}
NS_IMETHODIMP nsMsgMaildirStore::RenameFolder(nsIMsgFolder *aFolder,