when saving a message, make sure we use canonical line ending if requested, e.g., when saving a msg as a template, 320102, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2007-07-19 20:31:35 +00:00
Родитель 3fadd584ce
Коммит 1e3e6a5020
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -836,7 +836,14 @@ NS_IMETHODIMP nsMsgSaveAsListener::OnDataAvailable(nsIRequest* request,
NS_ENSURE_SUCCESS(rv, rv);
}
PRBool useCanonicalEnding = PR_FALSE;
nsCOMPtr <nsIMsgMessageUrl> msgUrl = do_QueryInterface(aSupport);
if (msgUrl)
msgUrl->GetCanonicalLineEnding(&useCanonicalEnding);
const char *lineEnding = (useCanonicalEnding) ? CRLF : MSG_LINEBREAK;
PRUint32 lineEndingLength = (useCanonicalEnding) ? 2 : MSG_LINEBREAK_LEN;
PRUint32 readCount, maxReadCount = SAVE_BUF_SIZE - m_leftOver;
PRUint32 writeCount;
char *start, *end;
@ -878,7 +885,7 @@ NS_IMETHODIMP nsMsgSaveAsListener::OnDataAvailable(nsIRequest* request,
PL_strncmp(start, "From - ", 7))
{
rv = m_outputStream->Write(start, end-start, &writeCount);
rv = m_outputStream->Write(MSG_LINEBREAK,sizeof(MSG_LINEBREAK) - 1, &writeCount);
rv = m_outputStream->Write(lineEnding, lineEndingLength, &writeCount);
}
start = end+linebreak_len;
if (start >= m_dataBuffer + m_leftOver)