From c27cba2068535dfb69d646a24042b1040f6a5923 Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Thu, 2 Dec 1999 01:05:31 +0000 Subject: [PATCH] fix pop move msg filters to truncate inbox r=mscott, #18030 --- mailnews/local/src/nsParseMailbox.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index 9e4c858e2920..f9761801d1ae 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -259,7 +259,6 @@ int nsMsgMailboxParser::ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream * return (ret); } - void nsMsgMailboxParser::DoneParsingFolder() { /* End of file. Flush out any partial line remaining in the buffer. */ @@ -658,7 +657,6 @@ NS_IMETHODIMP nsParseMailMessageState::GetAllHeaders(char ** pHeaders, PRInt32 * return NS_OK; } - struct message_header *nsParseMailMessageState::GetNextHeaderInAggregate (nsVoidArray &list) { // When parsing a message with multiple To or CC header lines, we're storing each line in a @@ -1867,7 +1865,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr, // truncate destination file in case message was partially written // ### how to do this with a stream? -// destFile->truncate(destFolder,xpMailFolder,newMsgPos); + destFolderSpec.Truncate(newMsgPos); if (lockedFolder) lockedFolder->ReleaseSemaphore(myISupports); @@ -1908,9 +1906,15 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr, } destFile->close(); + m_inboxFileStream->close(); // How are we going to do this with a stream? -// int truncRet = XP_FileTruncate(m_mailboxName, xpMailFolder, messageOffset); -// NS_ASSERTION(truncRet >= 0, "unable to truncate file"); + nsresult truncRet = m_inboxFileSpec.Truncate(messageOffset); + NS_ASSERTION(NS_SUCCEEDED(truncRet), "unable to truncate file"); + + // need to re-open the inbox file stream. + m_inboxFileStream->Open(m_inboxFileSpec, (PR_RDWR | PR_CREATE_FILE)); + if (m_inboxFileStream) + m_inboxFileStream->seek(m_inboxFileSpec.GetFileSize()); if (lockedFolder) lockedFolder->ReleaseSemaphore (myISupports);