From bb6a2967d061edd6c5f0489728f6ddd443cfdaa2 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Mon, 8 Nov 2004 23:28:33 +0000 Subject: [PATCH] Bug #258489 --> Outgoing mail imported from Eudora shows raw HTML code Migrating messages from the eudora sent folder / outbox...eudora doesn't mark html messages as being HTML so we need to sniff the first line of the body looking for a tag. sr=bienvenu --- mailnews/import/eudora/src/nsEudoraMailbox.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mailnews/import/eudora/src/nsEudoraMailbox.cpp b/mailnews/import/eudora/src/nsEudoraMailbox.cpp index fd54ca752db..ca2ed073c51 100644 --- a/mailnews/import/eudora/src/nsEudoraMailbox.cpp +++ b/mailnews/import/eudora/src/nsEudoraMailbox.cpp @@ -166,6 +166,7 @@ nsresult nsEudoraMailbox::DeleteFile( nsIFileSpec *pSpec) #define kComposeErrorStr "X-Eudora-Compose-Error: *****" "\x0D\x0A" +#define kHTMLTag "" nsresult nsEudoraMailbox::ImportMailbox( PRUint32 *pBytes, PRBool *pAbort, const PRUnichar *pName, nsIFileSpec *pSrc, nsIFileSpec *pDst, PRInt32 *pMsgCount) { @@ -297,6 +298,12 @@ nsresult nsEudoraMailbox::ImportMailbox( PRUint32 *pBytes, PRBool *pAbort, const *pBytes += (((body.m_writeOffset - 1 + headers.m_writeOffset - 1) / div) * mul); } + // Unfortunately Eudora stores HTML messages in the sent folder + // without any content type header at all. If the first line of the message body is + // then mark the message as html internally...See Bug #258489 + if (body.m_pBuffer && body.m_writeOffset > sizeof(kHTMLTag) && (strncmp(body.m_pBuffer, kHTMLTag, sizeof(kHTMLTag)) == 0)) + bodyType = "text/html"; // ignore whatever body type we were given...force html + compose.SetBody( body.m_pBuffer, body.m_writeOffset - 1, bodyType); compose.SetHeaders( headers.m_pBuffer, headers.m_writeOffset - 1); compose.SetAttachments( &m_attachments);