зеркало из https://github.com/mozilla/gecko-dev.git
Fix for walking nested attached messages to display attachments - Bug #: 23643 - r: bienvenu
This commit is contained in:
Родитель
fdd95dbe9d
Коммит
659bddd87f
|
@ -273,8 +273,6 @@ test(FILE *in, FILE *out,
|
|||
opt->rfc1522_conversion_fn= 0;
|
||||
opt->reformat_date_fn = 0;
|
||||
opt->file_type_fn = test_file_type;
|
||||
opt->type_description_fn = 0;
|
||||
opt->type_icon_name_fn = test_type_icon;
|
||||
opt->stream_closure = out;
|
||||
|
||||
opt->image_begin = test_image_begin;
|
||||
|
|
|
@ -635,6 +635,7 @@ mime_create (const char *content_type, MimeHeaders *hdrs,
|
|||
(clazz != (MimeObjectClass *)&mimeInlineTextHTMLClass) &&
|
||||
(clazz != (MimeObjectClass *)&mimeInlineTextRichtextClass) &&
|
||||
(clazz != (MimeObjectClass *)&mimeInlineTextEnrichedClass) &&
|
||||
(clazz != (MimeObjectClass *)&mimeMessageClass) &&
|
||||
(clazz != (MimeObjectClass *)&mimeInlineImageClass) )
|
||||
clazz = (MimeObjectClass *)&mimeExternalObjectClass;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mimemrel.h"
|
||||
#include "mimemalt.h"
|
||||
#include "mimebuf.h"
|
||||
#include "mimemapl.h"
|
||||
#include "edt.h"
|
||||
#include "mimerosetta.h"
|
||||
#include "proto.h"
|
||||
|
@ -226,7 +227,7 @@ ValidateRealName(nsMsgAttachmentData *aAttach)
|
|||
//
|
||||
if (!aAttach->real_name || *aAttach->real_name == 0)
|
||||
{
|
||||
nsString newAttachName = "attach";
|
||||
nsString newAttachName = "attachment";
|
||||
nsresult rv = NS_OK;
|
||||
NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mimeFinder)
|
||||
|
@ -279,6 +280,11 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData,
|
|||
if ( NS_FAILED(BuildAttachmentList((MimeObject *)child, aAttachData, aMessageURL)) )
|
||||
return NS_OK;
|
||||
|
||||
// If this is a child of an AppleDouble handler, these are subparts of a single file (ugh!)
|
||||
// So don't add them to the attachment list!
|
||||
if ( (child->parent) && (mime_typep(child->parent, (MimeObjectClass *) &mimeMultipartAppleDoubleClass)) )
|
||||
continue;
|
||||
|
||||
if (!part)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -509,52 +515,20 @@ mime_reformat_date(const char *date, void *stream_closure)
|
|||
static char *
|
||||
mime_file_type (const char *filename, void *stream_closure)
|
||||
{
|
||||
#if 0
|
||||
NET_cinfo *cinfo = NET_cinfo_find_type ((char *) filename);
|
||||
if (!cinfo || !cinfo->type)
|
||||
return 0;
|
||||
else
|
||||
return nsCRT::strdup(cinfo->type);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
char *retType = nsnull;
|
||||
char *ext = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
static char *
|
||||
mime_type_desc(const char *type, void *stream_closure)
|
||||
{
|
||||
#if 0
|
||||
NET_cinfo *cinfo = NET_cinfo_find_info_by_type((char *) type);
|
||||
if (!cinfo || !cinfo->desc || !*cinfo->desc)
|
||||
return 0;
|
||||
else
|
||||
return nsCRT::strdup(cinfo->desc);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
ext = PL_strrchr(filename, '.');
|
||||
if (ext)
|
||||
{
|
||||
ext++;
|
||||
NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mimeFinder)
|
||||
mimeFinder->GetTypeFromExtension(ext, &retType);
|
||||
}
|
||||
|
||||
// RICHIE - need to replace this with the new service from Judson!
|
||||
static char *
|
||||
mime_type_icon(const char *type, void *stream_closure)
|
||||
{
|
||||
#if 0
|
||||
NET_cinfo *cinfo = NET_cinfo_find_info_by_type((char *) type);
|
||||
if (cinfo && cinfo->icon && *cinfo->icon)
|
||||
return nsCRT::strdup(cinfo->icon);
|
||||
#endif
|
||||
if (!nsCRT::strncasecmp(type, "text/", 5))
|
||||
return nsCRT::strdup("resource:/res/network/gopher-text.gif");
|
||||
else if (!nsCRT::strncasecmp(type, "image/", 6))
|
||||
return nsCRT::strdup("resource:/res/network/gopher-image.gif");
|
||||
else if (!nsCRT::strncasecmp(type, "audio/", 6))
|
||||
return nsCRT::strdup("resource:/res/network/gopher-sound.gif");
|
||||
else if (!nsCRT::strncasecmp(type, "video/", 6))
|
||||
return nsCRT::strdup("resource:/res/network/gopher-movie.gif");
|
||||
else if (!nsCRT::strncasecmp(type, "application/", 12))
|
||||
return nsCRT::strdup("resource:/res/network/gopher-binary.gif");
|
||||
else
|
||||
return nsCRT::strdup("internal-gopher-unknown.gif");
|
||||
return retType;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1298,8 +1272,6 @@ mime_bridge_create_display_stream(
|
|||
msd->options->rfc1522_conversion_fn = mime_convert_rfc1522;
|
||||
msd->options->reformat_date_fn = mime_reformat_date;
|
||||
msd->options->file_type_fn = mime_file_type;
|
||||
msd->options->type_description_fn = mime_type_desc;
|
||||
msd->options->type_icon_name_fn = mime_type_icon;
|
||||
msd->options->stream_closure = msd;
|
||||
msd->options->passwd_prompt_fn = 0;
|
||||
|
||||
|
|
|
@ -289,12 +289,6 @@ struct MimeDisplayOptions
|
|||
/* A hook for the caller to turn a file name into a content-type. */
|
||||
char *(*file_type_fn) (const char *filename, void *stream_closure);
|
||||
|
||||
/* A hook for the caller to turn a content-type into descriptive text. */
|
||||
char *(*type_description_fn) (const char *content_type,void *stream_closure);
|
||||
|
||||
/* A hook for the caller to turn a content-type into an image icon. */
|
||||
char *(*type_icon_name_fn) (const char *content_type, void *stream_closure);
|
||||
|
||||
/* A hook by which the user may be prompted for a password by the security
|
||||
library. (This is really of type `SECKEYGetPasswordKey'; see sec.h.) */
|
||||
void *(*passwd_prompt_fn)(void *arg1, void *arg2);
|
||||
|
|
|
@ -244,8 +244,8 @@ ConsoleOutputStreamListener::DoIndent()
|
|||
if (mIndentCount <= 1)
|
||||
return NS_OK;
|
||||
|
||||
for (PRUint32 j=0; j<(PRUint32) ((mIndentCount-1)*TAB_SPACES); j++)
|
||||
PR_Write(PR_GetSpecialFD(PR_StandardOutput), " ", 1);
|
||||
//for (PRUint32 j=0; j<(PRUint32) ((mIndentCount-1)*TAB_SPACES); j++)
|
||||
// PR_Write(PR_GetSpecialFD(PR_StandardOutput), " ", 1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -408,6 +408,9 @@ FixURL(char *url)
|
|||
if (*ptr == '\\')
|
||||
*ptr = '/';
|
||||
|
||||
if (*ptr == ':')
|
||||
*ptr = '|';
|
||||
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
|
@ -563,7 +566,7 @@ DoRFC822toHTMLConversion(char *filename, int numArgs)
|
|||
|
||||
// Create an nsIURI object needed for stream IO...
|
||||
PR_snprintf(newURL, sizeof(newURL), "file:///%s", filename);
|
||||
FixURL(newURL);
|
||||
FixURL(newURL + 5);
|
||||
if (NS_FAILED(NewURI(&theURI, newURL)))
|
||||
{
|
||||
printf("Unable to open input file\n");
|
||||
|
|
Загрузка…
Ссылка в новой задаче