diff --git a/mailnews/compose/tests/compose2/test2.cpp b/mailnews/compose/tests/compose2/test2.cpp index 610129c1913a..830f8b1688bf 100644 --- a/mailnews/compose/tests/compose2/test2.cpp +++ b/mailnews/compose/tests/compose2/test2.cpp @@ -145,7 +145,7 @@ char *email = {"\ Message-ID: <375FF6D0.3070505@netscape.com>\ \nDate: Thu, 10 Jun 1999 13:33:04 -0500\ \nFrom: rhp@netscape.com\ -\nX-Mailer: Mozilla 5.0 [en] (Win95; I)\ +\nUser-Agent: Mozilla 5.0 [en] (Win95; I)\ \nX-Accept-Language: en\ \nMIME-Version: 1.0\ \nTo: rhp@netscape.com\ diff --git a/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp b/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp index bc22fa05bbb0..b13e08f93b25 100644 --- a/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp +++ b/mailnews/mime/emitters/src/nsMimeHtmlEmitter.cpp @@ -22,7 +22,12 @@ #include "nsEmitterUtils.h" #include "nsMailHeaders.h" #include "nscore.h" +#include "nsEscape.h" +#include "nsIPref.h" +#include "nsIServiceManager.h" +// For the prefs api +static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); nsresult NS_NewMimeHtmlEmitter(const nsIID& iid, void **result) { @@ -55,6 +60,15 @@ nsMimeHtmlEmitter::nsMimeHtmlEmitter() mTotalRead = 0; mDocHeader = PR_FALSE; mAttachContentType = NULL; + mHeaderDisplayType = NormalHeaders; + + nsIPref *pref; + nsresult rv = nsServiceManager::GetService(kPrefCID, nsIPref::GetIID(), (nsISupports**)&(pref)); + if ((pref && NS_SUCCEEDED(rv))) + { + pref->GetIntPref("mail.show_headers", &mHeaderDisplayType); + NS_RELEASE(pref); + } #ifdef DEBUG_rhp mLogFile = NULL; /* Temp file to put generated HTML into. */ @@ -115,8 +129,10 @@ nsMimeHtmlEmitter::Complete() if (mBufferMgr->GetSize() > 0) Write("", 0, &written); +#ifdef DEBUG_rhp printf("TOTAL WRITTEN = %d\n", mTotalWritten); printf("LEFTOVERS = %d\n", mBufferMgr->GetSize()); +#endif #ifdef DEBUG_rhp if (mLogFile) @@ -162,6 +178,13 @@ nsMimeHtmlEmitter::AddHeaderField(const char *field, const char *value) if ( (!field) || (!value) ) return NS_OK; + // + // This is a check to see what the pref is for header display. If + // We should only output stuff that corresponds with that setting. + // + if (!EmitThisHeaderForPrefSetting(mHeaderDisplayType, field)) + return NS_OK; + char *newValue = nsEscapeHTML(value); if (!newValue) return NS_OK; diff --git a/mailnews/mime/emitters/src/nsMimeRawEmitter.cpp b/mailnews/mime/emitters/src/nsMimeRawEmitter.cpp index 077f44c70e6b..612bdcdde6c1 100644 --- a/mailnews/mime/emitters/src/nsMimeRawEmitter.cpp +++ b/mailnews/mime/emitters/src/nsMimeRawEmitter.cpp @@ -126,8 +126,10 @@ nsMimeRawEmitter::Complete() if (mBufferMgr->GetSize() > 0) Write("", 0, &written); +#ifdef DEBUG_rhp printf("TOTAL WRITTEN = %d\n", mTotalWritten); printf("LEFTOVERS = %d\n", mBufferMgr->GetSize()); +#endif #ifdef DEBUG_rhp if (mLogFile) diff --git a/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp b/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp index c08f9aecf493..2437a599a43a 100644 --- a/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp +++ b/mailnews/mime/emitters/src/nsMimeXmlEmitter.cpp @@ -24,6 +24,7 @@ #include "nsIPref.h" #include "nsIServiceManager.h" #include "nsString.h" +#include "nsEscape.h" // For the new pref API's static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); @@ -139,8 +140,10 @@ nsMimeXmlEmitter::Complete() if (mBufferMgr->GetSize() > 0) Write("", 0, &written); +#ifdef DEBUG_rhp printf("TOTAL WRITTEN = %d\n", mTotalWritten); printf("LEFTOVERS = %d\n", mBufferMgr->GetSize()); +#endif #ifdef DEBUG_rhp if (mLogFile)