Mailto MOZ_ENDER_MIME will not be turned on yet

This commit is contained in:
mjudge%netscape.com 1998-10-09 02:48:53 +00:00
Родитель 5e392356cc
Коммит 253de14d2e
7 изменённых файлов: 265 добавлений и 117 удалений

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

@ -28,66 +28,21 @@ LIB = .\$(OBJDIR)\$(LIBRARY_NAME).lib
LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib
!endif
REQUIRES=security nspr htmldlgs img util layer pref security js java net progress network
OBJS = \
.\$(OBJDIR)\addrutil.obj \
.\$(OBJDIR)\ad_strm.obj \
.\$(OBJDIR)\ap_decod.obj \
.\$(OBJDIR)\ap_encod.obj \
.\$(OBJDIR)\appledbl.obj \
.\$(OBJDIR)\bh_strm.obj \
.\$(OBJDIR)\m_binhex.obj \
.\$(OBJDIR)\msgutils.obj \
.\$(OBJDIR)\bytearr.obj \
.\$(OBJDIR)\dwordarr.obj \
.\$(OBJDIR)\mhtmlstm.obj \
.\$(OBJDIR)\msgbg.obj \
.\$(OBJDIR)\msgcflds.obj \
.\$(OBJDIR)\msgcpane.obj \
.\$(OBJDIR)\msgglue.obj \
.\$(OBJDIR)\msgmast.obj \
.\$(OBJDIR)\msgmdn.obj \
.\$(OBJDIR)\msgpane.obj \
.\$(OBJDIR)\msgppane.obj \
.\$(OBJDIR)\msgprefs.obj \
.\$(OBJDIR)\msgsend.obj \
.\$(OBJDIR)\msgsendp.obj \
.\$(OBJDIR)\msgurlq.obj \
.\$(OBJDIR)\msgzap.obj \
.\$(OBJDIR)\ptrarray.obj \
.\$(OBJDIR)\mprmime.obj \
.\$(OBJDIR)\mhtmlstm.obj \
.\$(OBJDIR)\msgsendp.obj \
$(NULL)
# We'd like to include msgdlqml.cpp eventually (deliver queued mail)
EXPORTS = \
ad_codes.h \
appledbl.h \
bytearr.h \
dwordarr.h \
errcode.h \
error.h \
m_binhex.h \
mhtmlstm.h \
msg.h \
msgcflds.h \
msgcpane.h \
msghdr.h \
msgmast.h \
msgmdn.h \
msgpane.h \
msgppane.h \
msgprefs.h \
msgprnot.h \
msgsend.h \
msgsendp.h \
msgutils.h \
msgzap.h \
ptrarray.h \
mprmime.h \
$(NULL)
MODULE=mailto
@ -101,6 +56,10 @@ LINCS=-I$(XPDIST)\public\security -I$(XPDIST)\public\nspr \
-I$(XPDIST)\public\net -I$(XPDIST)\public\progress \
-I$(XPDIST)\public\util -I$(XPDIST)\public\network
!ifdef MOZ_ENDER_MIME
LCFLAGS=$(LCFLAGS) -DMOZ_ENDER_MIME
!endif
include <$(DEPTH)\config\rules.mak>
libs:: $(LIB)

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

