fix 83396 alert: message contains bare newlines when copying local message to cyrus/netscape imap server, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2004-04-13 00:22:26 +00:00
parent ce5ba6cc48
commit 887deef184

View File

@ -2904,7 +2904,7 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
}
char *start, *end;
PRUint32 linebreak_len = 0;
PRUint32 linebreak_len = 1;
rv = aIStream->Read(m_copyState->m_dataBuffer+m_copyState->m_leftOver, aLength, &readCount);
if (NS_FAILED(rv))
@ -2917,12 +2917,9 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
end = PL_strchr(start, '\r');
if (!end)
end = PL_strchr(start, '\n');
else if (*(end+1) == nsCRT::LF && linebreak_len == 0)
else if (*(end+1) == nsCRT::LF)
linebreak_len = 2;
if (linebreak_len == 0) // not initialize yet
linebreak_len = 1;
while (start && end)
{
if (PL_strncasecmp(start, "X-Mozilla-Status:", 17) &&
@ -2941,9 +2938,14 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
m_copyState->m_leftOver = 0;
break;
}
linebreak_len = 1;
end = PL_strchr(start, '\r');
if (!end)
end = PL_strchr(start, '\n');
else if (*(end+1) == nsCRT::LF)
linebreak_len = 2;
if (start && !end)
{
m_copyState->m_leftOver -= (start - m_copyState->m_dataBuffer);