From 0cfef23aaa8bda745448d397fda3d259c308cd65 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Fri, 11 Jun 1999 02:44:06 +0000 Subject: [PATCH] When displaying a message (writing it to a file), we should skip the first line of the message which is part of the dummy envelope for the message. We don't want to include this line. git-svn-id: svn://10.0.0.236/trunk@34740 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/local/src/nsMailboxProtocol.cpp | 10 +++++++--- mozilla/mailnews/local/src/nsMailboxProtocol.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mozilla/mailnews/local/src/nsMailboxProtocol.cpp b/mozilla/mailnews/local/src/nsMailboxProtocol.cpp index 04d863b1397..7bae32bd539 100644 --- a/mozilla/mailnews/local/src/nsMailboxProtocol.cpp +++ b/mozilla/mailnews/local/src/nsMailboxProtocol.cpp @@ -243,7 +243,7 @@ nsresult nsMailboxProtocol::LoadUrl(nsIURL * aURL, nsISupports * aConsumer) // create a temp file to write the message into. We need to do this because // we don't have pluggable converters yet. We want to let mkfile do the work of // converting the message from RFC-822 to HTML before displaying it... - + ClearFlag(MAILBOX_MSG_PARSE_FIRST_LINE); m_tempMessageFile->openStreamForWriting(); SetupMessageExtraction(); m_nextState = MAILBOX_READ_MESSAGE; @@ -336,14 +336,18 @@ PRInt32 nsMailboxProtocol::ReadMessageResponse(nsIInputStream * inputStream, PRU the local system will convert that to the local line terminator as it is read. */ - - if (m_tempMessageFile) + // mscott - the firstline hack is aimed at making sure we don't write + // out the dummy header when we are trying to display the message. + // The dummy header is the From line with the date tag on it. + if (m_tempMessageFile && TestFlag(MAILBOX_MSG_PARSE_FIRST_LINE)) { PRInt32 count = 0; if (line) m_tempMessageFile->write(line, PL_strlen(line), &count); m_tempMessageFile->write(MSG_LINEBREAK, MSG_LINEBREAK_LEN, &count); } + else + SetFlag(MAILBOX_MSG_PARSE_FIRST_LINE); } } while (line && !pauseForMoreData); diff --git a/mozilla/mailnews/local/src/nsMailboxProtocol.h b/mozilla/mailnews/local/src/nsMailboxProtocol.h index 0f9d8a33956..8f432070018 100644 --- a/mozilla/mailnews/local/src/nsMailboxProtocol.h +++ b/mozilla/mailnews/local/src/nsMailboxProtocol.h @@ -47,6 +47,7 @@ // commands, etc. I do not intend it to refer to protocol state) #define MAILBOX_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */ +#define MAILBOX_MSG_PARSE_FIRST_LINE 0x00000002 /* have we read in the first line of the msg */ /* states of the machine */