From 14d5fffb63d0f61b337562c6f79ea2cc6569b62d Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Wed, 26 Jul 2000 21:22:54 +0000 Subject: [PATCH] keep folder cache from getting stale, r=putterman 18346 git-svn-id: svn://10.0.0.236/trunk@74827 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/base/public/nsIMsgFolder.idl | 4 +++- mozilla/mailnews/base/public/nsIMsgFolderCache.idl | 1 + mozilla/mailnews/base/src/nsMsgFolderCache.cpp | 14 +++++++++++--- mozilla/mailnews/base/util/nsMsgIncomingServer.cpp | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mozilla/mailnews/base/public/nsIMsgFolder.idl b/mozilla/mailnews/base/public/nsIMsgFolder.idl index 9d4a0b3c2e5..9637e8ccc44 100644 --- a/mozilla/mailnews/base/public/nsIMsgFolder.idl +++ b/mozilla/mailnews/base/public/nsIMsgFolder.idl @@ -291,7 +291,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne * write out summary data for this folder * to the given folder cache (i.e. panacea.dat) */ - void writeToFolderCache(in nsIMsgFolderCache folderCache); + void writeToFolderCache(in nsIMsgFolderCache folderCache, in boolean deep); /** * the charset of this folder @@ -309,6 +309,8 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne */ readonly attribute wstring newMessagesNotificationDescription; + // are we running a url as a result of the user clicking get msg? + attribute boolean gettingNewMessages; /** * local path of this folder */ diff --git a/mozilla/mailnews/base/public/nsIMsgFolderCache.idl b/mozilla/mailnews/base/public/nsIMsgFolderCache.idl index 61bf29eb82f..d956502f1af 100644 --- a/mozilla/mailnews/base/public/nsIMsgFolderCache.idl +++ b/mozilla/mailnews/base/public/nsIMsgFolderCache.idl @@ -32,4 +32,5 @@ interface nsIMsgFolderCache : nsISupports void Init(in nsIFileSpec fileSpec); nsIMsgFolderCacheElement GetCacheElement(in string key, in boolean createIfMissing); void Close(); + void Commit(in boolean compress); }; diff --git a/mozilla/mailnews/base/src/nsMsgFolderCache.cpp b/mozilla/mailnews/base/src/nsMsgFolderCache.cpp index 1a5a0de0729..f3868b4c84d 100644 --- a/mozilla/mailnews/base/src/nsMsgFolderCache.cpp +++ b/mozilla/mailnews/base/src/nsMsgFolderCache.cpp @@ -416,11 +416,19 @@ NS_IMETHODIMP nsMsgFolderCache::GetCacheElement(const char *pathKey, PRBool crea NS_IMETHODIMP nsMsgFolderCache::Close() { - nsresult ret=NS_OK; + return Commit(PR_TRUE); +} - nsIMdbThumb *commitThumb = NULL; +NS_IMETHODIMP nsMsgFolderCache::Commit(PRBool compress) +{ + nsresult ret = NS_OK; + + nsIMdbThumb *commitThumb = nsnull; if (m_mdbStore) - ret = m_mdbStore->CompressCommit(GetEnv(), &commitThumb); + if (compress) + ret = m_mdbStore->CompressCommit(GetEnv(), &commitThumb); + else + ret = m_mdbStore->LargeCommit(GetEnv(), &commitThumb); if (commitThumb) { diff --git a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp index f4f8c418cc9..55a5b3203b3 100644 --- a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp @@ -163,7 +163,7 @@ NS_IMETHODIMP nsMsgIncomingServer::WriteToFolderCache(nsIMsgFolderCache *folderC { nsCOMPtr msgFolder = do_QueryInterface(m_rootFolder, &rv); if (NS_SUCCEEDED(rv) && msgFolder) - rv = msgFolder->WriteToFolderCache(folderCache); + rv = msgFolder->WriteToFolderCache(folderCache, PR_TRUE /* deep */); } return rv; }