Part of Bug 473458 - nsMsgDBFolder::GetDatabase doesn't need a nsIMsgWindow argument. r/sr=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Mon, 19 Jan 2009 09:58:20 +0000
changeset 1677 10d6c4927ad2ffcbdaca53927d5ae4144d946b57
parent 1676 4c6563dcabef76c23e3022f41634bdc200b751fb
child 1678 8cedb9f7ad8c846c0e68bd2202c10370cd452594
push idunknown
push userunknown
push dateunknown
bugs473458
Part of Bug 473458 - nsMsgDBFolder::GetDatabase doesn't need a nsIMsgWindow argument. r/sr=bienvenu
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgDBFolder.h
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapMailFolder.h
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsLocalMailFolder.h
mailnews/news/src/nsNewsFolder.cpp
mailnews/news/src/nsNewsFolder.h
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -760,17 +760,17 @@ NS_IMETHODIMP nsMsgDBFolder::GetOfflineF
   nsCOMPtr <nsILocalFile> localStore;
   nsresult rv = GetFilePath(getter_AddRefs(localStore));
   NS_ENSURE_SUCCESS(rv, rv);
   if (localStore)
   {
     rv = NS_NewLocalFileInputStream(aFileStream, localStore);
     if (NS_SUCCEEDED(rv))
     {
-      rv = GetDatabase(nsnull);
+      rv = GetDatabase();
       NS_ENSURE_SUCCESS(rv, NS_OK);
       nsCOMPtr<nsIMsgDBHdr> hdr;
       rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(hdr));
       if (hdr && NS_SUCCEEDED(rv))
       {
         hdr->GetMessageOffset(offset);
         hdr->GetOfflineMessageSize(size);
       }
@@ -880,17 +880,17 @@ nsresult nsMsgDBFolder::CreateFileForDB(
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::GetMsgDatabase(nsIMsgWindow *aMsgWindow,
                               nsIMsgDatabase** aMsgDatabase)
 {
   NS_ENSURE_ARG_POINTER(aMsgDatabase);
-  GetDatabase(aMsgWindow);
+  GetDatabase();
   if (!mDatabase)
     return NS_ERROR_FAILURE;
   NS_ADDREF(*aMsgDatabase = mDatabase);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::SetMsgDatabase(nsIMsgDatabase *aMsgDatabase)
@@ -1330,34 +1330,33 @@ NS_IMETHODIMP nsMsgDBFolder::WriteToFold
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag)
 {
   NS_ENSURE_ARG_POINTER(aMessage);
 
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   NS_ENSURE_SUCCESS(rv, NS_OK);
 
   nsMsgKey msgKey;
   aMessage->GetMessageKey(&msgKey);
 
   if (aDispositionFlag == nsIMsgFolder::nsMsgDispositionState_Replied)
     mDatabase->MarkReplied(msgKey, PR_TRUE, nsnull);
   else if (aDispositionFlag == nsIMsgFolder::nsMsgDispositionState_Forwarded)
     mDatabase->MarkForwarded(msgKey, PR_TRUE, nsnull);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::MarkAllMessagesRead(nsIMsgWindow *aMsgWindow)
 {
-  // ### fix me need nsIMsgWindow
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   m_newMsgs.Clear();
   
   if (NS_SUCCEEDED(rv))
   {
     EnableNotifications(allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);
     nsTArray<nsMsgKey> thoseMarked;
     rv = mDatabase->MarkAllRead(&thoseMarked);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1387,17 +1386,17 @@ nsMsgDBFolder::MarkAllMessagesRead(nsIMs
 
   SetHasNewMessages(PR_FALSE);
  
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::MarkThreadRead(nsIMsgThread *thread)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   if(NS_SUCCEEDED(rv))
     return mDatabase->MarkThreadRead(thread, nsnull, nsnull);
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::OnStartRunningUrl(nsIURI *aUrl)
 {
@@ -1422,17 +1421,17 @@ nsMsgDBFolder::OnStopRunningUrl(nsIURI *
 
 NS_IMETHODIMP
 nsMsgDBFolder::GetRetentionSettings(nsIMsgRetentionSettings **settings)
 {
   NS_ENSURE_ARG_POINTER(settings);
   nsresult rv = NS_OK;
   if (!m_retentionSettings)
   {
-    GetDatabase(nsnull);
+    GetDatabase();
     if (mDatabase)
     {
       // get the settings from the db - if the settings from the db say the folder
       // is not overriding the incoming server settings, get the settings from the
       // server.
       rv = mDatabase->GetMsgRetentionSettings(getter_AddRefs(m_retentionSettings));
       if (NS_SUCCEEDED(rv) && m_retentionSettings)
       {
@@ -1450,29 +1449,29 @@ nsMsgDBFolder::GetRetentionSettings(nsIM
   }
   NS_IF_ADDREF(*settings = m_retentionSettings);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::SetRetentionSettings(nsIMsgRetentionSettings *settings)
 {
   m_retentionSettings = settings;
-  GetDatabase(nsnull);
+  GetDatabase();
   if (mDatabase)
     mDatabase->SetMsgRetentionSettings(settings);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::GetDownloadSettings(nsIMsgDownloadSettings **settings)
 {
   NS_ENSURE_ARG_POINTER(settings);
   nsresult rv = NS_OK;
   if (!m_downloadSettings)
   {
-    GetDatabase(nsnull);
+    GetDatabase();
     if (mDatabase)
     {
       // get the settings from the db - if the settings from the db say the folder
       // is not overriding the incoming server settings, get the settings from the
       // server.
       rv = mDatabase->GetMsgDownloadSettings(getter_AddRefs(m_downloadSettings));
       if (NS_SUCCEEDED(rv) && m_downloadSettings)
       {
@@ -1572,17 +1571,17 @@ nsresult nsMsgDBFolder::StartNewOfflineM
 
 nsresult nsMsgDBFolder::EndNewOfflineMessage()
 {
   nsCOMPtr <nsISeekableStream> seekable;
   nsInt64 curStorePos;
   PRUint32 messageOffset;
   nsMsgKey messageKey;
 
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   NS_ENSURE_SUCCESS(rv, rv);
 
   m_offlineHeader->GetMessageKey(&messageKey);
   if (m_tempMessageStream)
     seekable = do_QueryInterface(m_tempMessageStream);
 
   mDatabase->MarkOffline(messageKey, PR_TRUE, nsnull);
   if (seekable)
@@ -2026,17 +2025,17 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgW
     filterForJunk = PR_FALSE;
 
   spamSettings->GetLevel(&spamLevel);
   if (!spamLevel)
     filterForJunk = PR_FALSE;
 
   if (!mDatabase)
   {
-    rv = GetDatabase(nsnull);   // XXX is nsnull a reasonable arg here?
+    rv = GetDatabase();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // check if trait processing needed
 
   nsCOMPtr<nsIMsgTraitService> traitService(
       do_GetService("@mozilla.org/msg-trait-service;1", &rv));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -4230,17 +4229,17 @@ nsMsgDBFolder::MarkMessagesFlagged(nsIAr
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::SetLabelForMessages(nsIArray *aMessages, nsMsgLabelValue aLabel)
 {
   NS_ENSURE_ARG(aMessages);
-  GetDatabase(nsnull);
+  GetDatabase();
   if (mDatabase)
   {
     PRUint32 count;
     nsresult rv = aMessages->GetLength(&count);
     NS_ENSURE_SUCCESS(rv, rv);
     for(PRUint32 i = 0; i < count; i++)
     {
       nsMsgKey msgKey;
@@ -4254,17 +4253,17 @@ nsMsgDBFolder::SetLabelForMessages(nsIAr
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::SetJunkScoreForMessages(nsIArray *aMessages, const nsACString& junkScore)
 {
   NS_ENSURE_ARG(aMessages);
   nsresult rv = NS_OK;
-  GetDatabase(nsnull);
+  GetDatabase();
   if (mDatabase)
   {
     PRUint32 count;
     nsresult rv = aMessages->GetLength(&count);
     NS_ENSURE_SUCCESS(rv, rv);
 
     for(PRUint32 i = 0; i < count; i++)
     {
@@ -4288,17 +4287,17 @@ nsMsgDBFolder::ApplyRetentionSettings()
 nsresult nsMsgDBFolder::ApplyRetentionSettings(PRBool deleteViaFolder)
 {
   if (mFlags & nsMsgFolderFlags::Virtual) // ignore virtual folders.
     return NS_OK;
   nsresult rv;
   PRBool weOpenedDB = PR_FALSE;
   if (!mDatabase)
   {
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
     NS_ENSURE_SUCCESS(rv, rv);
     weOpenedDB = PR_TRUE;
   }
   if (mDatabase)
   {
     nsCOMPtr<nsIMsgRetentionSettings> retentionSettings;
     rv = GetRetentionSettings(getter_AddRefs(retentionSettings));
     if (NS_SUCCEEDED(rv))
@@ -5259,17 +5258,17 @@ void nsMsgDBFolder::SetMRUTime()
   nowStr.AppendInt(seconds);
   SetStringProperty(MRU_TIME_PROPERTY, nowStr);
 }
 
 NS_IMETHODIMP nsMsgDBFolder::AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords)
 {
   NS_ENSURE_ARG(aMessages);
   nsresult rv = NS_OK;
-  GetDatabase(nsnull);
+  GetDatabase();
   if (mDatabase)
   {
     PRUint32 count;
     nsresult rv = aMessages->GetLength(&count);
     NS_ENSURE_SUCCESS(rv, rv);
     nsCString keywords;
 
     for(PRUint32 i = 0; i < count; i++)
@@ -5303,17 +5302,17 @@ NS_IMETHODIMP nsMsgDBFolder::AddKeywords
   }
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords)
 {
   NS_ENSURE_ARG(aMessages);
   nsresult rv = NS_OK;
-  GetDatabase(nsnull);
+  GetDatabase();
   if (mDatabase)
   {
     PRUint32 count;
     nsresult rv = aMessages->GetLength(&count);
     NS_ENSURE_SUCCESS(rv, rv);
     nsCString keywords;
     // If the tag is also a label, we should remove the label too...
 
--- a/mailnews/base/util/nsMsgDBFolder.h
+++ b/mailnews/base/util/nsMsgDBFolder.h
@@ -131,17 +131,17 @@ protected:
   nsresult SetWarnFilterChanged(PRBool aVal);
   nsresult CreateCollationKey(const nsString &aSource,  PRUint8 **aKey, PRUint32 *aLength);
 
 protected:
   // all children will override this to create the right class of object.
   virtual nsresult CreateChildFromURI(const nsCString &uri, nsIMsgFolder **folder) = 0;
   virtual nsresult ReadDBFolderInfo(PRBool force);
   virtual nsresult FlushToFolderCache();
-  virtual nsresult GetDatabase(nsIMsgWindow *aMsgWindow) = 0;
+  virtual nsresult GetDatabase() = 0;
   virtual nsresult SendFlagNotifications(nsIMsgDBHdr *item, PRUint32 oldFlags, PRUint32 newFlags);
   nsresult CheckWithNewMessagesStatus(PRBool messageAdded);
   void     UpdateNewMessages();
   nsresult OnHdrAddedOrDeleted(nsIMsgDBHdr *hdrChanged, PRBool added);
   nsresult CreateFileForDB(const nsACString& userLeafName, nsILocalFile *baseDir, nsILocalFile **dbFile);
 
   nsresult GetFolderCacheKey(nsILocalFile **aFile, PRBool createDBIfMissing = PR_FALSE);
   nsresult GetFolderCacheElemFromFile(nsILocalFile *file, nsIMsgFolderCacheElement **cacheElement);
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -657,17 +657,17 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFo
     if (NS_FAILED(rv)) return rv;
   }
 
   return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
 }
 
 //Makes sure the database is open and exists.  If the database is valid then
 //returns NS_OK.  Otherwise returns a failure error value.
-nsresult nsImapMailFolder::GetDatabase(nsIMsgWindow *aMsgWindow)
+nsresult nsImapMailFolder::GetDatabase()
 {
   nsresult rv = NS_OK;
   if (!mDatabase)
   {
     nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Create the database, blowing it away if it needs to be rebuilt
@@ -743,17 +743,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFo
       {
         rv = CreateClientSubfolderInfo(NS_LITERAL_CSTRING("Inbox"), kOnlineHierarchySeparatorUnknown,0, PR_FALSE);
         NS_ENSURE_SUCCESS(rv, rv);
       }
       m_haveDiscoveredAllFolders = PR_TRUE;
     }
     selectFolder = PR_FALSE;
   }
-  rv = GetDatabase(msgWindow);
+  rv = GetDatabase();
   if (NS_FAILED(rv))
   {
     ThrowAlertMsg("errorGettingDB", msgWindow);
     return rv;
   }
   PRBool canOpenThisFolder = PR_TRUE;
   GetCanOpenFolder(&canOpenThisFolder);
 
@@ -817,17 +817,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFo
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapMailFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
 {
   NS_ENSURE_ARG_POINTER(result);
   if (!mDatabase)
-    GetDatabase(nsnull);
+    GetDatabase();
   if (mDatabase)
     return mDatabase->EnumerateMessages(result);
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP nsImapMailFolder::CreateSubfolder(const nsAString& folderName, nsIMsgWindow *msgWindow)
 {
   NS_ENSURE_TRUE(!folderName.IsEmpty(), NS_ERROR_FAILURE);
@@ -1182,17 +1182,17 @@ NS_IMETHODIMP nsImapMailFolder::SetExpli
 NS_IMETHODIMP nsImapMailFolder::GetNoSelect(PRBool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   return GetFlag(nsMsgFolderFlags::ImapNoselect, aResult);
 }
 
 NS_IMETHODIMP nsImapMailFolder::Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   // now's a good time to apply the retention settings. If we do delete any
   // messages, the expunge is going to have to wait until the delete to
   // finish before it can run, but the multiple-connection protection code
   // should handle that.
   if (mDatabase)
     ApplyRetentionSettings();
 
   // We're not compacting the offline store here since that can interfere
@@ -1722,17 +1722,17 @@ nsImapMailFolder::MarkMessagesRead(nsIAr
   if (NS_SUCCEEDED(rv))
   {
     nsCAutoString messageIds;
     nsTArray<nsMsgKey> keysToMarkRead;
     rv = BuildIdsAndKeyArray(messages, messageIds, keysToMarkRead);
     if (NS_FAILED(rv)) return rv;
 
     StoreImapFlags(kImapMsgSeenFlag, markRead,  keysToMarkRead.Elements(), keysToMarkRead.Length(), nsnull);
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
     if (NS_SUCCEEDED(rv))
       mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
   }
   return rv;
 }
 
 NS_IMETHODIMP
 nsImapMailFolder::SetLabelForMessages(nsIArray *aMessages, nsMsgLabelValue aLabel)
@@ -1742,27 +1742,27 @@ nsImapMailFolder::SetLabelForMessages(ns
   nsresult rv = nsMsgDBFolder::SetLabelForMessages(aMessages, aLabel);
   if (NS_SUCCEEDED(rv))
   {
     nsCAutoString messageIds;
     nsTArray<nsMsgKey> keysToLabel;
     nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keysToLabel);
     NS_ENSURE_SUCCESS(rv, rv);
     StoreImapFlags((aLabel << 9), PR_TRUE, keysToLabel.Elements(), keysToLabel.Length(), nsnull);
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
     if (NS_SUCCEEDED(rv))
       mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
   }
   return rv;
 }
 
 NS_IMETHODIMP
 nsImapMailFolder::MarkAllMessagesRead(nsIMsgWindow *aMsgWindow)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   if(NS_SUCCEEDED(rv))
   {
     nsTArray<nsMsgKey> thoseMarked;
     EnableNotifications(allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);
     rv = mDatabase->MarkAllRead(&thoseMarked);
     EnableNotifications(allMessageCountNotifications, PR_TRUE, PR_TRUE /*dbBatching*/);
     if (NS_SUCCEEDED(rv))
     {
@@ -1792,17 +1792,17 @@ nsImapMailFolder::MarkAllMessagesRead(ns
       }
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapMailFolder::MarkThreadRead(nsIMsgThread *thread)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   if(NS_SUCCEEDED(rv))
   {
     nsTArray<nsMsgKey> thoseMarked;
     rv = mDatabase->MarkThreadRead(thread, nsnull, &thoseMarked);
     if (NS_SUCCEEDED(rv))
     {
       rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.Elements(),
                           thoseMarked.Length(), nsnull);
@@ -1910,17 +1910,17 @@ NS_IMETHODIMP nsImapMailFolder::GetOnlin
 }
 
 NS_IMETHODIMP
 nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatabase **db)
 {
   NS_ENSURE_ARG_POINTER (folderInfo);
   NS_ENSURE_ARG_POINTER (db);
 
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   if (NS_FAILED(rv))
     return rv;
 
   NS_ADDREF(*db = mDatabase);
 
   rv = (*db)->GetDBFolderInfo(folderInfo);
   if (NS_FAILED(rv))
     return rv; //GetDBFolderInfo can't return NS_OK if !folderInfo
@@ -2476,17 +2476,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateIm
 {
   nsresult rv;
   ChangeNumPendingTotalMessages(-GetNumPendingTotalMessages());
   ChangeNumPendingUnread(-GetNumPendingUnread());
   m_numStatusRecentMessages = 0; // clear this since we selected the folder.
   m_numStatusUnseenMessages = 0; // clear this since we selected the folder.
 
   if (!mDatabase)
-    GetDatabase(nsnull);
+    GetDatabase();
 
   PRBool folderSelected;
   rv = aSpec->GetFolderSelected(&folderSelected);
   NS_ENSURE_SUCCESS(rv, rv);
   nsTArray<nsMsgKey> existingKeys;
   nsTArray<nsMsgKey> keysToDelete;
   nsTArray<nsMsgKey> keysToFetch;
   PRUint32 numNewUnread;
@@ -2705,17 +2705,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateIm
 
 NS_IMETHODIMP nsImapMailFolder::ParseMsgHdrs(nsIImapProtocol *aProtocol, nsIImapHeaderXferInfo *aHdrXferInfo)
 {
   PRInt32 numHdrs;
   nsCOMPtr <nsIImapHeaderInfo> headerInfo;
   nsCOMPtr <nsIImapUrl> aImapUrl;
   nsImapAction imapAction = nsIImapUrl::nsImapTest; // unused value.
   if (!mDatabase)
-    GetDatabase(nsnull);
+    GetDatabase();
 
   nsresult rv = aHdrXferInfo->GetNumHeaders(&numHdrs);
   if (aProtocol)
   {
     (void) aProtocol->GetRunningImapURL(getter_AddRefs(aImapUrl));
     if (aImapUrl)
       aImapUrl->GetImapAction(&imapAction);
   }
@@ -2761,17 +2761,17 @@ NS_IMETHODIMP nsImapMailFolder::ParseMsg
   }
   return rv;
 }
 
 nsresult nsImapMailFolder::SetupHeaderParseStream(PRUint32 aSize,
                                                   const nsACString& content_type, nsIMailboxSpec *boxSpec)
 {
   if (!mDatabase)
-    GetDatabase(nsnull);
+    GetDatabase();
   m_nextMessageByteLength = aSize;
   if (!m_msgParser)
   {
     nsresult rv;
     m_msgParser = do_CreateInstance(kParseMailMsgStateCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else
@@ -3465,17 +3465,17 @@ NS_IMETHODIMP nsImapMailFolder::StoreIma
       imapService->AddMessageFlags(m_thread, this, aUrlListener ? aUrlListener : this,
                                    nsnull, msgIds, flags, PR_TRUE);
     else
       imapService->SubtractMessageFlags(m_thread, this, aUrlListener ? aUrlListener : this,
                                         nsnull, msgIds, flags, PR_TRUE);
   }
   else
   {
-    GetDatabase(nsnull);
+    GetDatabase();
     if (mDatabase)
     {
       PRUint32 total = numKeys;
       for (PRUint32 keyIndex = 0; keyIndex < total; keyIndex++)
       {
         nsCOMPtr <nsIMsgOfflineImapOperation> op;
         rv = mDatabase->GetOfflineOpForKey(keys[keyIndex], PR_TRUE, getter_AddRefs(op));
         SetFlag(nsMsgFolderFlags::OfflineEvents);
@@ -3993,17 +3993,17 @@ NS_IMETHODIMP nsImapMailFolder::Download
   PRBool noSelect;
   GetFlag(nsMsgFolderFlags::ImapNoselect, &noSelect);
 
   if (!noSelect)
   {
     nsCAutoString messageIdsToDownload;
     nsTArray<nsMsgKey> msgsToDownload;
 
-    GetDatabase(msgWindow);
+    GetDatabase();
     m_downloadingFolderForOfflineUse = PR_TRUE;
 
     rv = AcquireSemaphore(static_cast<nsIMsgImapMailFolder*>(this));
     if (NS_FAILED(rv))
     {
       m_downloadingFolderForOfflineUse = PR_FALSE;
       ThrowAlertMsg("operationFailedFolderBusy", msgWindow);
       return rv;
@@ -4206,17 +4206,17 @@ nsresult nsImapMailFolder::HandleCustomF
       dbHdr->SetStringProperty("junkscoreorigin", "imapflag");
   }
   return dbHdr->SetStringProperty("keywords", keywords.get());
 }
 
 // synchronize the message flags in the database with the server flags
 nsresult nsImapMailFolder::SyncFlags(nsIImapFlagAndUidState *flagState)
 {
-  nsresult rv = GetDatabase(nsnull); // we need a database for this
+  nsresult rv = GetDatabase(); // we need a database for this
   NS_ENSURE_SUCCESS(rv, rv);
     // update all of the database flags
   PRInt32 messageIndex;
   PRUint32 messageSize;
   PRUint32 oldFolderSize = mFolderSize;
   // take this opportunity to recalculate the folder size:
   mFolderSize = 0;
   flagState->GetNumberOfMessages(&messageIndex);
@@ -4283,17 +4283,17 @@ nsresult nsImapMailFolder::NotifyMessage
   return NS_OK;
 }
 
 // message flags operation - this is called from the imap protocol,
 // proxied over from the imap thread to the ui thread, when a flag changes
 NS_IMETHODIMP
 nsImapMailFolder::NotifyMessageFlags(PRUint32 aFlags, nsMsgKey aMsgKey, PRUint64 aHighestModSeq)
 {
-  if (NS_SUCCEEDED(GetDatabase(nsnull)) && mDatabase)
+  if (NS_SUCCEEDED(GetDatabase()) && mDatabase)
   {
     PRBool msgDeleted = aFlags & kImapMsgDeletedFlag;
     if (aHighestModSeq || msgDeleted)
     {
       nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
       mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
       if (dbFolderInfo)
       {
@@ -4332,17 +4332,17 @@ nsImapMailFolder::NotifyMessageDeleted(c
   if (deleteAllMsgs)
     return NS_OK;
 
   nsTArray<nsMsgKey> affectedMessages;
   ParseUidString(msgIdString, affectedMessages);
 
   if (msgIdString && !ShowDeletedMessages())
   {
-    GetDatabase(nsnull);
+    GetDatabase();
     NS_ENSURE_TRUE(mDatabase, NS_OK);
     if (!ShowDeletedMessages())
     {
       if (!affectedMessages.IsEmpty()) // perhaps Search deleted these messages
           mDatabase->DeleteMessages(&affectedMessages, nsnull);
     }
     else // && !imapDeleteIsMoveToTrash
       SetIMAPDeletedFlag(mDatabase, affectedMessages, nsnull);
@@ -4403,17 +4403,17 @@ void nsImapMailFolder::SetIMAPDeletedFla
 }
 
 NS_IMETHODIMP
 nsImapMailFolder::GetMessageSizeFromDB(const char * id, PRUint32 *size)
 {
   NS_ENSURE_ARG_POINTER(size);
   nsresult rv;
   *size = 0;
-  (void) GetDatabase(nsnull);
+  (void) GetDatabase();
   if (id && mDatabase)
   {
     PRUint32 key = atoi(id);
     nsCOMPtr<nsIMsgDBHdr> mailHdr;
     rv = mDatabase->GetMsgHdrForKey(key, getter_AddRefs(mailHdr));
     if (NS_SUCCEEDED(rv) && mailHdr)
       rv = mailHdr->GetMessageSize(size);
   }
@@ -4978,17 +4978,17 @@ nsImapMailFolder::EndMessage(nsIMsgMailN
 }
 
 #define WHITESPACE " \015\012"     // token delimiter
 
 NS_IMETHODIMP
 nsImapMailFolder::NotifySearchHit(nsIMsgMailNewsUrl * aUrl,
                                   const char* searchHitLine)
 {
-  nsresult rv = GetDatabase(nsnull /* don't need msg window, that's more for local mbox parsing */);
+  nsresult rv = GetDatabase();
   if (!mDatabase || NS_FAILED(rv))
     return rv;
   
   // expect search results in the form of "* SEARCH <hit> <hit> ..."
   // expect search results in the form of "* SEARCH <hit> <hit> ..."
   nsCString tokenString(searchHitLine);
   char *currentPosition = PL_strcasestr(tokenString.get(), "SEARCH");
   if (currentPosition)
@@ -5352,17 +5352,17 @@ nsImapMailFolder::FillInFolderProps(nsIM
 
 NS_IMETHODIMP nsImapMailFolder::SetAclFlags(PRUint32 aclFlags)
 {
   nsresult rv = NS_OK;
   if (m_aclFlags != aclFlags)
   {
     nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
     PRBool dbWasOpen = (mDatabase != nsnull);
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
 
     m_aclFlags = aclFlags;
     if (mDatabase)
     {
       rv = mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
       if (NS_SUCCEEDED(rv) && dbFolderInfo)
         dbFolderInfo->SetUint32Property("aclFlags", aclFlags);
       // if setting the acl flags caused us to open the db, release the ref
@@ -5382,17 +5382,17 @@ NS_IMETHODIMP nsImapMailFolder::GetAclFl
 {
   NS_ENSURE_ARG_POINTER(aclFlags);
   nsresult rv;
   ReadDBFolderInfo(PR_FALSE); // update cache first.
   if (m_aclFlags == -1) // -1 means invalid value, so get it from db.
   {
     nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
     PRBool dbWasOpen = (mDatabase != nsnull);
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
 
     if (mDatabase)
     {
       rv = mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
       if (NS_SUCCEEDED(rv) && dbFolderInfo)
       {
         rv = dbFolderInfo->GetUint32Property("aclFlags", 0, aclFlags);
         m_aclFlags = *aclFlags;
@@ -5410,17 +5410,17 @@ NS_IMETHODIMP nsImapMailFolder::GetAclFl
   else
     *aclFlags = m_aclFlags;
   return NS_OK;
 }
 
 nsresult nsImapMailFolder::SetSupportedUserFlags(PRUint32 userFlags)
 {
   nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
 
   m_supportedUserFlags = userFlags;
   if (mDatabase)
   {
     rv = mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
     if (NS_SUCCEEDED(rv) && dbFolderInfo)
       dbFolderInfo->SetUint32Property("imapFlags", userFlags);
   }
@@ -5432,17 +5432,17 @@ nsresult nsImapMailFolder::GetSupportedU
   NS_ENSURE_ARG_POINTER(userFlags);
 
   nsresult rv = NS_OK;
 
   ReadDBFolderInfo(PR_FALSE); // update cache first.
   if (m_supportedUserFlags == 0) // 0 means invalid value, so get it from db.
   {
     nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
 
     if (mDatabase)
     {
       rv = mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
       if (NS_SUCCEEDED(rv) && dbFolderInfo)
       {
         rv = dbFolderInfo->GetUint32Property("imapFlags", 0, userFlags);
         m_supportedUserFlags = *userFlags;
@@ -6270,17 +6270,17 @@ nsresult nsImapMailFolder::CopyMessagesO
   if (sourceMailDB)
   {
     // save the future ops in the source DB, if this is not a imap->local copy/move
     nsCOMPtr <nsITransactionManager> txnMgr;
     if (msgWindow)
       msgWindow->GetTransactionManager(getter_AddRefs(txnMgr));
     if (txnMgr)
       txnMgr->BeginBatch();
-    GetDatabase(nsnull);
+    GetDatabase();
     if (mDatabase)
     {
       // get the highest key in the dest db, so we can make up our fake keys
       nsMsgKey fakeBase = 1;
       nsCOMPtr <nsIDBFolderInfo> folderInfo;
       rv = mDatabase->GetDBFolderInfo(getter_AddRefs(folderInfo));
       NS_ENSURE_SUCCESS(rv, rv);
       nsMsgKey highWaterMark = nsMsgKey_None;
@@ -6611,17 +6611,17 @@ nsImapMailFolder::CopyMessages(nsIMsgFol
 
   PRUint32 i;
 
   rv = messages->GetLength(&count);
   if (NS_FAILED(rv)) return rv;
 
   // make sure database is open to set special flags below
   if (!mDatabase)
-    GetDatabase(nsnull);
+    GetDatabase();
 
   // check if any msg hdr has special flags or properties set
   // that we need to set on the dest hdr
   for (i = 0; i < count; i++)
   {
     nsCOMPtr <nsIMsgDBHdr> msgDBHdr = do_QueryElementAt(messages, i, &rv);
     if (mDatabase && msgDBHdr)
     {
@@ -7883,17 +7883,17 @@ nsImapMailFolder::SpamFilterClassifyMess
 
 NS_IMETHODIMP
 nsImapMailFolder::StoreCustomKeywords(nsIMsgWindow *aMsgWindow, const nsACString& aFlagsToAdd,
                                       const nsACString& aFlagsToSubtract, nsMsgKey *aKeysToStore, PRUint32 aNumKeys, nsIURI **_retval)
 {
   nsresult rv;
   if (WeAreOffline())
   {
-    GetDatabase(nsnull);
+    GetDatabase();
     if (mDatabase)
     {
       for (PRUint32 keyIndex = 0; keyIndex < aNumKeys; keyIndex++)
       {
         nsCOMPtr <nsIMsgOfflineImapOperation> op;
         rv = mDatabase->GetOfflineOpForKey(aKeysToStore[keyIndex], PR_TRUE, getter_AddRefs(op));
         SetFlag(nsMsgFolderFlags::OfflineEvents);
         if (NS_SUCCEEDED(rv) && op)
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -383,17 +383,17 @@ protected:
   nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
   PRBool TrashOrDescendentOfTrash(nsIMsgFolder* folder);
   nsresult GetServerKey(nsACString& serverKey);
   nsresult DisplayStatusMsg(nsIImapUrl *aImapUrl, const nsAString& msg);
 
   //nsresult RenameLocal(const char *newName);
   nsresult AddDirectorySeparator(nsILocalFile *path);
   nsresult CreateSubFolders(nsILocalFile *path);
-  nsresult GetDatabase(nsIMsgWindow *aMsgWindow);
+  nsresult GetDatabase();
   virtual void GetIncomingServerType(nsCString& serverType) { serverType.AssignLiteral("imap");}
 
   nsresult        GetFolderOwnerUserName(nsACString& userName);
   nsIMAPNamespace *GetNamespaceForFolder();
   void            SetNamespaceForFolder(nsIMAPNamespace *ns);
 
   nsMsgIMAPFolderACL * GetFolderACL();
   nsresult CreateACLRightsStringForFolder(nsAString& rightsString);
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -440,17 +440,17 @@ nsMsgLocalMailFolder::GetSubFolders(nsIS
       }
     }
     UpdateSummaryTotals(PR_FALSE);
   }
 
   return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
 }
 
-nsresult nsMsgLocalMailFolder::GetDatabase(nsIMsgWindow *aMsgWindow)
+nsresult nsMsgLocalMailFolder::GetDatabase()
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
   return GetDatabaseWOReparse(getter_AddRefs(msgDB));
 }
 
 //we treat failure as null db returned
 NS_IMETHODIMP nsMsgLocalMailFolder::GetDatabaseWOReparse(nsIMsgDatabase **aDatabase)
 {
@@ -3855,17 +3855,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::AddK
 }
 nsresult nsMsgLocalMailFolder::ChangeKeywordForMessages(nsIArray *aMessages, const nsACString& aKeywords, PRBool add)
 {
   nsresult rv = (add) ? nsMsgDBFolder::AddKeywordsToMessages(aMessages, aKeywords)
                       : nsMsgDBFolder::RemoveKeywordsFromMessages(aMessages, aKeywords);
 
   if (NS_SUCCEEDED(rv))
   {
-    rv = GetDatabase(nsnull);
+    rv = GetDatabase();
     NS_ENSURE_SUCCESS(rv, rv);
     // this will fail if the folder is locked.
     rv = mDatabase->StartBatch();
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr <nsIOutputStream> fileStream;
     rv = mDatabase->GetFolderStream(getter_AddRefs(fileStream));
     nsCOMPtr <nsISeekableStream> seekableStream = do_QueryInterface(fileStream);
     nsCOMPtr <nsIInputStream> inputStream = do_QueryInterface(fileStream);
--- a/mailnews/local/src/nsLocalMailFolder.h
+++ b/mailnews/local/src/nsLocalMailFolder.h
@@ -213,17 +213,17 @@ protected:
                                    nsIMsgFolder **aNewFolder);
 
   nsresult IsChildOfTrash(PRBool *result);
   nsresult RecursiveSetDeleteIsMoveTrash(PRBool bVal);
   nsresult ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, nsIMsgFolder *aFolder, PRBool *aResult);
 
   nsresult DeleteMessage(nsISupports *message, nsIMsgWindow *msgWindow,
                    PRBool deleteStorage, PRBool commit);
-  nsresult GetDatabase(nsIMsgWindow *msgWindow);
+  nsresult GetDatabase();
 
   // copy message helper
   nsresult DisplayMoveCopyStatusMsg();
   nsresult SortMessagesBasedOnKey(nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder, nsIMutableArray* messages);
 
   nsresult CopyMessageTo(nsISupports *message, nsIMsgFolder *dstFolder,
                          nsIMsgWindow *msgWindow, PRBool isMove);
 
--- a/mailnews/news/src/nsNewsFolder.cpp
+++ b/mailnews/news/src/nsNewsFolder.cpp
@@ -283,17 +283,17 @@ nsMsgNewsFolder::GetSubFolders(nsISimple
     (void)UpdateSummaryTotals(PR_FALSE);
   }
 
   return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
 }
 
 //Makes sure the database is open and exists.  If the database is valid then
 //returns NS_OK.  Otherwise returns a failure error value.
-nsresult nsMsgNewsFolder::GetDatabase(nsIMsgWindow *aMsgWindow)
+nsresult nsMsgNewsFolder::GetDatabase()
 {
   nsresult rv;
   if (!mDatabase)
   {
     nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
     // Get the database, blowing it away if it's out of date.
@@ -328,17 +328,17 @@ nsMsgNewsFolder::UpdateFolder(nsIMsgWind
   nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   PRBool getMessagesOnSelect = PR_TRUE;
   prefBranch->GetBoolPref("news.get_messages_on_select", &getMessagesOnSelect);
 
   // Only if news.get_messages_on_select is true do we get new messages automatically
   if (getMessagesOnSelect)
   {
-    rv = GetDatabase(aWindow); // want this cached...
+    rv = GetDatabase(); // want this cached...
     if (NS_SUCCEEDED(rv))
     {
       if (mDatabase)
       {
         nsCOMPtr<nsIMsgRetentionSettings> retentionSettings;
         nsresult rv = GetRetentionSettings(getter_AddRefs(retentionSettings));
         if (NS_SUCCEEDED(rv))
           rv = mDatabase->ApplyRetentionSettings(retentionSettings, PR_FALSE);
@@ -416,17 +416,17 @@ nsMsgNewsFolder::GetCanCompact(PRBool *a
   *aResult = PR_FALSE;
   // you can't compact a news server or a news group
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgNewsFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
 {
-  nsresult rv = GetDatabase(aMsgWindow);
+  nsresult rv = GetDatabase();
   *result = nsnull;
 
   if(NS_SUCCEEDED(rv))
     rv = mDatabase->EnumerateMessages(result);
 
   return rv;
 }
 
@@ -514,17 +514,17 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateSub
     if (notifier)
       notifier->NotifyFolderAdded(child);
   }
   return rv;
 }
 
 NS_IMETHODIMP nsMsgNewsFolder::Delete()
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
 
   if(NS_SUCCEEDED(rv))
   {
     mDatabase->ForceClosed();
     mDatabase = nsnull;
   }
 
   nsCOMPtr<nsILocalFile> folderPath;
@@ -682,17 +682,17 @@ nsresult nsMsgNewsFolder::AbbreviatePret
 }
 
 NS_IMETHODIMP
 nsMsgNewsFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatabase **db)
 {
   NS_ENSURE_ARG_POINTER(folderInfo);
   NS_ENSURE_ARG_POINTER(db);
   nsresult openErr;
-  openErr = GetDatabase(nsnull);
+  openErr = GetDatabase();
   *db = mDatabase;
   if (mDatabase) {
     NS_ADDREF(*db);
     if (NS_SUCCEEDED(openErr))
       openErr = (*db)->GetDBFolderInfo(folderInfo);
   }
   return openErr;
 }
@@ -1628,17 +1628,17 @@ nsMsgNewsFolder::GetNntpServer(nsINntpIn
   nntpServer.swap(*result);
   return NS_OK;
 }
 
 // this gets called after the message actually gets cancelled
 // it removes the cancelled message from the db
 NS_IMETHODIMP nsMsgNewsFolder::RemoveMessage(nsMsgKey key)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   NS_ENSURE_SUCCESS(rv, rv); // if GetDatabase succeeds, mDatabase will be non-null
 
   // Notify listeners of a delete for a single message
   nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
   if (notifier)
   {
     nsCOMPtr<nsIMsgDBHdr> msgHdr;
     rv = mDatabase->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
@@ -1649,17 +1649,17 @@ NS_IMETHODIMP nsMsgNewsFolder::RemoveMes
 
     notifier->NotifyMsgsDeleted(msgHdrs);
   }
   return mDatabase->DeleteMessage(key, nsnull, PR_FALSE);
 }
 
 NS_IMETHODIMP nsMsgNewsFolder::RemoveMessages(nsTArray<nsMsgKey> &aMsgKeys)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   NS_ENSURE_SUCCESS(rv, rv); // if GetDatabase succeeds, mDatabase will be non-null
   
   // Notify listeners of a multiple message delete
   nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
 
   if (notifier)
   {
     nsCOMPtr<nsIMutableArray> msgHdrs(do_CreateInstance(NS_ARRAY_CONTRACTID));
@@ -1805,31 +1805,31 @@ NS_IMETHODIMP nsMsgNewsFolder::NotifyFin
   ChangeNumPendingTotalMessages(-GetNumPendingTotalMessages());
   ChangeNumPendingUnread(-GetNumPendingUnread());
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgNewsFolder::Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow)
 {
   nsresult rv;
-  rv = GetDatabase(nsnull);
+  rv = GetDatabase();
   if (mDatabase)
     ApplyRetentionSettings();
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgNewsFolder::ApplyRetentionSettings()
 {
   return nsMsgDBFolder::ApplyRetentionSettings(PR_FALSE);
 }
 
 NS_IMETHODIMP nsMsgNewsFolder::GetMessageIdForKey(nsMsgKey key, nsACString& result)
 {
-  nsresult rv = GetDatabase(nsnull);
+  nsresult rv = GetDatabase();
   if (!mDatabase)
     return rv;
   nsCOMPtr <nsIMsgDBHdr> hdr;
   rv = mDatabase->GetMsgHdrForKey(key, getter_AddRefs(hdr));
   NS_ENSURE_SUCCESS(rv,rv);
   return hdr->GetMessageId(getter_Copies(result));
 }
 
--- a/mailnews/news/src/nsNewsFolder.h
+++ b/mailnews/news/src/nsNewsFolder.h
@@ -113,17 +113,17 @@ public:
   NS_IMETHOD ApplyRetentionSettings();
 
 protected:
   // helper routine to parse the URI and update member variables
   nsresult AbbreviatePrettyName(nsAString& prettyName, PRInt32 fullwords);
   nsresult ParseFolder(nsILocalFile *path);
   nsresult CreateSubFolders(nsILocalFile *path);
   nsresult AddDirectorySeparator(nsILocalFile *path);
-  nsresult GetDatabase(nsIMsgWindow *aMsgWindow);
+  nsresult GetDatabase();
   virtual nsresult CreateChildFromURI(const nsCString &uri, nsIMsgFolder **folder);
 
   nsresult LoadNewsrcFileAndCreateNewsgroups();
   PRInt32 RememberLine(const nsACString& line);
   nsresult RememberUnsubscribedGroup(const nsACString& newsgroup, const nsACString& setStr);
   nsresult ForgetLine(void);
   nsresult GetNewsMessages(nsIMsgWindow *aMsgWindow, PRBool getOld, nsIUrlListener *aListener);