don't convert emoticons to gifs when sending a html message.
I also took the liberty of removing the dead code from nsMsgSendPart.cpp
r=sspitzer
This commit is contained in:
sspitzer%netscape.com 2000-01-10 22:51:01 +00:00
Родитель 9605cbc630
Коммит 1e7462c423
2 изменённых файлов: 15 добавлений и 72 удалений

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

@ -73,6 +73,9 @@ static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kCAddressCollecter, NS_ABADDRESSCOLLECTER_CID);
static NS_DEFINE_CID(kTXTToHTMLConvCID, MOZITXTTOHTMLCONV_CID);
#define PREF_MAIL_CONVERT_STRUCTS "mail.convert_structs"
#define PREF_MAIL_STRICTLY_MIME "mail.strictly_mime"
#ifdef XP_MAC
#include "xp.h" // mac only
#include "errors.h"
@ -1182,9 +1185,18 @@ nsMsgComposeAndSend::GetBodyFromEditor()
(void **) getter_AddRefs(conv));
if (NS_SUCCEEDED(rv))
{
PRUint32 whattodo = mozITXTToHTMLConv::kURLs;
PRBool enable_structs = PR_TRUE;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs)
{
rv = prefs->GetBoolPref(PREF_MAIL_CONVERT_STRUCTS,&enable_structs);
if (NS_FAILED(rv) || enable_structs)
whattodo = whattodo | mozITXTToHTMLConv::kStructPhrase;
}
PRUnichar* wresult;
rv = conv->ScanHTML(bodyText, ~PRUint32(mozITXTToHTMLConv::kGlyphSubstitution)
/* XXX Ask Prefs what to do */, &wresult);
rv = conv->ScanHTML(bodyText, whattodo, &wresult);
if (NS_SUCCEEDED(rv))
{
Recycle(bodyText);
@ -2355,7 +2367,7 @@ nsMsgComposeAndSend::Init(
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs)
{
rv = prefs->GetBoolPref("mail.strictly_mime", &strictly_mime);
rv = prefs->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime);
}
nsMsgMIMESetConformToStandard(strictly_mime);

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

@ -25,7 +25,6 @@
#include "nsMsgSendPart.h"
#include "nsIMimeConverter.h"
#include "nsFileStream.h"
#include "mozITXTToHTMLConv.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsMsgEncoders.h"
@ -33,18 +32,12 @@
#include "nsMsgCompUtils.h"
#include "nsFileStream.h"
#include "nsMsgMimeCID.h"
#include "nsIPref.h"
// defined in msgCompGlue.cpp
static char *mime_mailto_stream_read_buffer = 0;
PRInt32 nsMsgSendPart::M_counter = 0;
#define PREF_MAIL_CONVERT_EMOTICONS "mail.convert_emoticons"
#define PREF_MAIL_CONVERT_STRUCTS "mail.convert_structs"
static NS_DEFINE_CID(kTXTToHTMLConvCID, MOZITXTTOHTMLCONV_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID);
int MIME_EncoderWrite(MimeEncoderData *data, const char *buffer, PRInt32 size)
@ -519,68 +512,6 @@ nsMsgSendPart::Write()
PR_Free(m_buffer);
}
}
#if 0
// This part has moved to nsMsgSend.cpp.
if (m_buffer)
{
const char* charset;
charset = GetCharsetName();
nsCOMPtr<mozITXTToHTMLConv> conv;
nsresult rv = nsComponentManager::CreateInstance(kTXTToHTMLConvCID,
NULL, nsCOMTypeInfo<mozITXTToHTMLConv>::GetIID(),
(void **) getter_AddRefs(conv));
if (NS_FAILED(rv))
{
status = -1;
goto FAIL;
}
//XXX I18N
nsAutoString strline(m_buffer);
PRUnichar* wline = strline.ToNewUnicode();
if (!wline)
{
status = -1;
goto FAIL;
}
PRUnichar* wresult = nsnull;
PRUint32 whattodo = 0;
PRBool enable_emoticons = PR_TRUE;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs) {
rv = prefs->GetBoolPref(PREF_MAIL_CONVERT_EMOTICONS,&enable_emoticons);
if (NS_FAILED(rv) || enable_emoticons) {
whattodo = whattodo | mozITXTToHTMLConv::kGlyphSubstitution;
}
}
rv = conv->ScanHTML(wline, whattodo, &wresult);
Recycle(wline);
if (NS_FAILED(rv))
{
status = -1;
goto FAIL;
}
//XXX I18N Converting PRUnichar* to char*
nsAutoString strresult(wresult);
char* cresult = strresult.ToNewCString();
Recycle(wresult);
if (cresult)
{
SetBuffer(cresult);
Recycle(cresult);
}
else
{
status = -1;
goto FAIL;
}
}
#endif
}
if (m_parent && m_parent->m_type &&