Fix for bug 75498. Still need to translate line breaks :-( R=sfraser, SR=mscott

This commit is contained in:
ducarroz%netscape.com 2001-04-11 21:17:56 +00:00
Родитель cc708addc2
Коммит e58f44173f
1 изменённых файлов: 36 добавлений и 0 удалений

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

@ -106,6 +106,36 @@ static nsresult RemoveDuplicateAddresses(const char * addresses, const char * an
return rv;
}
static void TranslateLineEnding(nsString& data)
{
PRUnichar* rPtr; //Read pointer
PRUnichar* wPtr; //Write pointer
PRUnichar* sPtr; //Start data pointer
PRUnichar* ePtr; //End data pointer
rPtr = wPtr = sPtr = data.mUStr;
ePtr = rPtr + data.Length();
while (rPtr < ePtr)
{
if (*rPtr == 0x0D)
if (rPtr + 1 < ePtr && *(rPtr + 1) == 0x0A)
{
*wPtr = 0x0A;
rPtr ++;
}
else
*wPtr = 0x0A;
else
*wPtr = *rPtr;
rPtr ++;
wPtr ++;
}
data.SetLength(wPtr - sPtr);
}
nsMsgCompose::nsMsgCompose()
{
NS_INIT_REFCNT();
@ -219,6 +249,10 @@ nsresult nsMsgCompose::ConvertAndLoadComposeWindow(nsIEditorShell *aEditorShell,
nsCOMPtr<nsIEditor> editor;
nsCOMPtr<nsIDOMNode> nodeInserted;
TranslateLineEnding(aPrefix);
TranslateLineEnding(aBuf);
TranslateLineEnding(aSignature);
aEditorShell->GetEditor(getter_AddRefs(editor));
if (editor)
@ -3126,6 +3160,8 @@ nsresult nsMsgCompose::SetSignature(nsIMsgIdentity *identity)
if (!aSignature.IsEmpty())
{
TranslateLineEnding(aSignature);
editor->BeginTransaction();
editor->EndOfDocument();
if (m_composeHTML)