fix 64456, cache file stream when updating multiple local messages, r=sspitzer, sr=mscott, also 63804 problem with compacting local folder

This commit is contained in:
bienvenu%netscape.com 2001-01-08 19:21:25 +00:00
Родитель e1680af5b8
Коммит 2eee40eebc
1 изменённых файлов: 15 добавлений и 6 удалений

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

@ -1101,8 +1101,6 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Compact(nsIUrlListener *aListener)
rv = NS_ERROR_OUT_OF_MEMORY; goto done;
}
NotifyStoreClosedAllHeaders();
rv = GetMsgDatabase(nsnull, getter_AddRefs(db));
if (NS_FAILED(rv)) goto done;
@ -1763,9 +1761,11 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
NS_WITH_SERVICE(nsIMsgCopyService, copyService, kMsgCopyServiceCID,
&rv);
if (NS_SUCCEEDED(rv))
{
return copyService->CopyMessages(this, messages, trashFolder,
PR_TRUE, nsnull, msgWindow);
}
}
return rv;
}
else
@ -1790,6 +1790,7 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
DeleteMsgsOnPop3Server(messages);
if (NS_FAILED(rv)) return rv;
EnableNotifications(allMessageCountNotifications, PR_FALSE);
for(PRUint32 i = 0; i < messageCount; i++)
{
msgSupport = getter_AddRefs(messages->ElementAt(i));
@ -1800,6 +1801,7 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
DeleteMessage(message, msgWindow, PR_TRUE);
}
}
EnableNotifications(allMessageCountNotifications, PR_TRUE);
if(!isMove)
NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
}
@ -1916,6 +1918,10 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
nsCOMPtr<nsISupports> aSupport(do_QueryInterface(srcFolder, &rv));
if (NS_FAILED(rv)) return rv;
// make sure we turn notifications on when the move is done!
if (isMove)
srcFolder->EnableNotifications(allMessageCountNotifications, PR_FALSE);
rv = InitCopyState(aSupport, messages, isMove, listener, msgWindow);
if (NS_FAILED(rv)) return rv;
char *uri = nsnull;
@ -2500,9 +2506,12 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndMove()
if (NS_SUCCEEDED(result))
{
//Notify that a completion finished.
nsCOMPtr<nsIFolder> srcFolder = do_QueryInterface(mCopyState->m_srcSupport);
nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryInterface(mCopyState->m_srcSupport);
if(srcFolder)
{
// lets delete these all at once - much faster that way
result = srcFolder->DeleteMessages(mCopyState->m_messages, nsnull, PR_TRUE, PR_TRUE);
srcFolder->EnableNotifications(allMessageCountNotifications, PR_TRUE);
srcFolder->NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
}