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.
This commit is contained in:
mscott%netscape.com 1999-06-11 02:44:06 +00:00
parent a0be8f890b
commit 32cbc72383
2 changed files with 8 additions and 3 deletions

View File

@ -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);

View File

@ -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
*/