From 938992a820a7e6bd786000b4a439ed15e04f57e5 Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Tue, 18 Jul 2006 00:44:40 +0000 Subject: [PATCH] fix 316929 .msf files not deleted after imap folder deleted, sr=mscott --- mailnews/base/util/nsMsgDBFolder.cpp | 6 +++--- mailnews/base/util/nsMsgDBFolder.h | 2 +- mailnews/imap/src/nsImapMailFolder.cpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 32fb8686e7b..0eacccd1f16 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -511,7 +511,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(PRBool force) { nsCOMPtr dbPath; - result = GetFolderCacheKey(getter_AddRefs(dbPath)); + result = GetFolderCacheKey(getter_AddRefs(dbPath), PR_TRUE /* createDBIfMissing */); if (dbPath) { @@ -1097,7 +1097,7 @@ NS_IMETHODIMP nsMsgDBFolder::ReadFromFolderCacheElem(nsIMsgFolderCacheElement *e return rv; } -nsresult nsMsgDBFolder::GetFolderCacheKey(nsIFileSpec **aFileSpec) +nsresult nsMsgDBFolder::GetFolderCacheKey(nsIFileSpec **aFileSpec, PRBool createDBIfMissing /* = PR_FALSE */) { nsresult rv; nsCOMPtr path; @@ -1125,7 +1125,7 @@ nsresult nsMsgDBFolder::GetFolderCacheKey(nsIFileSpec **aFileSpec) // create the .msf file // see bug #244217 for details PRBool exists; - if (NS_SUCCEEDED(dbPath->Exists(&exists)) && !exists) + if (createDBIfMissing && NS_SUCCEEDED(dbPath->Exists(&exists)) && !exists) dbPath->Touch(); } } diff --git a/mailnews/base/util/nsMsgDBFolder.h b/mailnews/base/util/nsMsgDBFolder.h index 8c7029fd0d1..dc893b34f3a 100644 --- a/mailnews/base/util/nsMsgDBFolder.h +++ b/mailnews/base/util/nsMsgDBFolder.h @@ -136,7 +136,7 @@ protected: nsresult OnHdrAddedOrDeleted(nsIMsgDBHdr *hdrChanged, PRBool added); nsresult CreateFileSpecForDB(const char *userLeafName, nsFileSpec &baseDir, nsIFileSpec **dbFileSpec); - nsresult GetFolderCacheKey(nsIFileSpec **aFileSpec); + nsresult GetFolderCacheKey(nsIFileSpec **aFileSpec, PRBool createDBIfMissing = PR_FALSE); nsresult GetFolderCacheElemFromFileSpec(nsIFileSpec *fileSpec, nsIMsgFolderCacheElement **cacheElement); nsresult AddDirectorySeparator(nsFileSpec &path); nsresult CheckIfFolderExists(const PRUnichar *newFolderName, nsIMsgFolder *parentFolder, nsIMsgWindow *msgWindow); diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 354cc00df84..e2e5dba43d3 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -1041,8 +1041,9 @@ NS_IMETHODIMP nsImapMailFolder::RemoveSubFolder (nsIMsgFolder *which) nsCOMPtr folderSupport = do_QueryInterface(which, &rv); if (NS_FAILED(rv)) return rv; folders->AppendElement(folderSupport); + rv = nsMsgDBFolder::DeleteSubFolders(folders, nsnull); which->Delete(); - return nsMsgDBFolder::DeleteSubFolders(folders, nsnull); + return rv; } NS_IMETHODIMP nsImapMailFolder::CreateStorageIfMissing(nsIUrlListener* urlListener)