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
This commit is contained in:
bugzilla%standard8.demon.co.uk
2005-10-10 17:04:01 +00:00
parent c662a28933
commit 04ce610fcf
7 changed files with 26 additions and 19 deletions

View File

@@ -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 */
/*

View File

@@ -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 \

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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<nsIFileSpec> 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 <nsINntpIncomingServer> nntpServer;
rv = GetNntpServer(getter_AddRefs(nntpServer));
if (NS_FAILED(rv)) return rv;