summaryrefslogtreecommitdiffstats
path: root/mailnews/local/src/nsParseMailbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/local/src/nsParseMailbox.cpp')
-rw-r--r--mailnews/local/src/nsParseMailbox.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp
index 9d68e5cd1..da51c0322 100644
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -598,6 +598,7 @@ NS_IMETHODIMP nsParseMailMessageState::Clear()
m_mdn_original_recipient.length = 0;
m_bccList.length = 0;
m_body_lines = 0;
+ m_lastLineBlank = 0;
m_newMsgHdr = nullptr;
m_envelope_pos = 0;
m_new_key = nsMsgKey_None;
@@ -694,6 +695,9 @@ nsresult nsParseMailMessageState::ParseFolderLine(const char *line, uint32_t lin
else if ( m_state == nsIMsgParseMailMsgState::ParseBodyState)
{
m_body_lines++;
+ // See comment in msgCore.h for why we use `IS_MSG_LINEBREAK` rather than
+ // just comparing `line` to `MSG_LINEBREAK`.
+ m_lastLineBlank = IS_MSG_LINEBREAK(line);
}
m_position += lineLength;
@@ -824,7 +828,9 @@ NS_IMETHODIMP nsParseMailMessageState::FinishHeader()
if (m_newMsgHdr)
{
m_newMsgHdr->SetMessageOffset(m_envelope_pos);
- m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos);
+ if (m_lastLineBlank)
+ m_body_lines--;
+ m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos - m_lastLineBlank);
m_newMsgHdr->SetLineCount(m_body_lines);
}
return NS_OK;
@@ -1888,7 +1894,9 @@ NS_IMETHODIMP nsParseNewMailState::FinishHeader()
{
if (m_newMsgHdr)
{
- m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos);
+ if (m_lastLineBlank)
+ m_body_lines--;
+ m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos - m_lastLineBlank);
m_newMsgHdr->SetLineCount(m_body_lines);
}
return NS_OK;