@ -36,6 +36,17 @@
#include "mimeenc.h"
#include "libi18n.h"
#ifdef MOZ_ENDER_MIME
#include "secrng.h" /* for RNG_GenerateGlobalRandomBytes() */
extern "C" {
#include "xp_file.h"
}
#include "mprmime.h"
#endif /*MOZ_ENDER_MIME*/
extern "C" {
extern int MK_UNABLE_TO_OPEN_FILE;
}
@ -241,7 +252,7 @@ MSG_MimeRelatedSubpart::MSG_MimeRelatedSubpart(MSG_MimeRelatedSaver *parent,
char *pMime, int16 part_csid, char *pFilename)
: MSG_SendPart(NULL, part_csid), m_pOriginalURL(NULL),
m_pLocalURL(NULL), m_pParentFS(parent),
m_pContentID(NULL), m_pContentName(NULL), m_rootPart(FALSE)
m_pContentID(NULL), m_pContentName(NULL), m_rootPart(FALSE) , m_pStreamOut(NULL), m_pEncoding(NULL)
{
m_filetype = xpFileToPost;
@ -269,7 +280,11 @@ MSG_MimeRelatedSubpart::MSG_MimeRelatedSubpart(MSG_MimeRelatedSaver *parent,
else
{
// Generate a temp name for a file to which to write.
char *tmp = WH_TempName(xpFileToPost, "nsmail");
#ifdef MOZ_ENDER_MIME
char *tmp = WH_TempName(xpFileToPost, "nswebm");
#else
char *tmp = WH_TempName(xpFileToPost, "nsmail");
#endif
if (tmp)
{
CopyString(&m_filename, tmp);
@ -320,8 +335,10 @@ MSG_MimeRelatedSubpart::WriteEncodedMessageBody(const char *buf, int32 size,
int returnVal = 0;
XP_ASSERT(subpart->m_state != NULL);
if (subpart->m_state)
#ifndef MOZ_ENDER_MIME
if (subpart->m_state)
returnVal = mime_write_message_body(subpart->m_state, (char *) buf, size);
#endif
return returnVal;
}
@ -415,7 +432,8 @@ MSG_MimeRelatedSubpart::Write(void)
// that isn't text.
if (m_type && (!m_rootPart))
{
// Uuencode only if we have to, otherwise use base64
#ifndef MOZ_ENDER_MIME
// Uuencode only if we have to, otherwise use base64
if (m_pParentFS->m_pPane->
GetCompBoolHeader(MSG_UUENCODE_BINARY_BOOL_HEADER_MASK))
{
@ -437,6 +455,7 @@ MSG_MimeRelatedSubpart::Write(void)
WriteEncodedMessageBody,
this));
}
#endif /*MOZ_ENDER_MAIL*/
}
// Horrible hack: if we got a local filename then we're the root lump,
@ -495,6 +514,7 @@ MSG_MimeRelatedParentPart::~MSG_MimeRelatedParentPart(void)
{
}
#ifdef MOZ_ENDER_MIME
/*
----------------------------------------------------------------------
MSG_MimeRelatedStreamSaver
@ -513,11 +533,31 @@ MSG_MimeRelatedStreamSaver::MSG_MimeRelatedStreamSaver(MSG_CompositionPane *pane
DeliveryDoneCallback cb,
char **ppOriginalRootURL)
: MSG_MimeRelatedSaver(pane,context,fields,digest_p,deliver_mode,
body,body_length,attachedFiles,cb,ppOriginalRootURL)
body,body_length,attachedFiles,cb,ppOriginalRootURL),m_pFilename(NULL)
{
}
MSG_MimeRelatedStreamSaver::~MSG_MimeRelatedStreamSaver()
{
XP_FREEIF(m_pFilename);
}
extern "C" char *mime_make_separator(const char *prefix);
extern "C" int mimer_output_func(const char *p_buffer,int32 p_size,void *closure)
{
XP_File t_file;
t_file = (XP_File)closure;
return XP_FileWrite(p_buffer,p_size,t_file);
}
void
MSG_MimeRelatedStreamSaver::Complete( Bool bSuccess, EDT_ITapeFileSystemComplete *pfComplete, void *pArg )
{
@ -526,43 +566,61 @@ MSG_MimeRelatedStreamSaver::Complete( Bool bSuccess, EDT_ITapeFileSystemComplete
// Call StartMessageDelivery (and should) if we
// were told to at creation time.
if (bSuccess)
if (bSuccess && m_pPart)
{
// If we only generated a single HTML part, treat that as
// the root part.
if (m_pPart->GetNumChildren() == 1)
{
MSG_SendPart *tempPart = m_pPart->DetachChild(0);
delete m_pPart;
m_pPart = tempPart;
}
//make new message!
XP_File t_file;
m_pFilename = WH_TempName (xpFileToPost, "nswebm");
if (m_pFilename)
{
t_file = XP_FileOpen(m_pFilename,xpTemporary,XP_FILE_WRITE);
GenericMimeRelatedData *t_data = GenericMime_Init(mime_make_separator(""),mimer_output_func,t_file);
for (int32 i=0;i< m_pPart->GetNumChildren();i++)
{
MSG_MimeRelatedSubpart *t_part;
t_part = (MSG_MimeRelatedSubpart *)m_pPart->GetChild(i);
if (t_part->GetType() && !XP_STRCMP(t_part->GetType(),"text/html"))
{
GenericMime_AddTextFile(t_data,XP_STRDUP(t_part->GetFilename()),t_part->GetCSID());
}
else /*base64*/
{
AttachmentFields *t_fields = AttachmentFields_Init(XP_STRDUP(t_part->GetFilename()),XP_STRDUP(t_part->m_pOriginalURL),
XP_STRDUP(t_part->GetType()),XP_STRDUP(t_part->m_pContentID));
if (t_fields)
GenericMime_AddBase64File(t_data,t_fields);
}
}
GenericMime_Begin(t_data);
GenericMime_Destroy(t_data);
XP_FileClose(t_file);
// Call our UrlExit routine to perform cleanup.
MSG_MimeRelatedSaver::UrlExit(m_pContext, this, 0, NULL);
#if 0
msg_StartMessageDeliveryWithAttachments(m_pPane, this,
m_pFields,
m_digest, FALSE,
m_deliverMode,
TEXT_HTML,
m_pBody, m_bodyLength,
m_pAttachedFiles,
m_pPart,
#ifdef XP_OS2
(void (_Optlink*) (MWContext*,void*,int,const char*))
#endif
MSG_MimeRelatedSaver::UrlExit);
#endif
for (i=0;i< m_pPart->GetNumChildren();i++)
{
MSG_MimeRelatedSubpart *t_part;
t_part = (MSG_MimeRelatedSubpart *)m_pPart->GetChild(i);
if (t_part->GetType() && XP_STRCMP(t_part->GetType(),"text/html")) /*not text*/
{
XP_FileRemove(t_part->GetFilename(), xpFileToPost);
}
}
}
// Call our UrlExit routine to perform cleanup.
MSG_MimeRelatedSaver::UrlExit(m_pContext, this, 0, NULL);
}
else
{
// delete the contained part since we failed
delete m_pPart;
m_pPart = NULL;
// Call our UrlExit routine to perform cleanup.
MSG_MimeRelatedSaver::UrlExit(m_pContext, this, MK_INTERRUPTED, NULL);
}
// Call our UrlExit routine to perform cleanup.
MSG_MimeRelatedSaver::UrlExit(m_pContext, this, MK_INTERRUPTED, NULL);
}
}
#endif //MOZ_ENDER_MIME
/*
----------------------------------------------------------------------
MSG_MimeRelatedSaver
@ -570,7 +628,42 @@ MSG_MimeRelatedSaver
*/
extern char * msg_generate_message_id(void);
#ifdef MOZ_ENDER_MIME
char *
msg_generate_message_id (void)
{
time_t now = XP_TIME();
uint32 salt = 0;
const char *host = 0;
const char *from = FE_UsersMailAddress ();
RNG_GenerateGlobalRandomBytes((void *) &salt, sizeof(salt));
if (from)
{
host = XP_STRCHR (from, '@');
if (host)
{
const char *s;
for (s = ++host; *s; s++)
if (!XP_IS_ALPHA(*s) && !XP_IS_DIGIT(*s) &&
*s != '-' && *s != '_' && *s != '.')
{
host = 0;
break;
}
}
}
if (! host)
/* If we couldn't find a valid host name to use, we can't generate a
valid message ID, so bail, and let NNTP and SMTP generate them. */
return 0;
return PR_smprintf("<%lX.%lX@%s>",
(unsigned long) now, (unsigned long) salt, host);
}
#endif //MOZ_ENDER_MIME
// Constructor
MSG_MimeRelatedSaver::MSG_MimeRelatedSaver(MSG_CompositionPane *pane,
MWContext *context,
@ -588,7 +681,7 @@ MSG_MimeRelatedSaver::MSG_MimeRelatedSaver(MSG_CompositionPane *pane,
m_pAttachedFiles(attachedFiles), m_cbDeliveryDone(cb), m_pSourceBaseURL(NULL)
{
// Generate the message ID.
// Generate the message ID.
m_pMessageID = msg_generate_message_id();
if (m_pMessageID)
{
@ -603,7 +696,6 @@ MSG_MimeRelatedSaver::MSG_MimeRelatedSaver(MSG_CompositionPane *pane,
}
}
XP_ASSERT(m_pMessageID);
// Create the part object that we represent.
m_pPart = new MSG_MimeRelatedParentPart(INTL_DefaultWinCharSetID(context));
XP_ASSERT(m_pPart);
@ -621,7 +713,11 @@ MSG_MimeRelatedSaver::MSG_MimeRelatedSaver(MSG_CompositionPane *pane,
// back an improvised source URL if we were not given one.
//
// Autogenerate the title and pass it back.
#ifdef MOZ_ENDER_MIME
m_rootFilename = WH_TempName(xpFileToPost,"nswebm");
#else
m_rootFilename = WH_TempName(xpFileToPost,"nsmail");
#endif
XP_ASSERT(m_rootFilename);
char * temp = WH_FileName(m_rootFilename, xpFileToPost);
*ppOriginalRootURL = XP_PlatformFileToURL(temp);
@ -866,6 +962,7 @@ void
MSG_MimeRelatedSaver::Complete(Bool bSuccess,
EDT_ITapeFileSystemComplete *pfComplete, void *pArg )
{
#ifndef MOZ_ENDER_MIME
m_pEditorCompletionFunc = pfComplete;
m_pEditorCompletionArg = pArg;
@ -904,6 +1001,7 @@ MSG_MimeRelatedSaver::Complete(Bool bSuccess,
// Call our UrlExit routine to perform cleanup.
UrlExit(m_pPane->GetContext(), this, MK_INTERRUPTED, NULL);
}
#endif //#ifndef MOZ_ENDER_MIME
}
void

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

@ -223,6 +223,7 @@ public:
//#endif
#ifdef MOZ_ENDER_MIME
//used to stop lame mimerelated saver from sending a message!
class MSG_MimeRelatedStreamSaver : public MSG_MimeRelatedSaver
{
@ -234,12 +235,16 @@ public:
MSG_AttachedFile *attachedFiles,
DeliveryDoneCallback cb,
char **ppOriginalRootURL);
virtual ~MSG_MimeRelatedStreamSaver(){}
virtual ~MSG_MimeRelatedStreamSaver();
//
// Called on completion, TRUE if completed successfully, FALSE if it failed.
// we dont want the message to be sent, so we stop mimerelated saver from completing
//
virtual void Complete( Bool bSuccess, EDT_ITapeFileSystemComplete *pfComplete, void *pArg );
private:
char *m_pFilename;
};
#endif //MOZ_ENDER_MIME
#endif

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

@ -16,15 +16,19 @@
#define READ_BUFFER_LEN 255
/*
prototypes
XP_Bool output_text_file(GenericMimeRelatedData *p_genmime, int16 p_index);
XP_Bool output_base64_file(GenericMimeRelatedData *p_genmime, int16 p_index);
*/
XP_Bool output_text_file(GenericMimeRelatedData *p_genmime, int16 p_index);
XP_Bool output_text_body(GenericMimeRelatedData *p_genmime, int16 p_index);
XP_Bool output_base64_file(GenericMimeRelatedData *p_genmime, int16 p_index);
AttachmentFields *
AttachmentFields_Init(char *p_pFilename, char *p_pDispositionName, char *p_pContentType, char *p_pContentId)
AttachmentFields_Init(char *p_pFilename, char *p_pDispositionName,
char *p_pContentType, char *p_pContentId)
{
AttachmentFields *data = XP_NEW(AttachmentFields);
if (!data || !p_pFilename || !p_pContentType || !p_pContentId) return 0;
@ -97,7 +101,7 @@ genericmime_validate(GenericMimeRelatedData *p_genmime)
int i;/*counter*/
if (!p_genmime)
return FALSE;
if (!p_genmime->m_iNumTextFiles + p_genmime->m_iNumBase64Files)
if (!(p_genmime->m_iNumTextFiles + p_genmime->m_iNumBase64Files))
return FALSE; /*no files*/
for( i=0; i<p_genmime->m_iNumTextFiles; i++)
{
@ -139,13 +143,40 @@ GenericMime_Destroy(GenericMimeRelatedData *p_gendata)
static XP_Bool
output_text_file(GenericMimeRelatedData *p_genmime, int16 p_index)
output_text_body(GenericMimeRelatedData *p_genmime, int16 p_index)
{
char readbuffer[READ_BUFFER_LEN]; /*buffer to store incomming data*/
int16 numread; /*number of bytes read in each pass*/
char *charSet; /*used by text attachments when retrieving the charset str identifier*/
XP_File t_inputfile; /*file pointer for input file*/
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
if( (t_inputfile = XP_FileOpen(p_genmime->m_pTextFiles[p_index],xpFileToPost,XP_FILE_READ)) != NULL )
{
/* Attempt to read in READBUFLEN characters */
while (!feof( t_inputfile ))
{
numread = fread( readbuffer, sizeof( char ), READ_BUFFER_LEN, t_inputfile );
if (ferror(t_inputfile))
{
XP_ASSERT(FALSE);
break;
}
(*p_genmime->write_buffer)(readbuffer,numread,p_genmime->closure);
}
fclose( t_inputfile );
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
}
return TRUE;
}
static XP_Bool
output_text_file(GenericMimeRelatedData *p_genmime, int16 p_index)
{
char *charSet; /*used by text attachments when retrieving the charset str identifier*/
if (p_genmime->m_pBoundarySpecifier)
{
(*p_genmime->write_buffer)(p_genmime->m_pBoundarySpecifier,strlen(p_genmime->m_pBoundarySpecifier),p_genmime->closure);
@ -161,24 +192,7 @@ output_text_file(GenericMimeRelatedData *p_genmime, int16 p_index)
(*p_genmime->write_buffer)(BIT7_MIMEREL,strlen(BIT7_MIMEREL),p_genmime->closure);
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
if( (t_inputfile = fopen( p_genmime->m_pTextFiles[p_index], "r+t" )) != NULL )
{
/* Attempt to read in READBUFLEN characters */
while (!!feof( t_inputfile ))
{
numread = fread( readbuffer, sizeof( char ), READ_BUFFER_LEN, t_inputfile );
if (ferror(t_inputfile))
{
XP_ASSERT(FALSE);
break;
}
(*p_genmime->write_buffer)(readbuffer,numread,p_genmime->closure);
}
fclose( t_inputfile );
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
}
return TRUE;
return output_text_body(p_genmime,p_index);
}
@ -209,7 +223,9 @@ output_base64_file(GenericMimeRelatedData *p_genmime, int16 p_index)
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
(*p_genmime->write_buffer)(CONTENT_ID_MIMEREL,strlen(CONTENT_ID_MIMEREL),p_genmime->closure);
(*p_genmime->write_buffer)("<",1,p_genmime->closure);
(*p_genmime->write_buffer)(t_tempattach->m_pContentId ,strlen(t_tempattach->m_pContentId),p_genmime->closure);
(*p_genmime->write_buffer)(">",1,p_genmime->closure);
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
(*p_genmime->write_buffer)(CONTENT_TRANS_MIMEREL,strlen(CONTENT_TRANS_MIMEREL),p_genmime->closure);
@ -225,13 +241,13 @@ output_base64_file(GenericMimeRelatedData *p_genmime, int16 p_index)
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
if( (t_inputfile = fopen( t_tempattach->m_pFilename, "r+b" )) != NULL )
if( (t_inputfile = XP_FileOpen( t_tempattach->m_pFilename, xpFileToPost,XP_FILE_READ_BIN )) != NULL )
{
/* Attempt to read in READBUFLEN characters */
t_base64data = MimeB64EncoderInit(p_genmime->write_buffer,p_genmime->closure);
if (!t_base64data)
return FALSE; /* bad?*/
while (!!feof( t_inputfile ))
while (!feof( t_inputfile ))
{
numread = fread( readbuffer, sizeof( char ), READ_BUFFER_LEN, t_inputfile );
if (ferror(t_inputfile))
@ -260,6 +276,10 @@ GenericMime_Begin(GenericMimeRelatedData *p_genmime)
XP_ASSERT(FALSE);
return FALSE;
}
if (p_genmime->m_iNumTextFiles == 1 && p_genmime->m_iNumBase64Files == 0)
{
return output_text_body(p_genmime,0); /*output only the body part*/
}
(*p_genmime->write_buffer)(CONTENT_TYPE_MPR_MIMEREL,strlen(CONTENT_TYPE_MPR_MIMEREL),p_genmime->closure);
(*p_genmime->write_buffer)(BOUNDARYSTR_MIMEREL,strlen(BOUNDARYSTR_MIMEREL),p_genmime->closure);
(*p_genmime->write_buffer)("\"",1,p_genmime->closure); /*begin quote*/
@ -283,6 +303,13 @@ GenericMime_Begin(GenericMimeRelatedData *p_genmime)
if (!output_base64_file(p_genmime,i))
return FALSE;
}
if (p_genmime->m_pBoundarySpecifier)
{
(*p_genmime->write_buffer)(p_genmime->m_pBoundarySpecifier,strlen(p_genmime->m_pBoundarySpecifier),p_genmime->closure);
(*p_genmime->write_buffer)("--",2,p_genmime->closure);
}
(*p_genmime->write_buffer)("\n",1,p_genmime->closure);
return TRUE;
}

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

@ -1,6 +1,8 @@
#ifndef _MPRMIME_H
#define _MPRMIME_H
XP_BEGIN_PROTOS
typedef struct _AttachmentFields
{
char *m_pFilename;
@ -9,14 +11,14 @@ typedef struct _AttachmentFields
char *m_pContentId;
}AttachmentFields;
AttachmentFields * AttachmentFields_Init(char *p_pFilename, char *p_pDispositionName, char *p_pContentType, char *p_pContentId);
AttachmentFields * AttachmentFields_Init(char *p_pFilename, char *p_pDispositionName,
char *p_pContentType, char *p_pContentId);
XP_Bool AttachmentFields_Destroy(AttachmentFields *p_fields);
typedef struct _GenericMimeRelatedData
{
XP_Bool m_bRemoveFiles; /*remove files from disk when complete with compilation*/
char *m_pBoundarySpecifier; /*string that is used as the boundary marker in multipart related mime*/
char **m_pTextFiles; /* text files that will be added as attachments*/
int16 *m_pCsids; /* charset ids for each text file */
@ -48,5 +50,12 @@ you are relinquishing ownership of attachment fields struct
*/
int GenericMime_AddBase64File(GenericMimeRelatedData *p_gendata, AttachmentFields *p_fields);
/*
typedef
*/
typedef int (*MPR_MIME_OUTPUTFUNC) (const char *, int32, void *);
XP_END_PROTOS
#endif //_MPRMIME_H

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

@ -23,6 +23,9 @@
#include "msgsendp.h"
#include "libi18n.h"
#ifdef MOZ_ENDER_MIME
#include "secrng.h" /* for RNG_GenerateGlobalRandomBytes() */
#endif /*MOZ_ENDER_MIME*/
extern "C"
{
extern int MK_OUT_OF_MEMORY;
@ -34,7 +37,25 @@ int32 MSG_SendPart::M_counter = 0;
MSG_SendPart::MSG_SendPart(MSG_SendMimeDeliveryState* state, int16 part_csid)
{
m_csid = part_csid;
m_type=NULL;
m_parent = NULL;
m_filename = NULL;
m_buffer = NULL;
m_other = NULL;
m_strip_sensitive_headers = FALSE;
m_encoder_data = FALSE;
m_children = NULL;
m_numchildren = 0;
m_firstBlock = FALSE;
m_needIntlConversion = FALSE;
m_mainpart = FALSE;
m_just_hit_CR = FALSE;
m_csid = part_csid;
SetMimeDeliveryState(state);
}
@ -208,7 +229,8 @@ MSG_SendPart* MSG_SendPart::GetChild(int32 which)
int MSG_SendPart::PushBody(char* buffer, int32 length)
{
int status = 0;
#ifndef MOZ_ENDER_MIME
int status = 0;
char* encoded_data = buffer;
/* if this is the first block, create the conversion object
@ -322,6 +344,9 @@ int MSG_SendPart::PushBody(char* buffer, int32 length)
}
return status;
#else
return 0;
#endif //MOZ_ENDER_MIME
}
@ -461,10 +486,29 @@ static int divide_content_headers(const char *headers,
extern "C" {
extern char *mime_make_separator(const char *prefix);
}
#ifdef MOZ_ENDER_MIME
//moved this here
extern "C" char *
mime_make_separator(const char *prefix)
{
unsigned char rand_buf[13];
RNG_GenerateGlobalRandomBytes((void *) rand_buf, 12);
return PR_smprintf("------------%s"
"%02X%02X%02X%02X"
"%02X%02X%02X%02X"
"%02X%02X%02X%02X",
prefix,
rand_buf[0], rand_buf[1], rand_buf[2], rand_buf[3],
rand_buf[4], rand_buf[5], rand_buf[6], rand_buf[7],
rand_buf[8], rand_buf[9], rand_buf[10], rand_buf[11]);
}
#endif
int MSG_SendPart::Write()
{
int status = 0;
#ifndef MOZ_ENDER_MIME
int status = 0;
char *separator = 0;
XP_File file = NULL;
@ -758,5 +802,7 @@ FAIL:
m_intlDocToMailConverter = NULL;
}
return status;
#else
return 0;
#endif //MOZ_ENDER_MIME
}

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

@ -26,9 +26,13 @@ class MSG_SendMimeDeliveryState;
typedef int (*MSG_SendPartWriteFunc)(const char* line, int32 size,
XP_Bool isheader, void* closure);
#ifndef MOZ_ENDER_MIME
class MSG_SendPart : public MSG_ZapIt {
#else
class MSG_SendPart {
#endif //MOZ_ENDER_MIME
public:
MSG_SendPart(MSG_SendMimeDeliveryState* state, int16 part_csid = 0);
virtual ~MSG_SendPart(); // Note that the destructor also destroys