зеркало из https://github.com/mozilla/gecko-dev.git
Changes for bodies in drafts and fix for 8bit address sending
This commit is contained in:
Родитель
0b633a1898
Коммит
126e9aa075
|
@ -519,10 +519,26 @@ nsresult nsMsgCompose::SetEditor(nsIEditorShell * aEditor)
|
|||
// Make sure we setup to listen for editor state changes...
|
||||
m_editor->RegisterDocumentStateListener(mDocumentListener);
|
||||
|
||||
//
|
||||
// Have to check to see if there is a body stored in the
|
||||
// comp fields...
|
||||
//
|
||||
PRBool bodyInCompFields = PR_FALSE;
|
||||
if (m_compFields)
|
||||
{
|
||||
PRUnichar *bod;
|
||||
|
||||
m_compFields->GetBody(&bod);
|
||||
if ((bod) && (*bod))
|
||||
bodyInCompFields = PR_TRUE;
|
||||
}
|
||||
|
||||
// Now, do the appropriate startup operation...signature only
|
||||
// or quoted message and signature...
|
||||
if ( QuotingToFollow() )
|
||||
return BuildQuotedMessageAndSignature();
|
||||
else if (bodyInCompFields)
|
||||
return BuildBodyMessage();
|
||||
else
|
||||
return ProcessSignature(nsnull);
|
||||
}
|
||||
|
@ -1537,3 +1553,39 @@ nsMsgCompose::ProcessSignature(nsOutputFileStream *aAppendFileStream)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgCompose::BuildBodyMessage()
|
||||
{
|
||||
PRUnichar *bod;
|
||||
|
||||
//
|
||||
// This should never happen...if it does, just bail out...
|
||||
//
|
||||
if (!m_editor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Since we have a body in the comp fields, we need to create a
|
||||
// body of this old body...
|
||||
//
|
||||
mTempComposeFileSpec = nsMsgCreateTempFileSpec(m_composeHTML ? "nscomp.html" : "nscomp.txt");
|
||||
if (!mTempComposeFileSpec)
|
||||
return NS_MSG_ERROR_WRITING_FILE;
|
||||
|
||||
nsOutputFileStream tempFile(*(mTempComposeFileSpec));
|
||||
if (!tempFile.is_open())
|
||||
return NS_MSG_ERROR_WRITING_FILE;
|
||||
|
||||
m_compFields->GetBody(&bod);
|
||||
|
||||
nsString tempBody(bod);
|
||||
tempFile.write(nsAutoCString(tempBody), tempBody.Length());
|
||||
tempFile.close();
|
||||
|
||||
//
|
||||
// Now load the URL...
|
||||
//
|
||||
nsString urlStr = nsMsgPlatformFileToURL(mTempComposeFileSpec->GetNativePathCString());
|
||||
m_editor->LoadUrl(urlStr.GetUnicode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ class nsMsgCompose : public nsIMsgCompose
|
|||
nsresult LoadAsQuote(nsString aTextToLoad);
|
||||
nsresult ConvertHTMLToText(char *aSigFile, nsString &aSigData);
|
||||
nsresult ConvertTextToHTML(char *aSigFile, nsString &aSigData);
|
||||
nsresult BuildBodyMessage();
|
||||
|
||||
nsString mQuoteURI;
|
||||
nsFileSpec *mSigFileSpec;
|
||||
|
|
|
@ -2184,6 +2184,30 @@ nsMsgComposeAndSend::DeliverMessage()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// strip out non-printable characters
|
||||
static void
|
||||
strip_nonprintable(char *string)
|
||||
{
|
||||
char *dest, *src;
|
||||
|
||||
if ( (!string) || (!*string) ) return;
|
||||
dest=src=string;
|
||||
while (*src)
|
||||
{
|
||||
if ( (isprint(*src)) && (*src != ' ') )
|
||||
{
|
||||
(*dest)=(*src);
|
||||
src++; dest++;
|
||||
}
|
||||
else
|
||||
{
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
(*dest)='\0';
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgComposeAndSend::DeliverFileAsMail()
|
||||
{
|
||||
|
@ -2215,6 +2239,18 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
|||
PL_strcat (buf2, mCompFields->GetBcc());
|
||||
}
|
||||
|
||||
// Ok, now MIME II encode this to prevent 8bit problems...
|
||||
char *convbuf = nsMsgI18NEncodeMimePartIIStr((char *)buf, mCompFields->GetCharacterSet(),
|
||||
nsMsgMIMEGetConformToStandard());
|
||||
if (convbuf)
|
||||
{
|
||||
// MIME-PartII conversion
|
||||
PR_FREEIF(buf);
|
||||
buf = convbuf;
|
||||
}
|
||||
|
||||
strip_nonprintable(buf);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_WITH_SERVICE(nsISmtpService, smtpService, kSmtpServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && smtpService)
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
|
||||
#ifdef XP_PC
|
||||
#define XPCOM_DLL "xpcom32.dll"
|
||||
#define PREF_DLL "d:\\mozilla\\dist\\win32_d.obj\\bin\\xppref32.dll"
|
||||
#define APPSHELL_DLL "d:\\mozilla\\dist\\win32_d.obj\\bin\\nsappshell.dll"
|
||||
#define PREF_DLL "xppref32.dll"
|
||||
#define APPSHELL_DLL "nsappshell.dll"
|
||||
#else
|
||||
#ifdef XP_MAC
|
||||
#include "nsMacRepository.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче