diff --git a/mozilla/mailnews/base/public/nsIMsgWindow.idl b/mozilla/mailnews/base/public/nsIMsgWindow.idl index c252b949c0d..673f62382c2 100644 --- a/mozilla/mailnews/base/public/nsIMsgWindow.idl +++ b/mozilla/mailnews/base/public/nsIMsgWindow.idl @@ -44,8 +44,10 @@ interface nsIMsgWindow : nsISupports { attribute nsIMessageView messageView; attribute nsIMsgFolder openFolder; attribute nsIDocShell rootDocShell; + void displayHTMLInMessageWindow(in wstring title, in wstring body); + readonly attribute nsIPrompt promptDialog; - attribute wstring mailCharacterSet; + attribute wstring mailCharacterSet; void SetDOMWindow(in nsIDOMWindowInternal window); void StopUrls(); diff --git a/mozilla/mailnews/base/src/nsMsgWindow.cpp b/mozilla/mailnews/base/src/nsMsgWindow.cpp index 8d54b7f52b9..d75c2877245 100644 --- a/mozilla/mailnews/base/src/nsMsgWindow.cpp +++ b/mozilla/mailnews/base/src/nsMsgWindow.cpp @@ -42,6 +42,10 @@ #include "nsICharsetConverterManager.h" #include "nsICharsetConverterManager2.h" +#include "plbase64.h" +#include "nsMsgI18N.h" +#include "nsIWebNavigation.h" + // XXX Remove #include "nsIWebShell.h" @@ -495,3 +499,49 @@ NS_IMETHODIMP nsMsgWindow::GetPromptDialog(nsIPrompt **aPrompt) else return NS_ERROR_NULL_POINTER; } + +NS_IMETHODIMP +nsMsgWindow::DisplayHTMLInMessageWindow(const PRUnichar *title, const PRUnichar *body) +{ + nsresult rv; + + nsCAutoString charSet; + charSet.AssignWithConversion(nsMsgI18NFileSystemCharset()); + + nsAutoString htmlStr; + htmlStr.Append(NS_LITERAL_STRING("
").get()); + htmlStr.Append(NS_LITERAL_STRING("").get()); + htmlStr.Append(NS_LITERAL_STRING("").get()); + htmlStr.Append(body); + htmlStr.Append(NS_LITERAL_STRING("").get()); + + nsCAutoString convertedHtml; + rv = nsMsgI18NConvertFromUnicode(charSet,htmlStr,convertedHtml); + NS_ENSURE_SUCCESS(rv,rv); + + char *encodedHtml = PL_Base64Encode((const char *)convertedHtml, 0, nsnull); + if (!encodedHtml) return NS_ERROR_OUT_OF_MEMORY; + + nsCAutoString dataSpec; + dataSpec = "data:text/html;base64,"; + dataSpec += encodedHtml; + + PR_FREEIF(encodedHtml); + + nsCOMPtr\n +htmlNewsError=
Perhaps the article has expired
\n +articleExpired=
Perhaps the article has expired
removeExpiredArtLinkText=Click here to remove all expired articles cancelDisallowed=This message does not appear to be from you. You may only cancel your own posts, not those made by others. cancelConfirm=Are you sure you want to cancel this message? diff --git a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp index fab2d2a5244..f56bfc8b3b6 100644 --- a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp @@ -24,7 +24,6 @@ * David Bienvenu").get()); + + rv = GetNewsStringByName("articleExpired", getter_Copies(newsErrorStr)); + NS_ENSURE_SUCCESS(rv,rv); + errorHtml.Append(newsErrorStr); nsMsgKey key = nsMsgKey_None; rv = m_runningURL->GetMessageKey(&key); + NS_ENSURE_SUCCESS(rv,rv); + + char outputBuffer[OUTPUT_BUFFER_SIZE]; + NS_ASSERTION(m_messageID && (key != nsMsgKey_None), "unexpected"); if (m_messageID && (key != nsMsgKey_None)) { - PR_snprintf(outputBuffer,OUTPUT_BUFFER_SIZE,"
<%.512s> (%lu)", m_messageID, key); - mDisplayOutputStream->Write(outputBuffer, PL_strlen(outputBuffer), &count); + PR_snprintf(outputBuffer,OUTPUT_BUFFER_SIZE,"
<%.512s> (%lu)", m_messageID, key); + errorHtml.AppendWithConversion(outputBuffer); } - GetNewsStringByName("removeExpiredArtLinkText", getter_Copies(newsErrorStr)); - nsCAutoString cString3(newsErrorStr); if (m_userName) { - PR_snprintf(outputBuffer,OUTPUT_BUFFER_SIZE,"
\n", kNewsRootURI, (const char *)m_userName, (const char *)m_hostName, - (const char *) group_name, (const char *) cString3); + PR_snprintf(outputBuffer,OUTPUT_BUFFER_SIZE,"