diff --git a/mailnews/local/src/nsMailboxProtocol.cpp b/mailnews/local/src/nsMailboxProtocol.cpp index 163d27ed529..57da28dc71c 100644 --- a/mailnews/local/src/nsMailboxProtocol.cpp +++ b/mailnews/local/src/nsMailboxProtocol.cpp @@ -140,7 +140,7 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopRequest(nsIChannel * aChannel, nsISupport if (m_nextState == MAILBOX_READ_FOLDER && m_mailboxParser) { // we need to inform our mailbox parser that there is no more incoming data... - m_mailboxParser->OnStopRequest(aChannel, ctxt, 0, nsnull); + m_mailboxParser->OnStopRequest(aChannel, ctxt, aStatus, nsnull); } else if (m_nextState == MAILBOX_READ_MESSAGE) { diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index 6138402b0c0..1d37052b60f 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -126,7 +126,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, ns // stop binding is a "notification" informing us that the stream associated with aURL is going away. NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIChannel * /* aChannel */, nsISupports *ctxt, nsresult aStatus, const PRUnichar *aMsg) { - DoneParsingFolder(); + DoneParsingFolder(aStatus); // what can we do? we can close the stream? m_urlInProgress = PR_FALSE; // don't close the connection...we may be re-using it. @@ -259,13 +259,14 @@ int nsMsgMailboxParser::ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream * return (ret); } -void nsMsgMailboxParser::DoneParsingFolder() +void nsMsgMailboxParser::DoneParsingFolder(nsresult status) { /* End of file. Flush out any partial line remaining in the buffer. */ FlushLastLine(); PublishMsgHeader(); - if (m_mailDB) // finished parsing, so flush db folder info + // only mark the db valid if we've succeeded. + if (NS_SUCCEEDED(status) && m_mailDB) // finished parsing, so flush db folder info UpdateDBFolderInfo(); // if (m_folder != nsnull) @@ -1503,7 +1504,7 @@ nsParseNewMailState::~nsParseNewMailState() // This gets called for every message because libnet calls IncorporateBegin, // IncorporateWrite (once or more), and IncorporateComplete for every message. -void nsParseNewMailState::DoneParsingFolder() +void nsParseNewMailState::DoneParsingFolder(nsresult status) { PRBool moved = PR_FALSE; /* End of file. Flush out any partial line remaining in the buffer. */ @@ -1980,9 +1981,9 @@ void ParseIMAPMailboxState::SetPublishByteLength(PRUint32 byteLength) fNextMessageByteLength = byteLength; } -void ParseIMAPMailboxState::DoneParsingFolder() +void ParseIMAPMailboxState::DoneParsingFolder(nsresult status) { - nsMsgMailboxParser::DoneParsingFolder(); + nsMsgMailboxParser::DoneParsingFolder(status); if (m_mailDB) { // make sure the highwater mark is correct diff --git a/mailnews/local/src/nsParseMailbox.h b/mailnews/local/src/nsParseMailbox.h index 42248d13bd4..739732f9d87 100644 --- a/mailnews/local/src/nsParseMailbox.h +++ b/mailnews/local/src/nsParseMailbox.h @@ -161,7 +161,7 @@ public: // message socket libnet callbacks, which come through folder pane virtual int ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength); - virtual void DoneParsingFolder(); + virtual void DoneParsingFolder(nsresult status); virtual void AbortNewHeader(); virtual PRInt32 HandleLine(char *line, PRUint32 line_length); @@ -211,7 +211,7 @@ public: NS_DECL_ISUPPORTS_INHERITED nsresult Init(nsIFolder *rootFolder, nsFileSpec &folder, nsIOFileStream *inboxFileStream); - virtual void DoneParsingFolder(); + virtual void DoneParsingFolder(nsresult status); virtual void SetUsingTempDB(PRBool usingTempDB, char *tmpDBName); void DisableFilters() {m_disableFilters = PR_TRUE;} @@ -260,7 +260,7 @@ public: virtual ~ParseIMAPMailboxState(); // close the db - virtual void DoneParsingFolder(); + virtual void DoneParsingFolder(nsresult status); virtual void SetPublishUID(PRInt32 uid); virtual void SetPublishByteLength(PRUint32 byteLength);