Fix for bug 62031. Make it possible to display format=flowed mails as normal text/plain mails. r=nhotta@netscape.com sr=bienvenu@netscape.com

This commit is contained in:
bratell%lysator.liu.se 2000-12-19 19:24:07 +00:00
Родитель 58379e624f
Коммит 85e4c6bc6d
1 изменённых файлов: 36 добавлений и 26 удалений

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

@ -326,33 +326,43 @@ mime_find_class (const char *content_type, MimeHeaders *hdrs,
clazz = (MimeObjectClass *)&mimeExternalObjectClass;
else if (!nsCRT::strcasecmp(content_type+5, "plain"))
{
// Check for format=flowed, damn, it is already stripped away from
// the contenttype!
// Look in headers instead even though it's expensive and clumsy
// First find Content-Type:
char *content_type_row = (hdrs
? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE,
PR_FALSE, PR_FALSE)
: 0);
// Then the format parameter if there is one.
// I would rather use a PARAM_FORMAT but I can't find the right
// place to put the define. The others seems to be in net.h
// but is that really really the right place? There is also
// a nsMimeTypes.h but that one isn't included. Bug?
char *content_type_format =
(content_type_row
? MimeHeaders_get_parameter(content_type_row, "format", NULL, NULL)
: 0);
// Preliminary use the normal plain text
clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;
if (content_type_format && !nsCRT::strcasecmp(content_type_format,
"flowed"))
clazz = (MimeObjectClass *)&mimeInlineTextPlainFlowedClass;
else
clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;
PR_FREEIF(content_type_format);
PR_FREEIF(content_type_row);
PRBool disable_format_flowed = PR_FALSE;
nsIPref *pref = GetPrefServiceManager(opts);
if (pref)
(void)pref->GetBoolPref(
"mailnews.display.disable_format_flowed_support",
&disable_format_flowed);
if(!disable_format_flowed)
{
// Check for format=flowed, damn, it is already stripped away from
// the contenttype!
// Look in headers instead even though it's expensive and clumsy
// First find Content-Type:
char *content_type_row =
(hdrs
? MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE,
PR_FALSE, PR_FALSE)
: 0);
// Then the format parameter if there is one.
// I would rather use a PARAM_FORMAT but I can't find the right
// place to put the define. The others seems to be in net.h
// but is that really really the right place? There is also
// a nsMimeTypes.h but that one isn't included. Bug?
char *content_type_format =
(content_type_row
? MimeHeaders_get_parameter(content_type_row, "format", NULL, NULL)
: 0);
if (content_type_format && !nsCRT::strcasecmp(content_type_format,
"flowed"))
clazz = (MimeObjectClass *)&mimeInlineTextPlainFlowedClass;
PR_FREEIF(content_type_format);
PR_FREEIF(content_type_row);
}
}
else if (!exact_match_p)
clazz = (MimeObjectClass *)&mimeInlineTextPlainClass;