зеркало из https://github.com/mozilla/gecko-dev.git
Changes to address several mail compose and rendering issues - Bugs #: 35158 31906 9202 37365 39226 39728 39372 26182 33305 - r: rhp a: waterson (contributed by mozilla@bucksch.org)
This commit is contained in:
Родитель
ce813e8a9c
Коммит
3be7b55ced
|
@ -164,9 +164,6 @@ noIdentities=You don't have any email identities yet. Create one with the Accou
|
|||
## @name NS_MSG_POSTING_MESSAGE
|
||||
12551=Posting message...
|
||||
|
||||
## @name NS_MSG_ATTACHMENT_TYPE_MISMATCH
|
||||
12552=<Image Signature Omitted>
|
||||
|
||||
## @name NS_MSG_MULTILINGUAL_SEND
|
||||
12553=This message contains characters not found in the chosen Character Coding. The message may be unreadable to the recipient. Send it anyway or "Cancel' to choose a different Character Coding.
|
||||
|
||||
|
|
|
@ -1938,6 +1938,7 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
|||
PRBool htmlSig = PR_FALSE;
|
||||
PRBool imageSig = PR_FALSE;
|
||||
nsAutoString sigData;
|
||||
nsAutoString sigOutput;
|
||||
|
||||
if (identity)
|
||||
{
|
||||
|
@ -1992,38 +1993,29 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
|||
PR_FREEIF(fileExt);
|
||||
PR_FREEIF(sigContentType);
|
||||
}
|
||||
|
||||
// If we have an image signature, then we should put in the appropriate
|
||||
// HTML for inclusion, otherwise, just mention something about it.
|
||||
|
||||
static const char htmlBreak[] = "<BR>";
|
||||
static const char dashes[] = "-- ";
|
||||
static const char divopen[] = "<div class=signature>";
|
||||
static const char divclose[] = "</div>";
|
||||
|
||||
if (imageSig)
|
||||
{
|
||||
// We have an image signature. If we're using the in HTML composer, we
|
||||
// should put in the appropriate HTML for inclusion, otherwise, do nothing.
|
||||
if (m_composeHTML)
|
||||
{
|
||||
aMsgBody->AppendWithConversion("<PRE>");
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
aMsgBody->AppendWithConversion("-- ");
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
aMsgBody->AppendWithConversion("</PRE>");
|
||||
aMsgBody->AppendWithConversion("<IMG SRC=\"file:///");
|
||||
aMsgBody->AppendWithConversion(testSpec);
|
||||
aMsgBody->AppendWithConversion("\" BORDER=0>");
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
sigOutput.AppendWithConversion(divopen);
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
sigOutput.AppendWithConversion("<img src=\"file:///");
|
||||
/* XXX pp This gives me 4 slashes on Unix, that's at least one to
|
||||
much. Better construct the URL with some service. */
|
||||
sigOutput.AppendWithConversion(testSpec);
|
||||
sigOutput.AppendWithConversion("\" border=0>");
|
||||
sigOutput.AppendWithConversion(divclose);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_PROGID));
|
||||
nsXPIDLString omitString;
|
||||
composebundle->GetStringByID(NS_MSG_ATTACHMENT_TYPE_MISMATCH, getter_Copies(omitString));
|
||||
|
||||
if (omitString)
|
||||
{
|
||||
aMsgBody->AppendWithConversion("-- ");
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
aMsgBody->Append(omitString);
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2039,36 +2031,37 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
|||
|
||||
// Now that sigData holds data...if any, append it to the body in a nice
|
||||
// looking manner
|
||||
//
|
||||
char *htmlBreak = "<BR>";
|
||||
char *dashes = "--";
|
||||
if (!sigData.IsEmpty())
|
||||
{
|
||||
if (m_composeHTML)
|
||||
{
|
||||
aMsgBody->AppendWithConversion(htmlBreak);
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
sigOutput.AppendWithConversion(divopen);
|
||||
if (!htmlSig)
|
||||
{
|
||||
aMsgBody->AppendWithConversion("<pre>");
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
sigOutput.AppendWithConversion("<pre>");
|
||||
}
|
||||
}
|
||||
else
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
|
||||
aMsgBody->AppendWithConversion(dashes);
|
||||
sigOutput.AppendWithConversion(CRLF);
|
||||
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
|
||||
if ( (!m_composeHTML) || ((m_composeHTML) && (!htmlSig)) )
|
||||
aMsgBody->AppendWithConversion(CRLF);
|
||||
sigOutput.AppendWithConversion(CRLF);
|
||||
else if (m_composeHTML)
|
||||
aMsgBody->AppendWithConversion(htmlBreak);
|
||||
|
||||
aMsgBody->Append(sigData);
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
|
||||
sigOutput.Append(sigData);
|
||||
//DELETEME: I18N: Converting down (2byte->1byte) OK?
|
||||
|
||||
if ( (m_composeHTML) && (!htmlSig) )
|
||||
aMsgBody->AppendWithConversion("</pre>");
|
||||
sigOutput.AppendWithConversion("</pre>");
|
||||
if (m_composeHTML)
|
||||
sigOutput.AppendWithConversion(divclose);
|
||||
}
|
||||
|
||||
aMsgBody->Append(sigOutput);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,11 @@ pref("mail.support_skey", false);
|
|||
pref("mail.pop_password", "");
|
||||
pref("mail.auto_quote", true);
|
||||
pref("mail.fixed_width_messages", true);
|
||||
pref("mail.quoted_style", 2); // 0=plain, 1=bold, 2=italic, 3=bolditalic
|
||||
pref("mail.quoted_size", 0); // 0=normal, 1=bigger, 2=smaller
|
||||
pref("mail.citation_color", "#000000"); // quoted color
|
||||
pref("mail.citation_color", ""); // quoted color
|
||||
pref("mail.quoted_style", 0); // 0=plain, 1=bold, 2=italic, 3=bolditalic
|
||||
pref("mail.quoted_size", 0); // 0=normal, 1=big, 2=small
|
||||
pref("mail.quoted_graphical", true); // use HTML-style quoting for displaying plain text
|
||||
pref("mail.quoteasblock", false); // use HTML-style quoting for quoting plain text
|
||||
pref("mail.identity.organization", "");
|
||||
pref("mail.identity.reply_to", "");
|
||||
pref("mail.identity.username", "");
|
||||
|
@ -406,7 +408,7 @@ pref("mail.server.default.dual_use_folders", true);
|
|||
|
||||
pref("mail.smtpserver.default.auth_method", 2); // auth login
|
||||
|
||||
pref("mail.display_glyph",true); // see <http://www.bucksch.org/1/projects/mozilla/16507/>
|
||||
pref("mail.display_glyph",true); // see <http://www.bucksch.org/1/projects/mozilla/16507>
|
||||
pref("mail.display_struct",true); // dito
|
||||
pref("mail.send_struct",true); // dito
|
||||
|
||||
|
|
|
@ -228,7 +228,9 @@ ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs)
|
|||
(!aAttach->real_name || *aAttach->real_name == 0))
|
||||
{
|
||||
if (aHdrs->munged_subject)
|
||||
mime_SACopy(&(aAttach->real_name), aHdrs->munged_subject);
|
||||
{
|
||||
aAttach->real_name = PR_smprintf("%s.eml", aHdrs->munged_subject);
|
||||
}
|
||||
else
|
||||
mime_SACopy(&(aAttach->real_name), "ForwardedMessage.eml");
|
||||
return;
|
||||
|
|
|
@ -63,7 +63,7 @@ MimeInlineTextHTML_parse_begin (MimeObject *obj)
|
|||
char buf[256]; // local buffer for html tag
|
||||
char fontName[128]; // default font name
|
||||
PRInt32 fontSize; // default font size
|
||||
if (NS_SUCCEEDED(GetMailNewsFont(obj, PR_FALSE, fontName, 128, &fontSize)))
|
||||
if (NS_SUCCEEDED(GetMailNewsFont(obj, PR_FALSE, fontName, sizeof(fontName), &fontSize)))
|
||||
{
|
||||
PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpx;\">", (const char *) fontName, fontSize);
|
||||
status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "mimemoz2.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#define PREF_MAIL_FIXED_WIDTH_MESSAGES "mail.fixed_width_messages"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define MIME_SUPERCLASS mimeInlineTextClass
|
||||
|
@ -47,9 +45,10 @@ static int MimeInlineTextPlainFlowed_parse_eof (MimeObject *, PRBool);
|
|||
|
||||
static MimeInlineTextPlainFlowedExData *MimeInlineTextPlainFlowedExDataList = 0;
|
||||
|
||||
extern "C" char *MimeTextBuildPrefixCSS(PRInt32 quotedSizeSetting, // mail.quoted_size
|
||||
PRInt32 quotedStyleSetting, // mail.quoted_style
|
||||
char *citationColor); // mail.citation_color
|
||||
extern "C" char *MimeTextBuildPrefixCSS(
|
||||
PRInt32 quotedSizeSetting, // mail.quoted_size
|
||||
PRInt32 quotedStyleSetting, // mail.quoted_style
|
||||
char *citationColor); // mail.citation_color
|
||||
|
||||
|
||||
static int
|
||||
|
@ -70,10 +69,17 @@ MimeInlineTextPlainFlowed_parse_begin (MimeObject *obj)
|
|||
int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
|
||||
if (status < 0) return status;
|
||||
|
||||
char s[] = "";
|
||||
status = MimeObject_write(obj, s, 0, PR_TRUE); /* force out any separators... */
|
||||
status = MimeObject_write(obj, "", 0, PR_TRUE); /* force out any separators... */
|
||||
if(status<0) return status;
|
||||
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // The output will be inserted in the composer as quotation
|
||||
PRBool plainHTML = quoting || (obj->options &&
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs);
|
||||
// Just good(tm) HTML. No reliance on CSS (only for prefs).
|
||||
|
||||
// Setup the data structure that is connected to the actual document
|
||||
// Saved in a linked list in case this is called with several documents
|
||||
// at the same time.
|
||||
|
@ -81,75 +87,84 @@ MimeInlineTextPlainFlowed_parse_begin (MimeObject *obj)
|
|||
struct MimeInlineTextPlainFlowedExData *exdata =
|
||||
(MimeInlineTextPlainFlowedExData *)PR_MALLOC(sizeof(struct MimeInlineTextPlainFlowedExData));
|
||||
if(!exdata) return MIME_OUT_OF_MEMORY;
|
||||
exdata->ownerobj = obj;
|
||||
exdata->inflow=PR_FALSE;
|
||||
exdata->fixedwidthfont=PR_FALSE;
|
||||
exdata->quotelevel=0;
|
||||
|
||||
// Check the pref for fixed width font
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && prefs)
|
||||
{
|
||||
rv=prefs->GetBoolPref(PREF_MAIL_FIXED_WIDTH_MESSAGES, &(exdata->fixedwidthfont));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get the mail.fixed_width_messages pref");
|
||||
}
|
||||
|
||||
// Set a default font (otherwise unicode font will be used since the data is UTF-8).
|
||||
if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
|
||||
nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out) {
|
||||
char fontName[128];
|
||||
char buf[256];
|
||||
PRInt32 fontSize;
|
||||
if (exdata->fixedwidthfont) {
|
||||
rv = GetMailNewsFont(obj, PR_TRUE, fontName, 128, &fontSize);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_snprintf(buf, 256, "<tt style=\"font-family: %s; font-size: %dpx;\">", (const char *) fontName, fontSize);
|
||||
status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
|
||||
}
|
||||
else
|
||||
status = MimeObject_write(obj, "<tt>", 4, PR_FALSE);
|
||||
}
|
||||
else {
|
||||
rv = GetMailNewsFont(obj, PR_FALSE, fontName, 128, &fontSize);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpx;\">", (const char *) fontName, fontSize);
|
||||
status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
|
||||
}
|
||||
else
|
||||
status = MimeObject_write(obj, "<div>", 5, PR_FALSE);
|
||||
}
|
||||
if(status<0) return status;
|
||||
}
|
||||
|
||||
MimeInlineTextPlainFlowed *text = (MimeInlineTextPlainFlowed *) obj;
|
||||
|
||||
// Ok, first get the quoting settings.
|
||||
|
||||
// Link it up.
|
||||
exdata->next = MimeInlineTextPlainFlowedExDataList;
|
||||
MimeInlineTextPlainFlowedExDataList = exdata;
|
||||
|
||||
// Initialize data
|
||||
|
||||
exdata->ownerobj = obj;
|
||||
exdata->inflow = PR_FALSE;
|
||||
exdata->quotelevel = 0;
|
||||
exdata->isSig = PR_FALSE;
|
||||
|
||||
// Get Prefs for viewing
|
||||
|
||||
exdata->fixedwidthfont = PR_FALSE;
|
||||
// Quotes
|
||||
text->mQuotedSizeSetting = 0; // mail.quoted_size
|
||||
text->mQuotedStyleSetting = 0; // mail.quoted_style
|
||||
text->mCitationColor = nsnull; // mail.citation_color
|
||||
|
||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
||||
if (prefs)
|
||||
{
|
||||
prefs->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
||||
prefs->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
||||
prefs->CopyCharPref("mail.citation_color", &(text->mCitationColor));
|
||||
nsresult rv = prefs->GetBoolPref( "mail.fixed_width_messages",
|
||||
&(exdata->fixedwidthfont) ); // Check at least the success of one
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"failed to get the mail.fixed_width_messages pref");
|
||||
}
|
||||
|
||||
// Link it up.
|
||||
exdata->next = MimeInlineTextPlainFlowedExDataList;
|
||||
MimeInlineTextPlainFlowedExDataList = exdata;
|
||||
|
||||
// If we should use a fixed width font, emit
|
||||
// a <div style="font-family:monospace"> DIDN'T WORK
|
||||
// a <tt>
|
||||
if(exdata->fixedwidthfont)
|
||||
// Get font
|
||||
// only used for viewing (!plainHTML)
|
||||
nsCAutoString fontstyle;
|
||||
if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
|
||||
nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out)
|
||||
{
|
||||
/* Use a langugage sensitive default font
|
||||
(otherwise unicode font will be used since the data is UTF-8). */
|
||||
char fontName[128]; // default font name
|
||||
PRInt32 fontSize; // default font size
|
||||
nsresult rv = GetMailNewsFont(obj, exdata->fixedwidthfont,
|
||||
fontName, 128, &fontSize);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// *Don't work* status = MimeObject_write(obj, "<div style=\"font-family=monospace\">", 35, PR_FALSE);
|
||||
status = MimeObject_write(obj, "<tt>", 4, PR_FALSE);
|
||||
if(status<0) return status;
|
||||
fontstyle = "font-family: ";
|
||||
fontstyle += fontName;
|
||||
fontstyle += "; font-size: ";
|
||||
fontstyle.AppendInt(fontSize);
|
||||
fontstyle += "px;";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (exdata->fixedwidthfont)
|
||||
fontstyle = "font-family: -moz-fixed";
|
||||
}
|
||||
}
|
||||
|
||||
else // DELETEME: makes sense?
|
||||
{
|
||||
if (exdata->fixedwidthfont)
|
||||
fontstyle = "font-family: -moz-fixed";
|
||||
}
|
||||
|
||||
// Opening <div>. We currently have to add formatting here. :-(
|
||||
nsCAutoString openingDiv("<div class=text-flowed");
|
||||
if (!plainHTML && !fontstyle.IsEmpty())
|
||||
{
|
||||
openingDiv += " style=\"";
|
||||
openingDiv += fontstyle;
|
||||
openingDiv += '\"';
|
||||
}
|
||||
openingDiv += "><tt>";
|
||||
status = MimeObject_write(obj, openingDiv,openingDiv.Length(), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -157,6 +172,12 @@ static int
|
|||
MimeInlineTextPlainFlowed_parse_eof (MimeObject *obj, PRBool abort_p)
|
||||
{
|
||||
int status;
|
||||
MimeInlineTextPlainFlowed *text = (MimeInlineTextPlainFlowed *) nsnull;
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // see above
|
||||
|
||||
if (obj->closed_p) return 0;
|
||||
|
||||
/* Run parent method first, to flush out any buffered data. */
|
||||
|
@ -183,55 +204,26 @@ MimeInlineTextPlainFlowed_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
prevexdata->next = exdata->next;
|
||||
}
|
||||
|
||||
PRUint32 quotelevel = exdata->quotelevel;
|
||||
PRBool fixedwidthfont = exdata->fixedwidthfont;
|
||||
PR_Free(exdata);
|
||||
|
||||
while(quotelevel>0) {
|
||||
// Write </blockquote>
|
||||
if(exdata->fixedwidthfont) {
|
||||
status = MimeObject_write(obj, "</tt></blockquote><tt>", 22, PR_FALSE);
|
||||
} else {
|
||||
status = MimeObject_write(obj, "</blockquote>", 13, PR_FALSE);
|
||||
}
|
||||
if(status<0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
quotelevel--;
|
||||
for(; exdata->quotelevel>0; exdata->quotelevel--) {
|
||||
status = MimeObject_write(obj, "</blockquote>", 13, PR_FALSE);
|
||||
if(status<0) goto EarlyOut;
|
||||
}
|
||||
if (exdata->isSig && !quoting) {
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE);
|
||||
if (status<0) goto EarlyOut;
|
||||
}
|
||||
status = MimeObject_write(obj, "</tt></div>", 12, PR_FALSE); // text-flowed
|
||||
if (status<0) goto EarlyOut;
|
||||
|
||||
// Make sure we close out any <DIV>'s if they are open!
|
||||
MimeInlineTextPlainFlowed *text = (MimeInlineTextPlainFlowed *) obj;
|
||||
status = 0;
|
||||
text = (MimeInlineTextPlainFlowed *) obj;
|
||||
|
||||
EarlyOut:
|
||||
if (exdata)
|
||||
PR_Free(exdata);
|
||||
PR_FREEIF(text->mCitationColor);
|
||||
|
||||
// Close out the block quote
|
||||
status = MimeObject_write(obj, "</DIV>", 6, PR_FALSE);
|
||||
|
||||
if(fixedwidthfont)
|
||||
{
|
||||
// *don't work* status = MimeObject_write(obj, "</div>", 6, PR_FALSE);
|
||||
status = MimeObject_write(obj, "</tt>", 5, PR_FALSE);
|
||||
if(status<0) return status;
|
||||
#ifdef DEBUG_rhp
|
||||
printf("fixbredd\n");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG_rhp
|
||||
printf("propbredd");
|
||||
#endif
|
||||
}
|
||||
|
||||
// End defalut font
|
||||
if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
|
||||
nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out) {
|
||||
if (fixedwidthfont)
|
||||
status = MimeObject_write(obj, "</tt>", 5, PR_FALSE);
|
||||
else
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -239,13 +231,20 @@ static int
|
|||
MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
||||
{
|
||||
int status;
|
||||
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // see above
|
||||
PRBool plainHTML = quoting || (obj->options &&
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs);
|
||||
// see above
|
||||
|
||||
struct MimeInlineTextPlainFlowedExData *exdata;
|
||||
exdata = MimeInlineTextPlainFlowedExDataList;
|
||||
while(exdata && (exdata->ownerobj != obj)) {
|
||||
exdata = exdata->next;
|
||||
}
|
||||
|
||||
|
||||
NS_ASSERTION(exdata, "The extra data has disappeared!");
|
||||
|
||||
#ifdef DEBUG_bratell
|
||||
|
@ -301,13 +300,14 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
}
|
||||
buffersizeneeded += 30; // For possible <nobr> ... </nobr>
|
||||
|
||||
// Ok, there is always the issue of guessing how much space we will need for emoticons.
|
||||
// So what we will do is count the total number of "special" chars and multiply by 82
|
||||
// (max len for a smiley line) and add one for good measure
|
||||
/* There is the issue of guessing how much space we will need for emoticons.
|
||||
So what we will do is count the total number of "special" chars and
|
||||
multiply by 82 (max len for a smiley line) and add one for good measure.*/
|
||||
PRInt32 specialCharCount = 0;
|
||||
for (PRInt32 z=0; z<length; z++)
|
||||
{
|
||||
if ( (line[z] == ')') || (line[z] == '(') || (line[z] == ':') || (line[z] == ';') )
|
||||
if ( (line[z] == ')') || (line[z] == '(') || (line[z] == ':')
|
||||
|| (line[z] == ';') || (line[z] == '>') )
|
||||
++specialCharCount;
|
||||
}
|
||||
buffersizeneeded += 82 * (specialCharCount + 1);
|
||||
|
@ -342,44 +342,38 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
|
||||
mozITXTToHTMLConv *conv = GetTextConverter(obj->options);
|
||||
|
||||
PRBool skipConversion =
|
||||
!conv ||
|
||||
( obj->options
|
||||
&&
|
||||
(
|
||||
obj->options->force_user_charset ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs
|
||||
) );
|
||||
PRBool skipConversion = !conv ||
|
||||
(obj->options && obj->options->force_user_charset);
|
||||
|
||||
if (!skipConversion)
|
||||
{
|
||||
//XXX I18N Converting char* to PRUnichar*
|
||||
nsString strline; strline.AssignWithConversion(linep, (length - (linep - line)) );
|
||||
nsString strline;
|
||||
strline.AssignWithConversion(linep, (length - (linep - line)) );
|
||||
PRUnichar* wresult = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
PRBool whattodo = obj->options->whattodo;
|
||||
if
|
||||
(
|
||||
obj->options
|
||||
&&
|
||||
(
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
)
|
||||
)
|
||||
whattodo = 0;
|
||||
if (plainHTML)
|
||||
{
|
||||
if (quoting)
|
||||
whattodo = 0;
|
||||
else
|
||||
whattodo = whattodo & ~mozITXTToHTMLConv::kGlyphSubstitution;
|
||||
/* Do recognition for the case, the result is viewed in
|
||||
Mozilla, but not GlyphSubstitution, because other UAs
|
||||
might not be able to display the glyphs. */
|
||||
}
|
||||
|
||||
rv = conv->ScanTXT(strline.GetUnicode(), whattodo, &wresult);
|
||||
if (NS_FAILED(rv))
|
||||
return -1;
|
||||
|
||||
//XXX I18N Converting PRUnichar* to char*
|
||||
// avoid an extra string copy by using nsSubsumeStr, this transfers ownership of
|
||||
// wresult to strresult so don't try to free wresult later.
|
||||
nsString strresult(nsSubsumeStr(wresult, PR_TRUE /* assume ownership */, nsCRT::strlen(wresult)));
|
||||
/* avoid an extra string copy by using nsSubsumeStr, this transfers
|
||||
ownership of wresult to strresult so don't try to free wresult later. */
|
||||
nsSubsumeStr strresult(wresult, PR_TRUE /* assume ownership */);
|
||||
|
||||
// avoid yet another extra string copy of the line by using .ToCString which will
|
||||
// convert and copy directly into the buffer we have already allocated.
|
||||
/* avoid yet another extra string copy of the line by using .ToCString
|
||||
which will convert and copy directly into the buffer we have already
|
||||
allocated. */
|
||||
strresult.ToCString(templine, buffersizeneeded - 10);
|
||||
}
|
||||
else
|
||||
|
@ -414,13 +408,11 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
while(quoteleveldiff>0) {
|
||||
quoteleveldiff--;
|
||||
/* Output <blockquote> */
|
||||
if(exdata->fixedwidthfont) {
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='/'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='/'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
*outlinep='l'; outlinep++;
|
||||
|
@ -442,35 +434,40 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
*outlinep='i'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='e'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
if(exdata->fixedwidthfont) {
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
|
||||
// This is to have us observe the user pref settings for citations
|
||||
MimeInlineTextPlainFlowed *tObj = (MimeInlineTextPlainFlowed *) obj;
|
||||
char *openDiv = MimeTextBuildPrefixCSS(tObj->mQuotedSizeSetting,
|
||||
tObj->mQuotedStyleSetting,
|
||||
tObj->mCitationColor);
|
||||
if (openDiv)
|
||||
char *style = MimeTextBuildPrefixCSS(tObj->mQuotedSizeSetting,
|
||||
tObj->mQuotedStyleSetting,
|
||||
tObj->mCitationColor);
|
||||
if (!plainHTML && style && strlen(style))
|
||||
{
|
||||
status = MimeObject_write(obj, openDiv, nsCRT::strlen(openDiv), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
*outlinep=' '; outlinep++;
|
||||
*outlinep='s'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='y'; outlinep++;
|
||||
*outlinep='l'; outlinep++;
|
||||
*outlinep='e'; outlinep++;
|
||||
*outlinep='='; outlinep++;
|
||||
*outlinep='\"'; outlinep++;
|
||||
strcpy(outlinep, style);
|
||||
outlinep += nsCRT::strlen(style);
|
||||
*outlinep='\"'; outlinep++;
|
||||
PR_FREEIF(style);
|
||||
}
|
||||
*outlinep='>'; outlinep++;
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
while(quoteleveldiff<0) {
|
||||
quoteleveldiff++;
|
||||
/* Output </blockquote> */
|
||||
if(exdata->fixedwidthfont) {
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='/'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='/'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='/'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
|
@ -484,17 +481,15 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
*outlinep='t'; outlinep++;
|
||||
*outlinep='e'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
if(exdata->fixedwidthfont) {
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
*outlinep='<'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='t'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
exdata->quotelevel = linequotelevel;
|
||||
|
||||
|
||||
if(flowed) {
|
||||
|
||||
int32 dashdashspace; // Check for RFC 2646 4.3
|
||||
if((0==linequotelevel) && !exdata->inflow){
|
||||
// possible
|
||||
|
@ -502,6 +497,9 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
} else {
|
||||
dashdashspace = -1;
|
||||
}
|
||||
PRBool firstSpaceNbsp = PR_FALSE; /* Convert all spaces but
|
||||
the first in a row into nbsp (i.e. always wrap) */
|
||||
PRBool nextSpaceIsNbsp = firstSpaceNbsp;
|
||||
while(*templinep && ('\r' != *templinep)) {
|
||||
// Check RFC 2646 "4.3. Usenet Signature Convention": "-- "+CRLF is
|
||||
// not a flowed line
|
||||
|
@ -526,10 +524,49 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
} // end if(dashdashspace...)
|
||||
|
||||
// Output the same character
|
||||
|
||||
*outlinep=*templinep;
|
||||
outlinep++;
|
||||
templinep++;
|
||||
// Here, the most of the flowing text is written
|
||||
// DELETEME: What is this intag in the fixed code and do we need it here?
|
||||
if((' ' == *templinep) && !exdata->inflow) {
|
||||
if (nextSpaceIsNbsp)
|
||||
{
|
||||
*outlinep='&'; outlinep++;
|
||||
*outlinep='n'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
*outlinep='s'; outlinep++;
|
||||
*outlinep='p'; outlinep++;
|
||||
*outlinep=';'; outlinep++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*outlinep=' '; outlinep++;
|
||||
}
|
||||
nextSpaceIsNbsp = PR_TRUE;
|
||||
templinep++;
|
||||
} else if(('\t' == *templinep) && !exdata->inflow) {
|
||||
// Output 4 "spaces"
|
||||
for(int spaces=0; spaces<4; spaces++) {
|
||||
if (nextSpaceIsNbsp)
|
||||
{
|
||||
*outlinep='&'; outlinep++;
|
||||
*outlinep='n'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
*outlinep='s'; outlinep++;
|
||||
*outlinep='p'; outlinep++;
|
||||
*outlinep=';'; outlinep++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*outlinep=' '; outlinep++;
|
||||
}
|
||||
nextSpaceIsNbsp = PR_TRUE;
|
||||
}
|
||||
templinep++;
|
||||
} else {
|
||||
nextSpaceIsNbsp = firstSpaceNbsp;
|
||||
*outlinep = *templinep;
|
||||
outlinep++;
|
||||
templinep++;
|
||||
}
|
||||
|
||||
}
|
||||
if(3 == dashdashspace) {
|
||||
|
@ -538,12 +575,11 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
*outlinep='b'; outlinep++;
|
||||
*outlinep='r'; outlinep++;
|
||||
*outlinep='>'; outlinep++;
|
||||
}
|
||||
}
|
||||
|
||||
exdata->inflow=PR_TRUE;
|
||||
} else {
|
||||
// Fixed
|
||||
uint32 intag = 0;
|
||||
|
||||
/* // Output the stripped '>':s
|
||||
while(linequotelevel) {
|
||||
|
@ -556,22 +592,17 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
}
|
||||
*/
|
||||
|
||||
uint32 intag = 0;
|
||||
PRBool firstSpaceNbsp = !plainHTML && !obj->options->wrap_long_lines_p;
|
||||
/* If wrap, convert all spaces but the first in a row into nbsp,
|
||||
otherwise all. */
|
||||
PRBool nextSpaceIsNbsp = firstSpaceNbsp;
|
||||
while(*templinep && (*templinep != '\r')) {
|
||||
if('<' == *templinep) intag = 1;
|
||||
if(!intag) {
|
||||
if((' ' == *templinep) && !exdata->inflow) {
|
||||
// To not get any line wraps
|
||||
*outlinep='&'; outlinep++;
|
||||
*outlinep='n'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
*outlinep='s'; outlinep++;
|
||||
*outlinep='p'; outlinep++;
|
||||
*outlinep=';'; outlinep++;
|
||||
templinep++;
|
||||
} else if(('\t' == *templinep) && !exdata->inflow) {
|
||||
// To not get any line wraps
|
||||
// Output 4 spaces
|
||||
for(int spaces=0; spaces<4; spaces++) {
|
||||
if (nextSpaceIsNbsp)
|
||||
{
|
||||
*outlinep='&'; outlinep++;
|
||||
*outlinep='n'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
|
@ -579,14 +610,40 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
*outlinep='p'; outlinep++;
|
||||
*outlinep=';'; outlinep++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*outlinep=' '; outlinep++;
|
||||
}
|
||||
nextSpaceIsNbsp = PR_TRUE;
|
||||
templinep++;
|
||||
} else if(('\t' == *templinep) && !exdata->inflow) {
|
||||
// Output 4 "spaces"
|
||||
for(int spaces=0; spaces<4; spaces++) {
|
||||
if (nextSpaceIsNbsp)
|
||||
{
|
||||
*outlinep='&'; outlinep++;
|
||||
*outlinep='n'; outlinep++;
|
||||
*outlinep='b'; outlinep++;
|
||||
*outlinep='s'; outlinep++;
|
||||
*outlinep='p'; outlinep++;
|
||||
*outlinep=';'; outlinep++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*outlinep=' '; outlinep++;
|
||||
}
|
||||
nextSpaceIsNbsp = PR_TRUE;
|
||||
}
|
||||
templinep++;
|
||||
} else {
|
||||
nextSpaceIsNbsp = firstSpaceNbsp;
|
||||
*outlinep = *templinep;
|
||||
outlinep++;
|
||||
templinep++;
|
||||
}
|
||||
} else {
|
||||
// In tag. Don't change anything
|
||||
nextSpaceIsNbsp = firstSpaceNbsp;
|
||||
*outlinep = *templinep;
|
||||
outlinep++;
|
||||
templinep++;
|
||||
|
@ -601,14 +658,10 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
exdata->inflow = PR_FALSE;
|
||||
} // End Fixed line
|
||||
|
||||
*outlinep='\r'; outlinep++;
|
||||
*outlinep='\n'; outlinep++;
|
||||
*outlinep='\0'; outlinep++;
|
||||
|
||||
PR_Free(templine);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_bratell
|
||||
fprintf(stderr,"*OUT*");
|
||||
for(uint32 lineindex2 = 0; lineindex2 < nsCRT::strlen(obj->obuffer); lineindex2++) {
|
||||
|
|
|
@ -56,6 +56,7 @@ struct MimeInlineTextPlainFlowedExData {
|
|||
PRBool inflow; /* If we currently are in flow */
|
||||
PRBool fixedwidthfont; /* If we output text for fixed width font */
|
||||
PRUint32 quotelevel; /* How deep is your love, uhr, quotelevel I meen. */
|
||||
PRBool isSig; // we're currently in a signature
|
||||
struct MimeInlineTextPlainFlowedExData *next;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Ben Bucksch <mozilla@bucksch.org>
|
||||
*/
|
||||
|
||||
#include "mimetpla.h"
|
||||
|
@ -63,11 +64,9 @@ MimeTextBuildPrefixCSS(PRInt32 quotedSizeSetting, // mail.quoted_size
|
|||
PRInt32 quotedStyleSetting, // mail.quoted_style
|
||||
char *citationColor) // mail.citation_color
|
||||
{
|
||||
char *openDiv = nsnull;
|
||||
char *formatCstr = nsnull;
|
||||
nsCString formatString;
|
||||
|
||||
formatString = "<DIV name=\"text-cite\" style=\"";
|
||||
|
||||
switch (quotedStyleSetting)
|
||||
{
|
||||
case 0: // regular
|
||||
|
@ -87,32 +86,36 @@ MimeTextBuildPrefixCSS(PRInt32 quotedSizeSetting, // mail.quoted_size
|
|||
{
|
||||
case 0: // regular
|
||||
break;
|
||||
case 1: // bigger
|
||||
formatString.Append("font-size: bigger; ");
|
||||
case 1: // large
|
||||
formatString.Append("font-size: large; ");
|
||||
break;
|
||||
case 2: // smaller
|
||||
formatString.Append("font-size: smaller; ");
|
||||
case 2: // small
|
||||
formatString.Append("font-size: small; ");
|
||||
break;
|
||||
}
|
||||
|
||||
if (citationColor)
|
||||
if (citationColor && nsCRT::strlen(citationColor) != 0)
|
||||
{
|
||||
formatString.Append("color: %s;\">");
|
||||
openDiv = PR_smprintf(formatString, citationColor);
|
||||
formatString += "color: ";
|
||||
formatString += citationColor;
|
||||
formatString += ';';
|
||||
}
|
||||
else
|
||||
{
|
||||
formatString.Append("\">");
|
||||
openDiv = formatString.ToNewCString();
|
||||
}
|
||||
|
||||
return openDiv;
|
||||
|
||||
formatCstr = formatString.ToNewCString();
|
||||
return formatCstr;
|
||||
}
|
||||
|
||||
static int
|
||||
MimeInlineTextPlain_parse_begin (MimeObject *obj)
|
||||
{
|
||||
int status = 0;
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // The output will be inserted in the composer as quotation
|
||||
PRBool plainHTML = quoting || (obj->options &&
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs);
|
||||
// Just good(tm) HTML. No reliance on CSS (only for prefs).
|
||||
|
||||
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
|
||||
if (status < 0) return status;
|
||||
|
@ -123,73 +126,86 @@ MimeInlineTextPlain_parse_begin (MimeObject *obj)
|
|||
obj->options->write_html_p &&
|
||||
obj->options->output_fn)
|
||||
{
|
||||
char buf[256]; // local buffer for html tag
|
||||
char fontName[128]; // default font name
|
||||
PRInt32 fontSize; // default font size
|
||||
PRBool setDefaultFont = PR_FALSE;
|
||||
nsresult rv;
|
||||
|
||||
// Use a default font (otherwise unicode font will be used since the data is UTF-8).
|
||||
if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
|
||||
nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out)
|
||||
{
|
||||
rv = GetMailNewsFont(obj, !obj->options->variable_width_plaintext_p, fontName, 128, &fontSize);
|
||||
setDefaultFont = NS_SUCCEEDED(rv);
|
||||
}
|
||||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
text->mCiteLevel = 0;
|
||||
|
||||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
// Get the prefs
|
||||
|
||||
// Ok, first get the quoting settings.
|
||||
text->mInsideQuote = PR_FALSE;
|
||||
text->mQuotedSizeSetting = 0; // mail.quoted_size
|
||||
text->mQuotedStyleSetting = 0; // mail.quoted_style
|
||||
text->mCitationColor = nsnull; // mail.citation_color
|
||||
// Quoting
|
||||
text->mBlockquoting = PR_TRUE; // mail.quoteasblock
|
||||
|
||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
||||
if (prefs)
|
||||
{
|
||||
prefs->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
||||
prefs->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
||||
prefs->CopyCharPref("mail.citation_color", &(text->mCitationColor));
|
||||
}
|
||||
// Viewing
|
||||
text->mQuotedSizeSetting = 0; // mail.quoted_size
|
||||
text->mQuotedStyleSetting = 0; // mail.quoted_style
|
||||
text->mCitationColor = nsnull; // mail.citation_color
|
||||
PRBool graphicalQuote = PR_TRUE; // mail.quoted_graphical
|
||||
|
||||
if (setDefaultFont)
|
||||
{
|
||||
// For quoting, keep it simple...
|
||||
if ( (obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting) ||
|
||||
(obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting) )
|
||||
PR_snprintf(buf, 256, "<pre %s style=\"font-family: %s; font-size: %dpx;\">",
|
||||
obj->options->wrap_long_lines_p ? "wrap" : "",
|
||||
(const char *) fontName, fontSize);
|
||||
else
|
||||
PR_snprintf(buf, 256, "<pre %s style=\"font-family: %s; font-size: %dpx;\">",
|
||||
obj->options->wrap_long_lines_p ? "wrap" : "",
|
||||
(const char *) fontName, fontSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* strs[4];
|
||||
strs[0] = "<PRE>";
|
||||
strs[1] = "<PRE style=\"font-family: serif;\">";
|
||||
strs[2] = "<PRE WRAP>";
|
||||
strs[3] = "<PRE WRAP style=\"font-family: serif;\">";
|
||||
// For quoting, keep it simple...
|
||||
if ( (obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting) ||
|
||||
(obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting) )
|
||||
nsIPref *prefs = GetPrefServiceManager(obj->options);
|
||||
if (prefs)
|
||||
{
|
||||
prefs->GetIntPref("mail.quoted_size", &(text->mQuotedSizeSetting));
|
||||
prefs->GetIntPref("mail.quoted_style", &(text->mQuotedStyleSetting));
|
||||
prefs->CopyCharPref("mail.citation_color", &(text->mCitationColor));
|
||||
prefs->GetBoolPref("mail.quoted_graphical", &graphicalQuote);
|
||||
prefs->GetBoolPref("mail.quoteasblock", &(text->mBlockquoting));
|
||||
}
|
||||
|
||||
// Get font
|
||||
// only used for viewing (!plainHTML)
|
||||
nsCAutoString fontstyle;
|
||||
if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
|
||||
nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out)
|
||||
{
|
||||
/* Use a langugage sensitive default font
|
||||
(otherwise unicode font will be used since the data is UTF-8). */
|
||||
char fontName[128]; // default font name
|
||||
PRInt32 fontSize; // default font size
|
||||
nsresult rv = GetMailNewsFont(obj,
|
||||
!obj->options->variable_width_plaintext_p,
|
||||
fontName, 128, &fontSize);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
fontstyle = "font-family: ";
|
||||
fontstyle += fontName;
|
||||
fontstyle += "; font-size: ";
|
||||
fontstyle.AppendInt(fontSize);
|
||||
fontstyle += "px;";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!obj->options->variable_width_plaintext_p)
|
||||
fontstyle = "font-family: -moz-fixed";
|
||||
}
|
||||
}
|
||||
else // DELETEME: makes sense?
|
||||
{
|
||||
if (!obj->options->variable_width_plaintext_p)
|
||||
fontstyle = "font-family: -moz-fixed";
|
||||
}
|
||||
|
||||
// Opening <div>. We currently have to add formatting here. :-(
|
||||
nsCAutoString openingDiv("<div class=text-plain");
|
||||
if (!plainHTML)
|
||||
{
|
||||
if (obj->options->wrap_long_lines_p)
|
||||
PL_strcpy(buf, strs[2]);
|
||||
openingDiv += " wrap=true";
|
||||
else
|
||||
PL_strcpy(buf, strs[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PL_strcpy(buf, strs[(obj->options->variable_width_plaintext_p ? 1 : 0) +
|
||||
(obj->options->wrap_long_lines_p ? 2 : 0)]);
|
||||
}
|
||||
}
|
||||
openingDiv += " wrap=false";
|
||||
|
||||
status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
|
||||
if (graphicalQuote)
|
||||
openingDiv += " graphical-quote=true";
|
||||
else
|
||||
openingDiv += " graphical-quote=false";
|
||||
|
||||
if (!fontstyle.IsEmpty())
|
||||
{
|
||||
openingDiv += " style=\"";
|
||||
openingDiv += fontstyle;
|
||||
openingDiv += '\"';
|
||||
}
|
||||
}
|
||||
openingDiv += "><pre wrap>";
|
||||
status = MimeObject_write(obj, openingDiv,openingDiv.Length(), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
|
||||
/* text/plain objects always have separators before and after them.
|
||||
|
@ -206,6 +222,10 @@ MimeInlineTextPlain_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
{
|
||||
int status;
|
||||
if (obj->closed_p) return 0;
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // see above
|
||||
|
||||
/* Run parent method first, to flush out any buffered data. */
|
||||
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
|
||||
|
@ -218,22 +238,18 @@ MimeInlineTextPlain_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
obj->options->output_fn &&
|
||||
!abort_p)
|
||||
{
|
||||
char s[] = "</PRE>";
|
||||
status = MimeObject_write(obj, s, nsCRT::strlen(s), PR_FALSE);
|
||||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
if (text->mIsSig && !quoting)
|
||||
{
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE);
|
||||
// sig
|
||||
if (status < 0) return status;
|
||||
}
|
||||
status = MimeObject_write(obj, "</pre></div>", 12, PR_FALSE);
|
||||
// pre, text-plain
|
||||
if (status < 0) return status;
|
||||
|
||||
// Make sure we close out any <DIV>'s if they are open!
|
||||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
PR_FREEIF(text->mCitationColor);
|
||||
|
||||
if (text->mInsideQuote)
|
||||
{
|
||||
char *closeDiv = "</DIV>";
|
||||
status = MimeObject_write(obj, closeDiv, nsCRT::strlen(closeDiv), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
/* text/plain objects always have separators before and after them.
|
||||
/* text/plain objects always have separators before and after them.
|
||||
Note that this is not the case for text/enriched objects.
|
||||
*/
|
||||
status = MimeObject_write_separator(obj);
|
||||
|
@ -247,121 +263,205 @@ MimeInlineTextPlain_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
static int
|
||||
MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
||||
{
|
||||
// this routine gets called for every line of data that comes through the mime
|
||||
// converter. It's important to make sure we are efficient with
|
||||
int status;
|
||||
PRBool quoting = ( obj->options
|
||||
&& ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
) ); // see above
|
||||
PRBool plainHTML = quoting || (obj->options &&
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs);
|
||||
// see above
|
||||
|
||||
// this routine gets called for every line of data that comes through the
|
||||
// mime converter. It's important to make sure we are efficient with
|
||||
// how we allocate memory in this routine. be careful if you go to add
|
||||
// more to this routine.
|
||||
|
||||
int status;
|
||||
|
||||
NS_ASSERTION(length > 0, "zero length");
|
||||
if (length <= 0) return 0;
|
||||
|
||||
#ifdef USE_OBUFFER
|
||||
/* There is the issue of guessing how much space we will need for emoticons.
|
||||
So what we will do is count the total number of "special" chars and
|
||||
multiply by 82 (max len for a smiley line) and add one for good measure.*/
|
||||
// Do we need obj->obuffer at all here? Bug 39226
|
||||
PRInt32 buffersizeneeded = (length * 2);
|
||||
|
||||
// Ok, there is always the issue of guessing how much space we will need for emoticons.
|
||||
// So what we will do is count the total number of "special" chars and multiply by 82
|
||||
// (max len for a smiley line) and add one for good measure
|
||||
//XXX: make dynamic
|
||||
PRInt32 specialCharCount = 0;
|
||||
for (PRInt32 z=0; z<length; z++)
|
||||
{
|
||||
if ( (line[z] == ')') || (line[z] == '(') || (line[z] == ':') || (line[z] == ';') )
|
||||
if ( (line[z] == ')') || (line[z] == '(') || (line[z] == ':')
|
||||
|| (line[z] == ';') || (line[z] == '>') )
|
||||
++specialCharCount;
|
||||
}
|
||||
buffersizeneeded += 82 * (specialCharCount + 1);
|
||||
|
||||
status = MimeObject_grow_obuffer (obj, buffersizeneeded);
|
||||
if (status < 0) return status;
|
||||
|
||||
/* Copy `line' to `out', quoting HTML along the way.
|
||||
Note: this function does no charset conversion; that has already
|
||||
been done.
|
||||
*/
|
||||
*obj->obuffer = 0;
|
||||
#endif
|
||||
|
||||
mozITXTToHTMLConv *conv = GetTextConverter(obj->options);
|
||||
|
||||
PRBool skipConversion =
|
||||
!conv ||
|
||||
( obj->options &&
|
||||
(
|
||||
obj->options->force_user_charset ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs
|
||||
) );
|
||||
|
||||
// Before we do any other processing, we should figure out if we need to
|
||||
// put this information in a <DIV> tag
|
||||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
if (text->mInsideQuote)
|
||||
{
|
||||
if (line[0] != '>')
|
||||
{
|
||||
char *closeDiv = "</DIV>";
|
||||
status = MimeObject_write(obj, closeDiv, nsCRT::strlen(closeDiv), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
text->mInsideQuote = PR_FALSE;
|
||||
}
|
||||
}
|
||||
else if ( (line[0] == '>') &&
|
||||
( (obj) &&
|
||||
obj->options->format_out != nsMimeOutput::nsMimeMessageQuoting &&
|
||||
obj->options->format_out != nsMimeOutput::nsMimeMessageBodyQuoting ) )
|
||||
{
|
||||
|
||||
char *openDiv = MimeTextBuildPrefixCSS(text->mQuotedSizeSetting,
|
||||
text->mQuotedStyleSetting,
|
||||
text->mCitationColor);
|
||||
if (openDiv)
|
||||
{
|
||||
status = MimeObject_write(obj, openDiv, nsCRT::strlen(openDiv), PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
text->mInsideQuote = PR_TRUE;
|
||||
}
|
||||
|
||||
PR_FREEIF(openDiv);
|
||||
}
|
||||
PRBool skipConversion = !conv ||
|
||||
(obj->options && obj->options->force_user_charset);
|
||||
|
||||
if (!skipConversion)
|
||||
{
|
||||
nsString strline; strline.AssignWithConversion(line, length);
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* wresult = nsnull;
|
||||
PRBool whattodo = obj->options->whattodo;
|
||||
if
|
||||
(
|
||||
obj->options
|
||||
&&
|
||||
(
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||
|
||||
obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting
|
||||
)
|
||||
)
|
||||
whattodo = 0;
|
||||
nsString lineSourceStr;
|
||||
lineSourceStr.AssignWithConversion(line, length);
|
||||
nsresult rv;
|
||||
nsCAutoString prefaceResultStr; // Quoting stuff before the real text
|
||||
|
||||
rv = conv->ScanTXT(strline.GetUnicode(), whattodo, &wresult);
|
||||
// Recognize quotes
|
||||
PRUint32 oldCiteLevel = text->mCiteLevel;
|
||||
PRUint32 logicalLineStart = 0;
|
||||
rv = conv->CiteLevelTXT(lineSourceStr.GetUnicode(),
|
||||
&logicalLineStart, &(text->mCiteLevel));
|
||||
if (NS_FAILED(rv))
|
||||
return -1;
|
||||
|
||||
//XXX I18N Converting PRUnichar* to char*
|
||||
// avoid an extra string copy by using nsSubsumeStr, this transfers ownership of
|
||||
// wresult to strresult so don't try to free wresult later.
|
||||
nsString strresult(nsSubsumeStr(wresult, PR_TRUE /* assume ownership */, nsCRT::strlen(wresult)));
|
||||
// Find out, which recognitions to do
|
||||
PRBool whattodo = obj->options->whattodo;
|
||||
if (plainHTML)
|
||||
{
|
||||
if (quoting)
|
||||
whattodo = 0; // This is done on Send. Don't do it twice.
|
||||
else
|
||||
whattodo = whattodo & ~mozITXTToHTMLConv::kGlyphSubstitution;
|
||||
/* Do recognition for the case, the result is viewed in
|
||||
Mozilla, but not GlyphSubstitution, because other UAs
|
||||
might not be able to display the glyphs. */
|
||||
if (!text->mBlockquoting)
|
||||
text->mCiteLevel = 0;
|
||||
}
|
||||
|
||||
// avoid yet another extra string copy of the line by using .ToCString which will
|
||||
// convert and copy directly into the buffer we have already allocated.
|
||||
strresult.ToCString(obj->obuffer, obj->obuffer_size - 10);
|
||||
// Write blockquote
|
||||
if (text->mCiteLevel > oldCiteLevel)
|
||||
{
|
||||
prefaceResultStr += "</pre>";
|
||||
for (PRUint32 i = 0; i < text->mCiteLevel - oldCiteLevel; i++)
|
||||
{
|
||||
char *style = MimeTextBuildPrefixCSS(text->mQuotedSizeSetting,
|
||||
text->mQuotedStyleSetting,
|
||||
text->mCitationColor);
|
||||
if (!plainHTML && style && nsCRT::strlen(style))
|
||||
{
|
||||
prefaceResultStr += "<blockquote type=cite style=\"";
|
||||
prefaceResultStr += style;
|
||||
prefaceResultStr += "\">";
|
||||
}
|
||||
else
|
||||
prefaceResultStr += "<blockquote type=cite>";
|
||||
Recycle(style);
|
||||
}
|
||||
prefaceResultStr += "<pre wrap>";
|
||||
}
|
||||
else if (text->mCiteLevel < oldCiteLevel)
|
||||
{
|
||||
prefaceResultStr += "</pre>";
|
||||
for (PRUint32 i = 0; i < oldCiteLevel - text->mCiteLevel; i++)
|
||||
prefaceResultStr += "</blockquote>";
|
||||
prefaceResultStr += "<pre wrap>";
|
||||
if (text->mCiteLevel == 0)
|
||||
prefaceResultStr += "<!---->"; /* Make sure, NGLayout puts out
|
||||
a linebreak */
|
||||
}
|
||||
|
||||
// Write plain text quoting tags
|
||||
if (logicalLineStart != 0 && !(plainHTML && text->mBlockquoting))
|
||||
{
|
||||
if (!quoting)
|
||||
prefaceResultStr += "<span class=txt-citetags>";
|
||||
|
||||
nsAutoString citeTagsSource;
|
||||
lineSourceStr.Mid(citeTagsSource, 0, logicalLineStart);
|
||||
NS_ASSERTION(citeTagsSource.IsASCII(), "Non-ASCII-Chars are about to be "
|
||||
"added to nsCAutoString prefaceResultStr. "
|
||||
"Change the latter to nsAutoString.");
|
||||
/* I'm currently using nsCAutoString, because currently citeTagsSource
|
||||
is always ASCII and I save 2 conversions this way. */
|
||||
|
||||
// Convert to HTML
|
||||
PRUnichar* citeTagsResultUnichar = nsnull;
|
||||
rv = conv->ScanTXT(citeTagsSource.GetUnicode(), 0 /* no recognition */,
|
||||
&citeTagsResultUnichar);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
// Convert to char* and write out
|
||||
nsSubsumeStr citeTagsResultStr(citeTagsResultUnichar,
|
||||
PR_TRUE /* assume ownership */);
|
||||
char* citeTagsResultCStr = citeTagsResultStr.ToNewCString();
|
||||
|
||||
prefaceResultStr += citeTagsResultCStr;
|
||||
Recycle(citeTagsResultCStr);
|
||||
if (!quoting)
|
||||
prefaceResultStr += "</span>";
|
||||
}
|
||||
|
||||
|
||||
// recognize signature
|
||||
if (lineSourceStr.First() == '-'
|
||||
&& lineSourceStr.EqualsWithConversion("-- ", PR_FALSE, 3)
|
||||
&& (lineSourceStr[3] == '\r' || lineSourceStr[3] == '\n') )
|
||||
{
|
||||
text->mIsSig = PR_TRUE;
|
||||
if (!quoting)
|
||||
prefaceResultStr += "<div class=txt-sig>";
|
||||
}
|
||||
|
||||
/* This is the main TXT to HTML conversion:
|
||||
escaping (very important), eventually recognizing etc. */
|
||||
PRUnichar* lineResultUnichar = nsnull;
|
||||
rv = conv->ScanTXT(lineSourceStr.GetUnicode() + logicalLineStart,
|
||||
whattodo, &lineResultUnichar);
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
// avoid an extra string copy by using nsSubsumeStr, this transfers
|
||||
// ownership of wresult to strresult so don't try to free wresult later.
|
||||
nsSubsumeStr lineResultStr(lineResultUnichar,
|
||||
PR_TRUE /* assume ownership */);
|
||||
|
||||
if (!(text->mIsSig && quoting))
|
||||
{
|
||||
#ifdef USE_OBUFFER
|
||||
/* Do we need obj->obuffer at all here? Bug 39226 */
|
||||
prefaceResultStr.ToCString(obj->obuffer, obj->obuffer_size - 10);
|
||||
lineResultStr.ToCString(obj->obuffer + prefaceResultStr.Length(),
|
||||
obj->obuffer_size - 10 - prefaceResultStr.Length());
|
||||
#else
|
||||
char* tmp = prefaceResultStr.ToNewCString();
|
||||
status = MimeObject_write(obj, tmp, prefaceResultStr.Length(), PR_TRUE);
|
||||
if (status < 0) return status;
|
||||
Recycle(tmp);
|
||||
tmp = lineResultStr.ToNewCString();
|
||||
status = MimeObject_write(obj, tmp, lineResultStr.Length(), PR_TRUE);
|
||||
if (status < 0) return status;
|
||||
Recycle(tmp);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
status = NS_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_OBUFFER
|
||||
nsCRT::memcpy(obj->obuffer, line, length);
|
||||
obj->obuffer[length] = '\0';
|
||||
status = NS_OK;
|
||||
#else
|
||||
status = MimeObject_write(obj, line, length, PR_TRUE);
|
||||
if (status < 0) return status;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (status != NS_OK)
|
||||
return status;
|
||||
|
||||
#ifdef USE_OBUFFER
|
||||
NS_ASSERTION(*line == 0 || *obj->obuffer, "have line or buffer");
|
||||
return MimeObject_write(obj, obj->obuffer, nsCRT::strlen(obj->obuffer), PR_TRUE);
|
||||
status = MimeObject_write(obj, obj->obuffer, nsCRT::strlen(obj->obuffer),
|
||||
PR_TRUE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,11 +39,14 @@ struct MimeInlineTextPlainClass {
|
|||
extern MimeInlineTextPlainClass mimeInlineTextPlainClass;
|
||||
|
||||
struct MimeInlineTextPlain {
|
||||
MimeInlineText text;
|
||||
PRBool mInsideQuote;
|
||||
MimeInlineText text;
|
||||
PRUint32 mCiteLevel;
|
||||
PRBool mBlockquoting;
|
||||
//PRBool mInsideQuote;
|
||||
PRInt32 mQuotedSizeSetting; // mail.quoted_size
|
||||
PRInt32 mQuotedStyleSetting; // mail.quoted_style
|
||||
char *mCitationColor; // mail.citation_color
|
||||
PRBool mIsSig;
|
||||
};
|
||||
|
||||
#endif /* _MIMETPLA_H_ */
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
#include "nsStreamConverter.h" // test hack
|
||||
#include "nsIAllocator.h"
|
||||
|
||||
#ifdef XP_PC
|
||||
#include <windows.h>
|
||||
|
@ -469,11 +470,24 @@ main(int argc, char** argv)
|
|||
// Do some sanity checking...
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "usage: %s <rfc822_disk_file> <output_format>\n\n", argv[0]);
|
||||
fprintf(stderr, "usage: %s <rfc822_disk_file> [<output_format>]\n\n", argv[0]);
|
||||
fprintf(stderr, "where output_format is:\n\n19 - indentation formatting\n");
|
||||
fprintf(stderr, " 1 - nsMimeMessagePrintOutput\n");
|
||||
fprintf(stderr, " 0 - nsMimeMessageSplitDisplay\n");
|
||||
fprintf(stderr, " 1 - nsMimeMessageHeaderDisplay\n");
|
||||
fprintf(stderr, " 2 - nsMimeMessageBodyDisplay\n");
|
||||
fprintf(stderr, " 3 - nsMimeMessageQuoting\n");
|
||||
fprintf(stderr, " 4 - nsMimeMessageBodyQuoting\n");
|
||||
fprintf(stderr, " 5 - nsMimeMessageRaw\n");
|
||||
fprintf(stderr, " 6 - nsMimeMessageDraftOrTemplate\n");
|
||||
fprintf(stderr, " 7 - nsMimeMessageEditorTemplate\n");
|
||||
fprintf(stderr, " 8 - nsMimeMessageXULDisplay\n");
|
||||
fprintf(stderr, " 9 - nsMimeMessagePrintOutput\n");
|
||||
fprintf(stderr, " 10 - nsMimeMessageSaveAs\n");
|
||||
fprintf(stderr, " 11 - nsMimeMessageSource\n");
|
||||
fprintf(stderr, " 12 - nsMimeUnknown\n");
|
||||
fprintf(stderr, " (the numbers are not garanteed to persist. See\n");
|
||||
fprintf(stderr, " <http://lxr.mozilla.org/seamonkey/source/mailnews/mime/public/nsIMimeStreamConverter.idl>\n");
|
||||
fprintf(stderr, " interface nsMimeOutput for most recent info.)\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -516,13 +530,6 @@ DoRFC822toHTMLConversion(char *filename, int numArgs, int outFormat)
|
|||
nsIURI *theURI = nsnull;
|
||||
char *contentType = nsnull;
|
||||
|
||||
if (outFormat == 1)
|
||||
outFormat = nsMimeOutput::nsMimeMessagePrintOutput;
|
||||
else if (outFormat == 2)
|
||||
outFormat = nsMimeOutput::nsMimeMessageBodyDisplay;
|
||||
else if (outFormat == 3)
|
||||
outFormat = nsMimeOutput::nsMimeMessageBodyDisplay;
|
||||
|
||||
char *opts = PL_strchr(filename, '?');
|
||||
char save;
|
||||
if (opts)
|
||||
|
@ -599,9 +606,10 @@ DoRFC822toHTMLConversion(char *filename, int numArgs, int outFormat)
|
|||
nsIChannel *tChannel = nsnull;
|
||||
|
||||
NewChannel(&tChannel, theURI);
|
||||
mimeParser->AsyncConvertData(nsString("message/rfc822").GetUnicode(),
|
||||
nsString("text/xul").GetUnicode(),
|
||||
out, tChannel);
|
||||
mimeParser->AsyncConvertData(
|
||||
nsString(NS_ConvertToString("message/rfc822")).GetUnicode(),
|
||||
nsString(NS_ConvertToString("text/xul")).GetUnicode(),
|
||||
out, tChannel);
|
||||
|
||||
// rv = mimeParser->Init(theURI, out, nsnull);
|
||||
if (NS_FAILED(rv) || !mimeParser)
|
||||
|
|
|
@ -93,9 +93,11 @@ pref("mail.support_skey", false);
|
|||
pref("mail.pop_password", "");
|
||||
pref("mail.auto_quote", true);
|
||||
pref("mail.fixed_width_messages", true);
|
||||
pref("mail.quoted_style", 2); // 0=plain, 1=bold, 2=italic, 3=bolditalic
|
||||
pref("mail.quoted_size", 0); // 0=normal, 1=bigger, 2=smaller
|
||||
pref("mail.citation_color", "#000000"); // quoted color
|
||||
pref("mail.citation_color", ""); // quoted color
|
||||
pref("mail.quoted_style", 0); // 0=plain, 1=bold, 2=italic, 3=bolditalic
|
||||
pref("mail.quoted_size", 0); // 0=normal, 1=big, 2=small
|
||||
pref("mail.quoted_graphical", true); // use HTML-style quoting for displaying plain text
|
||||
pref("mail.quoteasblock", false); // use HTML-style quoting for quoting plain text
|
||||
pref("mail.identity.organization", "");
|
||||
pref("mail.identity.reply_to", "");
|
||||
pref("mail.identity.username", "");
|
||||
|
@ -406,7 +408,7 @@ pref("mail.server.default.dual_use_folders", true);
|
|||
|
||||
pref("mail.smtpserver.default.auth_method", 2); // auth login
|
||||
|
||||
pref("mail.display_glyph",true); // see <http://www.bucksch.org/1/projects/mozilla/16507/>
|
||||
pref("mail.display_glyph",true); // see <http://www.bucksch.org/1/projects/mozilla/16507>
|
||||
pref("mail.display_struct",true); // dito
|
||||
pref("mail.send_struct",true); // dito
|
||||
|
||||
|
|
|
@ -25,3 +25,59 @@ table[name=header-part2] { background-color: #DEDEDE; border: 0px solid #DEDE
|
|||
table[name=header-part3] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
div.headerdisplayname { font-weight: bold; white-space: pre; display: inline; }
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.text-flowed tt {
|
||||
font-family: inherit;
|
||||
}
|
||||
.text-flowed blockquote {
|
||||
margin: 0em 0em;
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
/* Anyhow, the <div class=txt-sig> doesn't inherit whitespace setting from
|
||||
its parent pre, but from its ancestor .text-plain. */
|
||||
.text-plain {
|
||||
white-space: -moz-pre-wrap;
|
||||
}
|
||||
.text-plain[wrap=false] {
|
||||
white-space: pre;
|
||||
}
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
white-space: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
/* That's how it should really be
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
.text-plain[wrap=false] pre {
|
||||
white-space: pre;
|
||||
}
|
||||
*/
|
||||
.text-plain[graphical-quote=false] blockquote {
|
||||
padding-left: inherit;
|
||||
border-left: inherit;
|
||||
margin: 0em 0em;
|
||||
}
|
||||
.text-plain[graphical-quote=true] blockquote {
|
||||
margin: 0em 0em;
|
||||
border-width: medium;
|
||||
border-color: black;
|
||||
}
|
||||
.text-plain[graphical-quote=true] .txt-citetags {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.txt-sig, .signature {
|
||||
color: gray;
|
||||
}
|
||||
.txt-sig > a, .signature > a {
|
||||
color: 7777FF /* light blue */;
|
||||
}
|
||||
|
|
|
@ -25,3 +25,59 @@ table[name=header-part2] { background-color: #DEDEDE; border: 0px solid #DEDE
|
|||
table[name=header-part3] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
div.headerdisplayname { font-weight: bold; white-space: pre; display: inline; }
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.text-flowed tt {
|
||||
font-family: inherit;
|
||||
}
|
||||
.text-flowed blockquote {
|
||||
margin: 0em 0em;
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
/* Anyhow, the <div class=txt-sig> doesn't inherit whitespace setting from
|
||||
its parent pre, but from its ancestor .text-plain. */
|
||||
.text-plain {
|
||||
white-space: -moz-pre-wrap;
|
||||
}
|
||||
.text-plain[wrap=false] {
|
||||
white-space: pre;
|
||||
}
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
white-space: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
/* That's how it should really be
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
.text-plain[wrap=false] pre {
|
||||
white-space: pre;
|
||||
}
|
||||
*/
|
||||
.text-plain[graphical-quote=false] blockquote {
|
||||
padding-left: inherit;
|
||||
border-left: inherit;
|
||||
margin: 0em 0em;
|
||||
}
|
||||
.text-plain[graphical-quote=true] blockquote {
|
||||
margin: 0em 0em;
|
||||
border-width: medium;
|
||||
border-color: black;
|
||||
}
|
||||
.text-plain[graphical-quote=true] .txt-citetags {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.txt-sig, .signature {
|
||||
color: gray;
|
||||
}
|
||||
.txt-sig > a, .signature > a {
|
||||
color: 7777FF /* light blue */;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче