add compact offline store method, part of 15865 r=sspitzer, sr=mscott

This commit is contained in:
bienvenu%netscape.com 2001-01-11 14:40:50 +00:00
Родитель f7ec15df4c
Коммит 1c20093b06
4 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -418,4 +418,20 @@
{0xd97edfb5, 0xbcbe, 0x4a15, \
{ 0xa4, 0xfb, 0xfb, 0xf2, 0xf9, 0x58, 0xb3, 0x88 }}
#define NS_MSGLOCALFOLDERCOMPACTOR_CONTRACTID \
"@mozilla.org/messenger/localfoldercompactor;1"
/* 7d1d315c-e5c6-11d4-a5b7-0060b0fc04b7 */
#define NS_MSGLOCALFOLDERCOMPACTOR_CID \
{0x7d1d315c, 0xe5c6, 0x11d4, \
{0xa5, 0xb7, 0x00,0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
#define NS_MSGOFFLINESTORECOMPACTOR_CONTRACTID \
"@mozilla.org/messenger/offlinestorecompactor;1"
/* 2db43d16-e5c8-11d4-a5b7-0060b0fc04b7 */
#define NS_MSG_OFFLINESTORECOMPACTOR_CID \
{0x2db43d16, 0xe5c8, 0x11d4, \
{0xa5, 0xb7, 0x00,0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
#endif // nsMessageBaseCID_h__

Просмотреть файл

@ -83,7 +83,7 @@
#include "nsMsgSearchSession.h"
#include "nsMsgSearchAdapter.h"
#include "nsMsgSearchDataSource.h"
#include "nsMsgFolderCompactor.h"
// private factory declarations for each component we know how to produce
@ -119,6 +119,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgServiceProviderService, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribeDataSource, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribableServer, Init);
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgPrintEngine, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFolderCompactState)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineStoreCompactState)
// The list of components we register
static nsModuleComponentInfo gComponents[] = {
@ -283,6 +285,14 @@ static nsModuleComponentInfo gComponents[] = {
NS_SUBSCRIBABLESERVER_CONTRACTID,
nsSubscribableServerConstructor,
},
{ "Local folder compactor", NS_MSGLOCALFOLDERCOMPACTOR_CID,
NS_MSGLOCALFOLDERCOMPACTOR_CONTRACTID,
nsFolderCompactStateConstructor,
},
{ "offline store compactor", NS_MSG_OFFLINESTORECOMPACTOR_CID,
NS_MSGOFFLINESTORECOMPACTOR_CONTRACTID,
nsOfflineStoreCompactStateConstructor,
}
};
NS_IMPL_NSGETMODULE("nsMsgBaseModule", gComponents)

Просмотреть файл

@ -35,6 +35,7 @@
#include "nsLocalFolderSummarySpec.h"
#include "nsIFileStream.h"
#include "nsIChannel.h"
#include "nsIMsgFolderCompactor.h"
#if defined(XP_OS2)
#define MAX_FILE_LENGTH_WITHOUT_EXTENSION 8
#elif defined(XP_MAC)
@ -1394,3 +1395,22 @@ nsresult nsMsgDBFolder::EndNewOfflineMessage()
return NS_OK;
}
nsresult nsMsgDBFolder::CompactOfflineStore(nsIMsgWindow *inWindow)
{
nsresult rv;
nsCOMPtr <nsIMsgFolderCompactor> folderCompactor = do_CreateInstance(NS_MSGOFFLINESTORECOMPACTOR_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && folderCompactor)
{
GetDatabase(nsnull);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIFileSpec> pathSpec;
rv = GetPath(getter_AddRefs(pathSpec));
rv = folderCompactor->Init(this, mBaseMessageURI, mDatabase, pathSpec);
if (NS_SUCCEEDED(rv))
rv = folderCompactor->StartCompacting();
}
}
return rv;
}

Просмотреть файл

@ -119,7 +119,7 @@ protected:
nsresult StartNewOfflineMessage();
nsresult WriteStartOfNewLocalMessage();
nsresult EndNewOfflineMessage();
nsresult CompactOfflineStore(nsIMsgWindow *inWindow);
protected:
nsCOMPtr<nsIMsgDatabase> mDatabase;