зеркало из https://github.com/mozilla/gecko-dev.git
Cleanup changes for libmime.
This commit is contained in:
Родитель
ebcaf17042
Коммит
cc7c2bba59
|
@ -16,6 +16,13 @@
|
|||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is the definitions for the Content Type Handler plugins for
|
||||
* libmime. This will allow developers the dynamically add the ability
|
||||
* for libmime to render new content types in the MHTML rendering of
|
||||
* HTML messages.
|
||||
*/
|
||||
|
||||
#ifndef _MIMECTH_H_
|
||||
#define _MIMECTH_H_
|
||||
|
||||
|
@ -86,6 +93,13 @@
|
|||
|--- MimeExternalBody
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are used by libmime to locate the plugins. It uses
|
||||
* a directory under the bin directory for libmime to contain
|
||||
* the plugins. This directory is defined by MIME_PLUGIN_DIR and
|
||||
* mime content handler plugins have a name prefixed by the
|
||||
* MIME_PLUGIN_PREFIX.
|
||||
*/
|
||||
#define MIME_PLUGIN_PREFIX "mimect-"
|
||||
#define MIME_PLUGIN_DIR "mimeplugins"
|
||||
|
||||
|
@ -93,9 +107,20 @@ typedef struct {
|
|||
PRBool force_inline_display;
|
||||
} contentTypeHandlerInitStruct;
|
||||
|
||||
/*
|
||||
* These functions are exposed by libmime to be used by content type
|
||||
* handler plugins for processing stream data.
|
||||
*/
|
||||
/*
|
||||
* This is the write call for outputting processed stream data.
|
||||
*/
|
||||
extern int MIME_MimeObject_write(MimeObject *, char *data,
|
||||
PRInt32 length,
|
||||
PRBool user_visible_p);
|
||||
/*
|
||||
* The following group of calls expose the pointers for the object
|
||||
* system within libmime.
|
||||
*/
|
||||
extern MimeInlineTextClass *MIME_GetmimeInlineTextClass(void);
|
||||
extern MimeLeafClass *MIME_GetmimeLeafClass(void);
|
||||
extern MimeObjectClass *MIME_GetmimeObjectClass(void);
|
||||
|
@ -103,8 +128,31 @@ extern MimeContainerClass *MIME_GetmimeContainerClass(void);
|
|||
extern MimeMultipartClass *MIME_GetmimeMultipartClass(void);
|
||||
extern MimeMultipartSignedClass *MIME_GetmimeMultipartSignedClass(void);
|
||||
|
||||
/*
|
||||
* These are the functions that need to be implemented by the
|
||||
* content type handler plugin. They will be called by by libmime
|
||||
* when the module is loaded at runtime.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIME_GetContentType() is called by libmime to identify the content
|
||||
* type handled by this plugin.
|
||||
*/
|
||||
char *MIME_GetContentType(void);
|
||||
|
||||
/*
|
||||
* This will create the MimeObjectClass object to be used by the libmime
|
||||
* object system.
|
||||
*/
|
||||
MimeObjectClass *MIME_CreateContentTypeHandlerClass(const char *content_type,
|
||||
contentTypeHandlerInitStruct *initStruct);
|
||||
|
||||
/*
|
||||
* Typedefs for libmime to use when locating and calling the above
|
||||
* defined functions.
|
||||
*/
|
||||
typedef char * (*mime_get_ct_fn_type)(void);
|
||||
typedef MimeObjectClass * (*mime_create_class_fn_type)
|
||||
(const char *, contentTypeHandlerInitStruct *);
|
||||
|
||||
#endif /* _MIMECTH_H_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ MimeDefClass(MimeExternalBody, MimeExternalBodyClass,
|
|||
extern int MK_MSG_LINK_TO_DOCUMENT;
|
||||
extern int MK_MSG_DOCUMENT_INFO;
|
||||
|
||||
#if defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
extern MimeObjectClass mimeMultipartAppleDoubleClass;
|
||||
#endif
|
||||
|
||||
|
@ -260,11 +260,11 @@ MimeExternalBody_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
|
||||
if (status < 0) return status;
|
||||
|
||||
#if defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
if (obj->parent && mime_typep(obj->parent,
|
||||
(MimeObjectClass*) &mimeMultipartAppleDoubleClass))
|
||||
goto done;
|
||||
#endif /* defined (XP_MAC) && !defined(MOZILLA_30) */
|
||||
#endif /* XP_MAC */
|
||||
|
||||
if (!abort_p &&
|
||||
obj->output_p &&
|
||||
|
@ -446,9 +446,9 @@ MimeExternalBody_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
PR_FREEIF(subj);
|
||||
}
|
||||
|
||||
#if defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
done:
|
||||
#endif /* defined (XP_MAC) && !defined(MOZILLA_30) */
|
||||
#endif /* XP_MAC */
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ MimeDefClass(MimeExternalObject, MimeExternalObjectClass,
|
|||
|
||||
extern int MK_MSG_ATTACHMENT;
|
||||
|
||||
#if defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
extern MimeObjectClass mimeMultipartAppleDoubleClass;
|
||||
#endif
|
||||
|
||||
|
@ -80,11 +80,11 @@ MimeExternalObject_parse_begin (MimeObject *obj)
|
|||
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
|
||||
if (status < 0) return status;
|
||||
|
||||
#if defined (XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
if (obj->parent && mime_typep(obj->parent,
|
||||
(MimeObjectClass *) &mimeMultipartAppleDoubleClass))
|
||||
goto done;
|
||||
#endif /* defined (XP_MAC) && !defined(MOZILLA_30) */
|
||||
#endif /* XP_MAC */
|
||||
|
||||
/* If we're writing this object, and we're doing it in raw form, then
|
||||
now is the time to inform the backend what the type of this data is.
|
||||
|
@ -202,9 +202,9 @@ MimeExternalObject_parse_begin (MimeObject *obj)
|
|||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
#if defined (XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
done:
|
||||
#endif /* defined (XP_MAC) && !defined(MOZILLA_30) */
|
||||
#endif /* XP_MAC */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,13 +26,9 @@
|
|||
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
# include "msgcom.h"
|
||||
#include "msgcom.h"
|
||||
#include "imap.h"
|
||||
#include "prefapi.h"
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
extern int MK_OUT_OF_MEMORY;
|
||||
extern int MK_MSG_NO_HEADERS;
|
||||
|
@ -709,18 +705,6 @@ MimeHeaders_default_news_link_generator (const char *dest, void *closure,
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOZILLA_30
|
||||
static char *
|
||||
MimeHeaders_default_mailto_link_generator (const char *dest, void *closure,
|
||||
MimeHeaders *headers)
|
||||
{
|
||||
/* For now, don't emit mailto links over email addresses. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !MOZILLA_30 */
|
||||
|
||||
static char *mime_escape_quotes (char *src)
|
||||
{
|
||||
/* Make sure quotes are escaped with a backslash */
|
||||
|
@ -849,9 +833,6 @@ MimeHeaders_default_addbook_link_generator (const char *dest, void *closure,
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
|
||||
#define MimeHeaders_grow_obuffer(hdrs, desired_size) \
|
||||
((((long) (desired_size)) >= ((long) (hdrs)->obuffer_size)) ? \
|
||||
msg_GrowBuffer ((desired_size), sizeof(char), 255, \
|
||||
|
@ -929,12 +910,10 @@ MimeHeaders_localize_header_name(const char *name, MimeDisplayOptions *opt)
|
|||
if (!display_key)
|
||||
return name;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
output_csid = INTL_CharSetNameToID((opt->override_charset
|
||||
? opt->override_charset
|
||||
: opt->default_charset));
|
||||
new_name = XP_GetStringForHTML(display_key, output_csid, (char*)name);
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
if (new_name)
|
||||
return new_name;
|
||||
|
@ -1023,9 +1002,7 @@ MimeHeaders_write_random_header_1 (MimeHeaders *hdrs,
|
|||
already been done.
|
||||
*/
|
||||
status = NET_ScanForURLs (
|
||||
#ifndef MOZILLA_30
|
||||
NULL,
|
||||
#endif /* !MOZILLA_30 */
|
||||
contents, contents_length, out,
|
||||
hdrs->obuffer_size - (out - hdrs->obuffer) -10,
|
||||
PR_TRUE);
|
||||
|
@ -1117,14 +1094,12 @@ static PRBool shortHdrPrefStatus = 0; /* 0: First time. */
|
|||
/* 1: Cache is not valid. */
|
||||
/* 2: Cache is valid. */
|
||||
/* rhp: for new header wrap functionality */
|
||||
#ifndef MOZILLA_30
|
||||
int PR_CALLBACK
|
||||
ShortHeaderPrefsChangeCallback(const char* prefname, void* data)
|
||||
{
|
||||
shortHdrPrefStatus = 1; /* Invalidates our cached stuff. */
|
||||
return PREF_NOERROR;
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
static int
|
||||
MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
||||
|
@ -1166,17 +1141,11 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
/* grow obuffer with potential XSENDER AUTH string */
|
||||
status = MimeHeaders_grow_obuffer (hdrs, (name ? PL_strlen (name) : 0)
|
||||
+ 100 + 2 *
|
||||
PL_strlen(XP_GetString(MK_MSG_XSENDER_INTERNAL)) +
|
||||
(contents_length * 4));
|
||||
#else
|
||||
status = MimeHeaders_grow_obuffer (hdrs, (name ? PL_strlen (name) : 0)
|
||||
+ 100 +
|
||||
(contents_length * 4));
|
||||
#endif
|
||||
if (status < 0) goto FAIL;
|
||||
|
||||
out = hdrs->obuffer;
|
||||
|
@ -1308,13 +1277,8 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
|||
{
|
||||
if (mail_p)
|
||||
{
|
||||
#ifdef MOZILLA_30
|
||||
fn = MimeHeaders_default_mailto_link_generator;
|
||||
arg = 0;
|
||||
#else /* !MOZILLA_30 */
|
||||
fn = MimeHeaders_default_addbook_link_generator;
|
||||
arg = &extraAnchorText;
|
||||
#endif /* !MOZILLA_30 */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1323,33 +1287,6 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZILLA_30
|
||||
/* If this is the "From" header, or if this is a
|
||||
"Followup-To: poster" entry, let the Reply-To address win.
|
||||
|
||||
Only do this for Mozilla 3.0 because 3.0 put mailto links
|
||||
in here, and 4.0 and later put addbook links in here.
|
||||
*/
|
||||
if (mail_header_p
|
||||
? (name && !PL_strcasecmp(name, HEADER_FROM))
|
||||
: mail_p)
|
||||
{
|
||||
char *r = 0;
|
||||
r = MimeHeaders_get (hdrs, HEADER_REPLY_TO,
|
||||
PR_FALSE, PR_TRUE);
|
||||
if (!r) r = MimeHeaders_get (hdrs, HEADER_FROM, PR_FALSE, PR_TRUE);
|
||||
if (!r) r = MimeHeaders_get (hdrs, HEADER_SENDER, PR_FALSE, PR_TRUE);
|
||||
|
||||
if (r)
|
||||
{
|
||||
PL_strcpy (hdrs->obuffer, r);
|
||||
PR_Free(r);
|
||||
}
|
||||
else
|
||||
*hdrs->obuffer = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*hdrs->obuffer && opt->fancy_links_p)
|
||||
link = fn (hdrs->obuffer, arg, hdrs);
|
||||
else
|
||||
|
@ -1392,7 +1329,7 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
|||
}
|
||||
if (extraAnchorText)
|
||||
PR_Free (extraAnchorText);
|
||||
#ifndef MOZILLA_30
|
||||
|
||||
/* Begin hack of out of envelope XSENDER info */
|
||||
if (orig_name && !PL_strcasecmp(orig_name, HEADER_FROM)) {
|
||||
char * statusLine = MimeHeaders_get (hdrs, HEADER_X_MOZILLA_STATUS, PR_FALSE, PR_FALSE);
|
||||
|
@ -1418,7 +1355,6 @@ MimeHeaders_write_grouped_header_1 (MimeHeaders *hdrs, const char *name,
|
|||
}
|
||||
}
|
||||
/* End of XSENDER info */
|
||||
#endif /* MOZILLA_30 */
|
||||
status = MimeHeaders_write(opt, hdrs->obuffer,
|
||||
PL_strlen (hdrs->obuffer));
|
||||
if (status < 0) goto FAIL;
|
||||
|
@ -2042,9 +1978,7 @@ MimeHeaders_write_all_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt)
|
|||
}
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
# define EGREGIOUS_HEADERS
|
||||
#endif
|
||||
#define EGREGIOUS_HEADERS
|
||||
|
||||
static int
|
||||
MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs,
|
||||
|
@ -2121,9 +2055,7 @@ MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs,
|
|||
/* Quotify the subject... */
|
||||
if (subj)
|
||||
status = NET_ScanForURLs (
|
||||
# ifndef MOZILLA_30
|
||||
NULL,
|
||||
# endif /* !MOZILLA_30 */
|
||||
subj, PL_strlen(subj), out,
|
||||
hdrs->obuffer_size - (out - hdrs->obuffer) - 10,
|
||||
PR_TRUE);
|
||||
|
@ -2136,9 +2068,7 @@ MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs,
|
|||
/* Quotify the sender... */
|
||||
if (from)
|
||||
status = NET_ScanForURLs (
|
||||
# ifndef MOZILLA_30
|
||||
NULL,
|
||||
# endif /* !MOZILLA_30 */
|
||||
from, PL_strlen(from), out,
|
||||
hdrs->obuffer_size - (out - hdrs->obuffer) - 10,
|
||||
PR_TRUE);
|
||||
|
@ -2151,9 +2081,7 @@ MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs,
|
|||
/* Quotify the date (just in case...) */
|
||||
if (date)
|
||||
status = NET_ScanForURLs (
|
||||
# ifndef MOZILLA_30
|
||||
NULL,
|
||||
# endif /* !MOZILLA_30 */
|
||||
date, PL_strlen(date), out,
|
||||
hdrs->obuffer_size - (out - hdrs->obuffer) - 10,
|
||||
PR_TRUE);
|
||||
|
@ -2201,9 +2129,7 @@ MimeHeaders_write_microscopic_headers (MimeHeaders *hdrs,
|
|||
out += PL_strlen(out);
|
||||
if (subj) {
|
||||
status = NET_ScanForURLs(
|
||||
#ifndef MOZILLA_30
|
||||
NULL,
|
||||
#endif /* !MOZILLA_30 */
|
||||
subj, PL_strlen(subj), out,
|
||||
hdrs->obuffer_size - (out - hdrs->obuffer) - 10,
|
||||
PR_TRUE);
|
||||
|
@ -2307,7 +2233,6 @@ MimeHeaders_write_citation_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt)
|
|||
(id ? PL_strlen(id) : 0) + 58);
|
||||
if (status < 0) return status;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (opt->nice_html_only_p) {
|
||||
PRInt32 nReplyWithExtraLines = 0, eReplyOnTop = 0;
|
||||
PREF_GetIntPref("mailnews.reply_with_extra_lines", &nReplyWithExtraLines);
|
||||
|
@ -2319,7 +2244,6 @@ MimeHeaders_write_citation_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (id)
|
||||
XP_SPRINTF(hdrs->obuffer, fmt, id, name);
|
||||
|
@ -2342,12 +2266,10 @@ MimeHeaders_write_citation_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt)
|
|||
if (status < 0) goto FAIL;
|
||||
}
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (opt->nice_html_only_p) {
|
||||
char ptr[] = MHTML_BLOCKQUOTE_BEGIN;
|
||||
MimeHeaders_write(opt, ptr, PL_strlen(ptr));
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
FAIL:
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ get_plugin_count(void)
|
|||
char *
|
||||
get_content_type(cthandler_struct *ct)
|
||||
{
|
||||
typedef char * (*mime_get_ct_fn_type)(void);
|
||||
mime_get_ct_fn_type getct_fn;
|
||||
|
||||
if (!ct)
|
||||
|
@ -173,8 +172,6 @@ get_content_type(cthandler_struct *ct)
|
|||
MimeObjectClass *
|
||||
create_content_type_handler_class(cthandler_struct *ct)
|
||||
{
|
||||
typedef MimeObjectClass * (*mime_create_class_fn_type)
|
||||
(const char *, contentTypeHandlerInitStruct *);
|
||||
contentTypeHandlerInitStruct ctHandlerInfo;
|
||||
mime_create_class_fn_type class_fn;
|
||||
MimeObjectClass *retClass = NULL;
|
||||
|
|
|
@ -363,7 +363,6 @@ extern int MimeObject_write_separator(MimeObject *);
|
|||
extern int MK_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
/* Turn this on if you want to play with the idea of displaying icons in the
|
||||
headers to represent attachments, and put icons next to each attachment so
|
||||
you can easily save them without having to bring up the "as links" view.
|
||||
|
@ -375,23 +374,6 @@ extern int MK_OUT_OF_MEMORY;
|
|||
extern PRBool MimeObjectChildIsMessageBody(MimeObject *obj,
|
||||
PRBool *isAlterOrRelated);
|
||||
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
/* #### These ought to be in libxp or nspr, not libmsg...*/
|
||||
#if 0
|
||||
extern int msg_GrowBuffer (PRInt32 desired_size, PRInt32 element_size,
|
||||
PRInt32 quantum, char **buffer, PRInt32 *size);
|
||||
|
||||
extern int msg_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size,
|
||||
char **bufferP, PRInt32 *buffer_sizeP,
|
||||
PRInt32 *buffer_fpP,
|
||||
PRBool convert_newlines_p,
|
||||
PRInt32 (*per_line_fn) (char *line,
|
||||
PRUint32 line_length,
|
||||
void *closure),
|
||||
void *closure);
|
||||
#endif
|
||||
|
||||
/* This is the data tagged to contexts and the declaration needs to be
|
||||
in a header file since more than mimemoz.c needs to see it now...
|
||||
*/
|
||||
|
@ -412,10 +394,7 @@ struct MimeDisplayData { /* This struct is what we hang off of
|
|||
char *previous_locked_url;
|
||||
#endif /* LOCK_LAST_CACHED_MESSAGE */
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
MSG_Pane* last_pane;
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
};
|
||||
|
||||
#endif /* _MIMEI_H_ */
|
||||
|
|
|
@ -68,7 +68,7 @@ MimeMultipartAppleDouble_parse_begin (MimeObject *obj)
|
|||
PR_ASSERT(obj->options->state->first_data_written_p);
|
||||
}
|
||||
|
||||
#if !defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
if (obj->options && obj->options->state)
|
||||
{
|
||||
obj->options->state->separator_suppressed_p = PR_TRUE;
|
||||
|
@ -174,7 +174,7 @@ MimeMultipartAppleDouble_parse_begin (MimeObject *obj)
|
|||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
#if !defined(XP_MAC) && !defined(MOZILLA_30)
|
||||
#ifdef XP_MAC
|
||||
done:
|
||||
#endif
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ struct mime_stream_data { /* This struct is the state we pass around
|
|||
/* These are used by FO_QUOTE_HTML_MESSAGE stuff only: */
|
||||
PRInt16 lastcsid; /* csid corresponding to above. */
|
||||
PRInt16 outcsid; /* csid passed to EDT_PasteQuoteINTL */
|
||||
#ifndef MOZILLA_30
|
||||
uint8 rand_buf[6]; /* Random number used in the MATCH
|
||||
attribute of the ILAYER tag
|
||||
pair that encapsulates a
|
||||
|
@ -112,15 +111,11 @@ struct mime_stream_data { /* This struct is the state we pass around
|
|||
an email message allowing the
|
||||
message to escape from its
|
||||
encapsulated environment. */
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
#ifdef DEBUG_rhp
|
||||
PRFileDesc *logit; /* Temp file to put generated HTML into. */
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
|
||||
static MimeHeadersState MIME_HeaderType;
|
||||
static PRBool MIME_NoInlineAttachments;
|
||||
static PRBool MIME_WrapLongLines;
|
||||
|
@ -129,8 +124,6 @@ static PRBool MIME_PrefDataValid = 0; /* 0: First time. */
|
|||
/* 1: Cache is not valid. */
|
||||
/* 2: Cache is valid. */
|
||||
|
||||
#endif
|
||||
|
||||
static char *
|
||||
mime_reformat_date(const char *date, void *stream_closure)
|
||||
{
|
||||
|
@ -312,7 +305,6 @@ mime_set_html_state_fn (void *stream_closure,
|
|||
#endif /* 0 */
|
||||
|
||||
if (start_p) {
|
||||
#ifndef MOZILLA_30
|
||||
if (layer_encapsulate_p && msd->options && !msd->options->nice_html_only_p){
|
||||
uint8 *rand_buf = msd->rand_buf;
|
||||
//RICHIECSS RNG_GenerateGlobalRandomBytes(rand_buf, sizeof msd->rand_buf);
|
||||
|
@ -326,7 +318,6 @@ mime_set_html_state_fn (void *stream_closure,
|
|||
status = MimeOptions_write(msd->options, buf, PL_strlen(buf), PR_TRUE);
|
||||
PR_Free(buf);
|
||||
}
|
||||
#endif /* MOZILLA_30 */
|
||||
} else {
|
||||
/* RICHIE_CSS - this doesn't work anymore...
|
||||
status = MimeOptions_write(msd->options, random_close_tags,
|
||||
|
@ -335,7 +326,6 @@ mime_set_html_state_fn (void *stream_closure,
|
|||
return status;
|
||||
*/
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (layer_encapsulate_p && msd->options && !msd->options->nice_html_only_p){
|
||||
uint8 *rand_buf = msd->rand_buf;
|
||||
//RICHIECSS buf = PR_smprintf("</ILAYER MATCH=%02x%02x%02x%02x%02x%02x><BR>",
|
||||
|
@ -348,8 +338,6 @@ mime_set_html_state_fn (void *stream_closure,
|
|||
if (status < 0)
|
||||
return status;
|
||||
}
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
@ -531,8 +519,6 @@ mime_display_stream_abort (void *stream, int status)
|
|||
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
|
||||
static unsigned int
|
||||
mime_insert_html_write_ready(void *stream)
|
||||
{
|
||||
|
@ -627,9 +613,6 @@ mime_insert_html_convert_charset (const char *input_line, PRInt32 input_length,
|
|||
return status;
|
||||
}
|
||||
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
|
||||
static NET_StreamClass *
|
||||
mime_make_output_stream(const char *content_type,
|
||||
const char *charset,
|
||||
|
@ -653,7 +636,6 @@ mime_make_output_stream(const char *content_type,
|
|||
char *old_part = 0;
|
||||
char *old_part2 = 0;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (format_out == FO_QUOTE_HTML_MESSAGE) {
|
||||
/* Special case here. Make a stream that just jams data directly
|
||||
into our editor context. No calling of NET_StreamBuilder for me;
|
||||
|
@ -672,8 +654,6 @@ mime_make_output_stream(const char *content_type,
|
|||
return stream;
|
||||
}
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
|
||||
PR_ASSERT(content_type && url);
|
||||
if (!content_type || !url)
|
||||
|
@ -997,10 +977,7 @@ mime_output_init_fn (const char *type,
|
|||
}
|
||||
context->mime_data->last_parsed_object = msd->obj;
|
||||
context->mime_data->last_parsed_url = PL_strdup(msd->url->address);
|
||||
#ifndef MOZILLA_30
|
||||
context->mime_data->last_pane = msd->url->msg_pane;
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
PR_ASSERT(!msd->options ||
|
||||
msd->options == msd->obj->options);
|
||||
}
|
||||
|
@ -1016,20 +993,12 @@ static void mime_image_end(void *image_closure, int status);
|
|||
static char *mime_image_make_image_html(void *image_data);
|
||||
static int mime_image_write_buffer(char *buf, PRInt32 size, void *image_closure);
|
||||
|
||||
#ifdef MOZILLA_30
|
||||
extern PRBool MSG_VariableWidthPlaintext;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
int PR_CALLBACK
|
||||
mime_PrefsChangeCallback(const char* prefname, void* data)
|
||||
{
|
||||
MIME_PrefDataValid = 1; /* Invalidates our cached stuff. */
|
||||
return PREF_NOERROR;
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
|
||||
NET_StreamClass *
|
||||
MIME_MessageConverter2 (int format_out, void *closure,
|
||||
|
@ -1077,9 +1046,7 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
return 0;
|
||||
}
|
||||
memset(msd->options, 0, sizeof(*msd->options));
|
||||
#ifndef MOZILLA_30
|
||||
msd->options->pane = url->msg_pane;
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
/* handle the case where extracting attachments from nested messages */
|
||||
#ifdef RICHIE
|
||||
|
@ -1119,11 +1086,9 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
format_out == FO_CACHE_AND_SAVE_AS_POSTSCRIPT)
|
||||
msd->options->fancy_headers_p = PR_TRUE;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (format_out == FO_NGLAYOUT ||
|
||||
format_out == FO_CACHE_AND_NGLAYOUT)
|
||||
msd->options->output_vcard_buttons_p = PR_TRUE;
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
if (format_out == FO_NGLAYOUT ||
|
||||
format_out == FO_CACHE_AND_NGLAYOUT) {
|
||||
|
@ -1132,7 +1097,6 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
|
||||
msd->options->headers = MimeHeadersSome;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
if (MIME_PrefDataValid < 2) {
|
||||
PRInt32 headertype;
|
||||
if (MIME_PrefDataValid == 0) {
|
||||
|
@ -1166,40 +1130,18 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
msd->options->no_inline_p = MIME_NoInlineAttachments;
|
||||
msd->options->wrap_long_lines_p = MIME_WrapLongLines;
|
||||
msd->options->headers = MIME_HeaderType;
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
if (context->type == MWContextMail ||
|
||||
context->type == MWContextNews
|
||||
#ifndef MOZILLA_30
|
||||
|| context->type == MWContextMailMsg
|
||||
|| context->type == MWContextNewsMsg
|
||||
#endif /* !MOZILLA_30 */
|
||||
)
|
||||
{
|
||||
#ifndef MOZILLA_30
|
||||
MSG_Pane* pane = MSG_FindPane(context, MSG_MESSAGEPANE);
|
||||
msd->options->rot13_p = PR_FALSE;
|
||||
if (pane) {
|
||||
msd->options->rot13_p = MSG_ShouldRot13Message(pane);
|
||||
}
|
||||
#else /* MOZILLA_30 */
|
||||
|
||||
PRBool all_headers_p = PR_FALSE;
|
||||
PRBool micro_headers_p = PR_FALSE;
|
||||
MSG_GetContextPrefs(context,
|
||||
&all_headers_p,
|
||||
µ_headers_p,
|
||||
&msd->options->no_inline_p,
|
||||
&msd->options->rot13_p,
|
||||
&msd->options->wrap_long_lines_p);
|
||||
if (all_headers_p)
|
||||
msd->options->headers = MimeHeadersAll;
|
||||
else if (micro_headers_p)
|
||||
msd->options->headers = MimeHeadersMicro;
|
||||
else
|
||||
msd->options->headers = MimeHeadersSome;
|
||||
|
||||
#endif /* MOZILLA_30 */
|
||||
}
|
||||
|
||||
status = mime_parse_url_options(url->address, msd->options);
|
||||
|
@ -1212,29 +1154,21 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
}
|
||||
|
||||
if (msd->options->headers == MimeHeadersMicro &&
|
||||
#ifndef MOZILLA_30
|
||||
(url->address == NULL || (PL_strncmp(url->address, "news:", 5) != 0 &&
|
||||
PL_strncmp(url->address, "snews:", 6) != 0))
|
||||
#else /* MOZILLA_30 */
|
||||
context->type == MWContextMail
|
||||
#endif /* MOZILLA_30 */
|
||||
)
|
||||
msd->options->headers = MimeHeadersMicroPlus;
|
||||
|
||||
if (format_out == FO_QUOTE_MESSAGE ||
|
||||
format_out == FO_CACHE_AND_QUOTE_MESSAGE
|
||||
#ifndef MOZILLA_30
|
||||
|| format_out == FO_QUOTE_HTML_MESSAGE
|
||||
#endif /* !MOZILLA_30 */
|
||||
)
|
||||
{
|
||||
msd->options->headers = MimeHeadersCitation;
|
||||
msd->options->fancy_headers_p = PR_FALSE;
|
||||
#ifndef MOZILLA_30
|
||||
if (format_out == FO_QUOTE_HTML_MESSAGE) {
|
||||
msd->options->nice_html_only_p = PR_TRUE;
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
}
|
||||
|
||||
else if (msd->options->headers == MimeHeadersSome &&
|
||||
|
@ -1261,7 +1195,7 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
msd->options->write_html_p = PR_TRUE;
|
||||
msd->options->output_init_fn = mime_output_init_fn;
|
||||
|
||||
#if !defined(MOZILLA_30) && defined(XP_MAC)
|
||||
#ifdef XP_MAC
|
||||
/* If it's a thread context, don't output all the mime stuff (hangs on Macintosh for
|
||||
** unexpanded threadpane, because HTML is generated that needs images and layers).
|
||||
*/
|
||||
|
@ -1272,12 +1206,10 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
msd->options->output_fn = mime_output_fn;
|
||||
|
||||
msd->options->set_html_state_fn = mime_set_html_state_fn;
|
||||
#ifndef MOZILLA_30
|
||||
if (format_out == FO_QUOTE_HTML_MESSAGE) {
|
||||
msd->options->charset_conversion_fn = mime_insert_html_convert_charset;
|
||||
msd->options->dont_touch_citations_p = PR_TRUE;
|
||||
} else
|
||||
#endif
|
||||
msd->options->charset_conversion_fn = mime_convert_charset;
|
||||
msd->options->rfc1522_conversion_fn = mime_convert_rfc1522;
|
||||
msd->options->reformat_date_fn = mime_reformat_date;
|
||||
|
@ -1293,11 +1225,7 @@ MIME_MessageConverter2 (int format_out, void *closure,
|
|||
msd->options->make_image_html = mime_image_make_image_html;
|
||||
msd->options->image_write_buffer = mime_image_write_buffer;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
msd->options->variable_width_plaintext_p = MIME_VariableWidthPlaintext;
|
||||
#else /* MOZILLA_30 */
|
||||
msd->options->variable_width_plaintext_p = MSG_VariableWidthPlaintext;
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
/* ### mwelch We want FO_EDT_SAVE_IMAGE to behave like *_SAVE_AS here
|
||||
because we're spooling untranslated raw data. */
|
||||
|
@ -1400,13 +1328,11 @@ mime_image_begin(const char *image_url, const char *content_type,
|
|||
msd->format_out != FO_SAVE_AS_POSTSCRIPT &&
|
||||
msd->format_out != FO_CACHE_AND_SAVE_AS_POSTSCRIPT)
|
||||
return mid;
|
||||
#ifndef MOZILLA_30
|
||||
if (!msd->context->img_cx)
|
||||
/* If there is no image context, e.g. if this is a Text context or a
|
||||
Mail context on the Mac, then we won't be loading images in the
|
||||
image viewer. */
|
||||
return mid;
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
mid->url_struct = NET_CreateURLStruct (image_url, NET_DONT_RELOAD);
|
||||
if (!mid->url_struct)
|
||||
|
@ -1988,13 +1914,11 @@ MimeGetAttachmentList(MWContext* context, MSG_AttachmentData** data)
|
|||
tmp->description = MimeHeaders_get(child->headers,
|
||||
HEADER_CONTENT_DESCRIPTION,
|
||||
PR_FALSE, PR_FALSE);
|
||||
#ifndef MOZILLA_30
|
||||
if (tmp->real_type && !PL_strcasecmp(tmp->real_type, MESSAGE_RFC822) &&
|
||||
(!tmp->real_name || *tmp->real_name == 0))
|
||||
{
|
||||
StrAllocCopy(tmp->real_name, XP_GetString(XP_FORWARDED_MESSAGE_ATTACHMENT));
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2245,9 +2169,10 @@ MIME_EnrichedTextConverter (int format_out, void *closure,
|
|||
return MIME_RichtextConverter_1 (format_out, closure, url, context, PR_TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
extern int MIME_HasAttachments(MWContext *context)
|
||||
{
|
||||
return (context->mime_data && context->mime_data->last_parsed_object->showAttachmentIcon);
|
||||
}
|
||||
|
||||
int
|
||||
MIME_DisplayAttachmentPane(MWContext* context)
|
||||
|
@ -2361,16 +2286,6 @@ mime_vcard_abort (void *stream, int status )
|
|||
PR_Free (vcd);
|
||||
}
|
||||
|
||||
#endif /* RICHIE_VCARD */
|
||||
|
||||
extern int MIME_HasAttachments(MWContext *context)
|
||||
{
|
||||
return (context->mime_data && context->mime_data->last_parsed_object->showAttachmentIcon);
|
||||
}
|
||||
|
||||
|
||||
#ifdef RICHIE_VCARD
|
||||
|
||||
extern NET_StreamClass *
|
||||
MIME_VCardConverter2 ( int format_out,
|
||||
void *closure,
|
||||
|
@ -2480,7 +2395,4 @@ MIME_VCardConverter2 ( int format_out,
|
|||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif /* RICHIE_VCARD */
|
||||
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
|
|
@ -21,12 +21,10 @@
|
|||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
/* Way to destroy any notions of modularity or class hierarchy, Terry! */
|
||||
# include "mimetpla.h"
|
||||
# include "mimethtm.h"
|
||||
# include "mimecont.h"
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
MimeDefClass (MimeObject, MimeObjectClass, mimeObjectClass, NULL);
|
||||
|
||||
|
@ -186,7 +184,6 @@ MimeObject_parse_begin (MimeObject *obj)
|
|||
PR_Free(id);
|
||||
}
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
/* Way to destroy any notions of modularity or class hierarchy, Terry! */
|
||||
if (obj->options && obj->options->nice_html_only_p) {
|
||||
if (!mime_subclass_p(obj->class,
|
||||
|
@ -198,7 +195,6 @@ MimeObject_parse_begin (MimeObject *obj)
|
|||
obj->output_p = PR_FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -125,9 +125,7 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
*/
|
||||
*obj->obuffer = 0;
|
||||
status = NET_ScanForURLs (
|
||||
#ifndef MOZILLA_30
|
||||
(obj->options ? obj->options->pane : 0),
|
||||
#endif /* !MOZILLA_30 */
|
||||
line, length, obj->obuffer, obj->obuffer_size - 10,
|
||||
(obj->options ?
|
||||
obj->options->dont_touch_citations_p : PR_FALSE));
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
#include "xp.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
# define MIME_DRAFTS
|
||||
#endif
|
||||
#define MIME_DRAFTS
|
||||
|
||||
/* Opaque object describing a block of message headers, and a couple of
|
||||
routines for extracting data from one.
|
||||
|
@ -64,9 +62,7 @@ typedef struct MimeHeaders
|
|||
|
||||
typedef struct MimeDisplayOptions MimeDisplayOptions;
|
||||
typedef struct MimeParseStateObject MimeParseStateObject;
|
||||
#ifndef MOZILLA_30
|
||||
typedef struct MSG_AttachmentData MSG_AttachmentData;
|
||||
#endif
|
||||
|
||||
#ifdef RICHIE
|
||||
XP_BEGIN_PROTOS
|
||||
|
@ -198,20 +194,16 @@ struct MimeDisplayOptions
|
|||
completes (possibly at the same time as the
|
||||
MimeDisplayOptions itself.) */
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
MSG_Pane* pane; /* The libmsg pane object that corresponds to
|
||||
what we're showing. This is used by very
|
||||
little... */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
MimeHeadersState headers; /* How headers should be displayed. */
|
||||
PRBool fancy_headers_p; /* Whether to do clever formatting of headers
|
||||
using tables, instead of spaces. */
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
PRBool output_vcard_buttons_p; /* Whether to output the buttons */
|
||||
/* on vcards. */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
PRBool fancy_links_p; /* Whether to insert fancy links, so you can
|
||||
do things like click on an email address to
|
||||
|
@ -241,7 +233,6 @@ struct MimeDisplayOptions
|
|||
dexlate it before sending it.
|
||||
*/
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
PRBool nice_html_only_p; /* If PR_TRUE, then we only should write html if
|
||||
it's pretty HTML (stuff that we're willing
|
||||
to get shipped out in mail messages). If we
|
||||
|
@ -252,7 +243,6 @@ struct MimeDisplayOptions
|
|||
alone in plaintext parts. If PR_FALSE, then
|
||||
go ahead and tweak the fonts according
|
||||
to preferences. */
|
||||
#endif /* !MOZILLA_30 */
|
||||
|
||||
char *default_charset; /* If this is non-NULL, then it is the charset to
|
||||
assume when no other one is specified via a
|
||||
|
|
|
@ -221,7 +221,6 @@ NET_I_XP_FileWrite(const char *buf, int bufLen, XP_File fp) {
|
|||
return (int) wroteBytes;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int
|
||||
NET_I_XP_FileClose(XP_File fp) {
|
||||
nsFile *nsFp = XpToNsFp(fp); // nsnull ok.
|
||||
|
|
|
@ -91,18 +91,14 @@ static int MSG_CitationFont = MSG_ItalicFont;
|
|||
static int MSG_CitationSize = MSG_NormalSize;
|
||||
static const char *MSG_CitationColor = 0;
|
||||
|
||||
#ifndef MOZILLA_30
|
||||
# define MSG_Prefs void
|
||||
# define MSG_GetCitationStyle(w,x,y,z) do{}while(0)
|
||||
# define MSG_GetPrefs(x) 0
|
||||
#endif
|
||||
|
||||
/* from libnet/mkutils.c */
|
||||
PUBLIC int
|
||||
NET_ScanForURLs(
|
||||
#ifndef MOZILLA_30
|
||||
MSG_Pane* pane,
|
||||
#endif /* !MOZILLA_30 */
|
||||
const char *input, PRInt32 input_size,
|
||||
char *output, int output_size, XP_Bool urls_only)
|
||||
{
|
||||
|
@ -114,11 +110,7 @@ NET_ScanForURLs(
|
|||
Bool line_is_citation = PR_FALSE;
|
||||
const char *cite_open1, *cite_close1;
|
||||
const char *cite_open2, *cite_close2;
|
||||
#ifndef MOZILLA_30
|
||||
const char* color = NULL;
|
||||
#else /* MOZILLA_30 */
|
||||
const char* color = MSG_CitationColor;
|
||||
#endif /* MOZILLA_30 */
|
||||
|
||||
if (urls_only)
|
||||
{
|
||||
|
@ -128,10 +120,6 @@ NET_ScanForURLs(
|
|||
else
|
||||
{
|
||||
#ifdef MOZILLA_CLIENT
|
||||
# ifdef MOZILLA_30
|
||||
MSG_FONT font = MSG_CitationFont;
|
||||
MSG_CITATION_SIZE size = MSG_CitationSize;
|
||||
# else /* !MOZILLA_30 */
|
||||
MSG_Prefs* prefs;
|
||||
MSG_FONT font = MSG_ItalicFont;
|
||||
MSG_CITATION_SIZE size = MSG_NormalSize;
|
||||
|
@ -140,7 +128,6 @@ NET_ScanForURLs(
|
|||
prefs = MSG_GetPrefs(pane);
|
||||
MSG_GetCitationStyle(prefs, &font, &size, &color);
|
||||
}
|
||||
#endif /* !MOZILLA_30 */
|
||||
switch (font)
|
||||
{
|
||||
case MSG_PlainFont:
|
||||
|
|
Загрузка…
Ссылка в новой задаче