From 04ce610fcf137a2da5320220dbdac9975452dad4 Mon Sep 17 00:00:00 2001 From: "bugzilla%standard8.demon.co.uk" Date: Mon, 10 Oct 2005 17:04:01 +0000 Subject: [PATCH] First part of bug 311238 ns*SummarySpec.* are no longer required - Remove nsNewsSummarySpec. r=bienvenu,sr=mscott git-svn-id: svn://10.0.0.236/trunk@181907 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/base/public/msgCore.h | 5 +++++ mozilla/mailnews/base/util/Makefile.in | 2 -- .../base/util/nsLocalFolderSummarySpec.cpp | 2 +- mozilla/mailnews/base/util/nsMsgDBFolder.cpp | 9 ++------ .../mailnews/imap/src/nsImapMailFolder.cpp | 2 +- .../mailnews/local/src/nsLocalMailFolder.cpp | 4 ++-- mozilla/mailnews/news/src/nsNewsFolder.cpp | 21 +++++++++++++------ 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/mozilla/mailnews/base/public/msgCore.h b/mozilla/mailnews/base/public/msgCore.h index 73d8c9022a4..2ef05bf0b76 100644 --- a/mozilla/mailnews/base/public/msgCore.h +++ b/mozilla/mailnews/base/public/msgCore.h @@ -54,6 +54,11 @@ class nsIMsgFolder; #include "nsIServiceManager.h" #include "nsIComponentManager.h" +/* + * The suffix we use for the mail summary file. + */ +#define SUMMARY_SUFFIX ".msf" + /* NS_ERROR_MODULE_MAILNEWS is defined in mozilla/xpcom/public/nsError.h */ /* diff --git a/mozilla/mailnews/base/util/Makefile.in b/mozilla/mailnews/base/util/Makefile.in index 84d1653b9ef..1065a4332e9 100644 --- a/mozilla/mailnews/base/util/Makefile.in +++ b/mozilla/mailnews/base/util/Makefile.in @@ -97,7 +97,6 @@ CPPSRCS = \ nsMsgKeySet.cpp \ nsMsgKeyArray.cpp \ nsLocalFolderSummarySpec.cpp \ - nsNewsSummarySpec.cpp \ nsMsgIdentity.cpp \ nsMsgIncomingServer.cpp \ nsMsgUtils.cpp \ @@ -118,7 +117,6 @@ EXPORTS = \ nsMsgKeyArray.h \ nsMsgDBFolder.h \ nsLocalFolderSummarySpec.h \ - nsNewsSummarySpec.h \ nsMsgIdentity.h \ nsMsgIncomingServer.h \ nsMsgUtils.h \ diff --git a/mozilla/mailnews/base/util/nsLocalFolderSummarySpec.cpp b/mozilla/mailnews/base/util/nsLocalFolderSummarySpec.cpp index 5c5d60e1837..db210bc3ff0 100644 --- a/mozilla/mailnews/base/util/nsLocalFolderSummarySpec.cpp +++ b/mozilla/mailnews/base/util/nsLocalFolderSummarySpec.cpp @@ -89,7 +89,7 @@ void nsLocalFolderSummarySpec:: CreateSummaryFileName() // Append .msf (msg summary file) this is what windows will want. // Mac and Unix can decide for themselves. - fullLeafName.AppendLiteral(".msf"); // message summary file + fullLeafName.AppendLiteral(SUMMARY_SUFFIX); // message summary file char *cLeafName = ToNewCString(fullLeafName); SetLeafName(cLeafName); nsMemory::Free(cLeafName); diff --git a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp index b4f2ea61d15..1868f7aea00 100644 --- a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp @@ -725,11 +725,6 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineStoreOutputStream(nsIOutputStream **outpu return rv; } -// XXX todo -// move these to a common location and remove all the hard coded ".msf" -#define SUMMARY_SUFFIX ".msf" -#define SUMMARY_SUFFIX_LEN 4 - // path coming in is the root path without the leaf name, // on the way out, it's the whole path. nsresult nsMsgDBFolder::CreateFileSpecForDB(const char *userLeafName, nsFileSpec &path, nsIFileSpec **dbFileSpec) @@ -763,7 +758,7 @@ nsresult nsMsgDBFolder::CreateFileSpecForDB(const char *userLeafName, nsFileSpec proposedDBName = path.GetLeafName(); } // now, take the ".msf" off - proposedDBName.Truncate(proposedDBName.Length() - SUMMARY_SUFFIX_LEN); + proposedDBName.Truncate(proposedDBName.Length() - NS_LITERAL_CSTRING(SUMMARY_SUFFIX).Length()); path.SetLeafName(proposedDBName.get()); NS_NewFileSpecWithSpec(path, dbFileSpec); @@ -3357,7 +3352,7 @@ NS_IMETHODIMP nsMsgDBFolder::Rename(const PRUnichar *aNewName, nsIMsgWindow *msg rv = oldPathSpec->Rename(newDiskName.get()); if (NS_SUCCEEDED(rv)) { - newDiskName += ".msf"; + newDiskName += SUMMARY_SUFFIX; oldSummarySpec.Rename(newDiskName.get()); } else diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index 7de56484de4..f01bdd06346 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -314,7 +314,7 @@ static PRBool nsShouldIgnoreFile(nsString& name) { PRInt32 len = name.Length(); - if (len > 4 && name.RFind(".msf", PR_TRUE) == len -4) + if (len > 4 && name.RFind(SUMMARY_SUFFIX, PR_TRUE) == len -4) { name.SetLength(len-4); // truncate the string return PR_FALSE; diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index d04e93665ec..3c0186b9509 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -220,7 +220,7 @@ nsShouldIgnoreFile(nsString& name) name.LowerCaseEqualsLiteral("feeditems.rdf")) return PR_TRUE; - return (nsStringEndsWith(name,".sbd") || nsStringEndsWith(name,".msf")); + return (nsStringEndsWith(name,".sbd") || nsStringEndsWith(name,SUMMARY_SUFFIX)); } NS_IMETHODIMP @@ -1184,7 +1184,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const PRUnichar *aNewName, nsIMsgWind rv = oldPathSpec->Rename(newDiskName.get()); if (NS_SUCCEEDED(rv)) { - newDiskName += ".msf"; + newDiskName += SUMMARY_SUFFIX; oldSummarySpec.Rename(newDiskName.get()); } else diff --git a/mozilla/mailnews/news/src/nsNewsFolder.cpp b/mozilla/mailnews/news/src/nsNewsFolder.cpp index 5914de1b250..76d6133c75f 100644 --- a/mozilla/mailnews/news/src/nsNewsFolder.cpp +++ b/mozilla/mailnews/news/src/nsNewsFolder.cpp @@ -84,7 +84,6 @@ #include "nsIURL.h" #include "nsNetCID.h" #include "nsINntpUrl.h" -#include "nsNewsSummarySpec.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" @@ -601,18 +600,28 @@ NS_IMETHODIMP nsMsgNewsFolder::Delete() nsCOMPtr pathSpec; rv = GetPath(getter_AddRefs(pathSpec)); if (NS_FAILED(rv)) return rv; - + nsFileSpec path; rv = pathSpec->GetFileSpec(&path); if (NS_FAILED(rv)) return rv; - + // delete local store, if it exists if (path.Exists()) path.Delete(PR_FALSE); + // Remove summary file. - nsNewsSummarySpec summarySpec(path); - summarySpec.Delete(PR_FALSE); - + nsXPIDLCString summaryFile; + rv = pathSpec->GetLeafName(getter_Copies(summaryFile)); + NS_ENSURE_SUCCESS(rv, rv); + + summaryFile.Append(SUMMARY_SUFFIX); + + rv = pathSpec->SetLeafName(summaryFile.get()); + NS_ENSURE_SUCCESS(rv, rv); + + rv = pathSpec->Delete(PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr nntpServer; rv = GetNntpServer(getter_AddRefs(nntpServer)); if (NS_FAILED(rv)) return rv;