This commit is contained in:
rhp%netscape.com 1999-07-13 18:38:36 +00:00
Родитель 3df4bddc1d
Коммит 65ff7eee4e
55 изменённых файлов: 1527 добавлений и 2126 удалений

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

@ -853,7 +853,7 @@ nsresult nsMsgSearchTerm::MatchRfc822String (const char *string, const char *cha
err = errContinueLoop = NS_COMFALSE;
PRUint32 count;
nsresult parseErr = m_headerAddressParser->ParseHeaderAddresses(charset, string, &names, &addresses, count) ;
nsresult parseErr = m_headerAddressParser->ParseHeaderAddresses(charset, string, &names, &addresses, &count) ;
if (NS_SUCCEEDED(parseErr) && count > 0)
{

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

@ -29,7 +29,7 @@ static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
char * names = NULL;
char * addresses = NULL;
PRUint32 numAddresses = 0;
sample->ParseHeaderAddresses(NULL, "Scott MacGregor <mscott@netscape.com>", &names, &addresses, numAddresses);
sample->ParseHeaderAddresses(NULL, "Scott MacGregor <mscott@netscape.com>", &names, &addresses, &numAddresses);
if (names)
{
printf(names);

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

@ -19,13 +19,9 @@
#[installed by xpidl] nsIDOMComposeAppCore.h
#[installed by xpidl] nsIMsgCompFields.h
nsIMsgSend.h
nsIMsgSendLater.h
nsMsgComposeFact.h
nsMsgCompFieldsFact.h
nsMsgSendFact.h
nsISmtpUrl.h
nsISmtpService.h
MsgCompGlue.h
nsMsgSendLaterFact.h
nsMsgComposeBE.h

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

@ -30,20 +30,17 @@ XPIDLSRCS = \
nsIMsgQuote.idl \
nsIMsgSendListener.idl \
nsIMsgSendLaterListener.idl \
nsIMsgSend.idl \
nsIMsgSendLater.idl \
$(NULL)
EXPORTS = \
nsMsgComposeFact.h \
nsMsgCompFieldsFact.h \
nsIMsgSend.h \
nsMsgSendFact.h \
nsMsgSendLaterFact.h \
nsISmtpUrl.h \
nsIMsgSend.h \
nsISmtpService.h \
MsgCompGlue.h \
nsMsgComposeBE.h \
nsIMsgSendLater.h \
$(NULL)
include $(topsrcdir)/config/config.mk

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

@ -1,313 +0,0 @@
// All the definition here after are temporary and must be removed in the future when be defined somewhere else...
#ifndef _MsgCompGlue_H_
#define _MsgCompGlue_H_
#include "mimeenc.h"
#include "xpgetstr.h"
#include "xp_qsort.h"
#include "msgcom.h"
#include "rosetta_mailnews.h"
#include "nsMsgZapIt.h"
// These are some defines that we used to get out of allxpstr. But we can't do that anymore...
#define MK_SMTP_SERVER_ERROR -234
#define MK_TCP_READ_ERROR -252
#define MK_COULD_NOT_LOGIN_TO_SMTP_SERVER -229
#define MK_COULD_NOT_GET_USERS_MAIL_ADDRESS -235
#define MK_POP3_PASSWORD_UNDEFINED -313
#define MK_ERROR_SENDING_FROM_COMMAND -230
#define MK_ERROR_SENDING_RCPT_COMMAND -231
#define MK_ERROR_SENDING_DATA_COMMAND -232
#define MK_ERROR_SENDING_MESSAGE -233
#define MK_MIME_NO_RECIPIENTS -267
#define MK_OUT_OF_MEMORY -207
#define MK_MSG_ASSEMBLING_MSG 1
#define MK_MSG_ASSEMB_DONE_MSG 1
#define MK_MSG_LOAD_ATTACHMNT 1
#define MK_MSG_LOAD_ATTACHMNTS 1
#define MK_MSG_DELIV_MAIL 1
#define MK_MSG_DELIV_MAIL_DONE 1
#define MK_MSG_DELIV_NEWS 1
#define MK_MSG_DELIV_NEWS_DONE 1
#define MK_MSG_QUEUEING 1
#define MK_MSG_WRITING_TO_FCC 1
#define MK_MSG_QUEUED 1
#define MK_MIME_ERROR_WRITING_FILE 1
#define MK_MIME_MULTIPART_BLURB 1
#define MK_MIME_NO_SENDER 1
#define MK_MSG_COULDNT_OPEN_FCC_FILE 1
#define MK_UNABLE_TO_OPEN_TMP_FILE -253
#define MK_MSG_CANT_CREATE_FOLDER -404
#define MK_MSG_SAVE_DRAFT 1
#define MK_ADDR_BOOK_CARD 882
#define MK_MSG_MAC_PROMPT_UUENCODE 1
#define MK_MSG_SAVING_AS_DRAFT 1
#define MK_MSG_SAVING_AS_TEMPLATE 1
#define MK_MSG_UNABLE_TO_SAVE_DRAFT 1
#define MK_MSG_UNABLE_TO_SAVE_TEMPLATE 1
#define MK_UNABLE_TO_OPEN_FILE 1
#define MK_IMAP_UNABLE_TO_SAVE_MESSAGE 1
#define MK_IMAP_NO_ONLINE_FOLDER 1
#define MK_MSG_FAILED_COPY_OPERATION 1
#define MK_MSG_INVALID_NEWS_HEADER 1
#define MK_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS 1
#define MK_MSG_MSG_COMPOSITION 1
#define MK_COMMUNICATIONS_ERROR 1
#define MK_MSG_EMPTY_MESSAGE 1
#define MK_MSG_DOUBLE_INCLUDE 1
#define MK_MSG_WHY_QUEUE_SPECIAL 1
#define MK_MSG_WHY_QUEUE_SPECIAL_OLD 1
#define MK_MSG_NOT_AS_SENT_FOLDER 1
#define MK_MSG_MISSING_SUBJECT 1
#define MK_MSG_SEND 1
#define MK_MSG_SEND_LATER 1
#define MK_MSG_ATTACH_ETC 1
#define MK_MSG_QUOTE_MESSAGE 1
#define MK_MSG_FROM 1
#define MK_MSG_REPLY_TO 1
#define MK_MSG_MAIL_TO 1
#define MK_MSG_MAIL_CC 1
#define MK_MSG_MAIL_BCC 1
#define MK_MSG_FILE_CC 1
#define MK_MSG_POST_TO 1
#define MK_MSG_FOLLOWUPS_TO 1
#define MK_MSG_SUBJECT 1
#define MK_MSG_ATTACHMENT 1
#define MK_MSG_ATTACH_AS_TEXT 1
#define MK_MSG_SAVE_DRAFT 1
#define MK_MSG_SAVE_TEMPLATE 1
#define MK_MSG_ASK_HTML_MAIL 1
#define MK_MSG_ASK_HTML_MAIL_TITLE 1
#define MK_MSG_HTML_RECIPIENTS 1
#define MK_MSG_HTML_RECIPIENTS_TITLE 1
#define MK_MSG_EVERYONE 1
#define MK_MSG_ENTER_NAME_FOR_TEMPLATE 1
#define MK_MSG_INVALID_NEWS_HEADER 1
#define MK_MSG_INVALID_FOLLOWUP_TO_HEADER 1
#define MK_MSG_OUTBOX_L10N_NAME_OLD 1
#define MK_MSG_SAVE_TEMPLATE 1
#define MK_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS 1
#define MK_MSG_FAILED_COPY_OPERATION 1
#define MK_MSG_INVALID_NEWS_HEADER 1
class MailMessageHdr
{
public:
MailMessageHdr() {return;}
~MailMessageHdr() {return;}
uint32 OrFlags(uint32 flags) {return 0;}
void SetMessageSize(uint32 messageSize) {return;}
PRBool SetMessageKey(char* articleNumber) {return PR_FALSE;}
};
class MailDB
{
public:
static nsresult Open(const char * dbName, PRBool create,
MailDB** pMessageDB,
PRBool upgrading = PR_FALSE) {return NS_ERROR_NOT_IMPLEMENTED;}
nsresult Close(void) {return 0;}
virtual nsresult AddHdrToDB(void *newHdr, PRBool *newThread, PRBool notify = PR_FALSE) {return PR_FALSE;}
unsigned long GetUnusedFakeId() {return 0;}
};
class ParseOutgoingMessage
{
public:
ParseOutgoingMessage() {return;}
virtual ~ParseOutgoingMessage() {return;}
void SetOutFile(PRFileDesc *out_file) {m_out_file = out_file;}
PRFileDesc *GetOutFile() {return m_out_file;}
void SetWriteMozillaStatus(XP_Bool writeMozStatus)
{m_writeMozillaStatus = writeMozStatus;}
virtual int StartNewEnvelope(const char *line, uint32 lineLength) {return 0;}
virtual void FinishHeader() {return;}
virtual int32 ParseFolderLine(const char *line, uint32 lineLength) {return 0;}
virtual int32 ParseBlock(const char *block, uint32 lineLength) {return 0;}
virtual void Clear() {return;}
void AdvanceOutPosition(uint32 amountToAdvance) {return;}
void SetWriteToOutFile(XP_Bool writeToOutFile) {m_writeToOutFile = writeToOutFile;}
void FlushOutputBuffer() {return;}
void SetMailDB(MailDB *mailDB) {return;}
MailDB * GetMailDB() {return NULL;}
void Init(uint32 fileposition) {return;}
uint32 m_bytes_written;
MailMessageHdr *m_newMsgHdr; /* current message header we're building */
protected:
static int32 LineBufferCallback(char *line, uint32 lineLength, void *closure);
XP_Bool m_wroteXMozillaStatus;
XP_Bool m_writeMozillaStatus;
XP_Bool m_writeToOutFile;
XP_Bool m_lastBodyLineEmpty;
PRFileDesc *m_out_file;
uint32 m_ouputBufferSize;
char *m_outputBuffer;
uint32 m_outputBufferIndex;
};
class MSG_Prefs : public nsMsgZapIt
{
public:
PRBool GetDefaultBccSelf(PRBool newsBcc) {return PR_FALSE;}
const char * GetDefaultHeaderContents(MSG_HEADER_SET header) {return NULL;}
char * MagicFolderName(uint32 flag, int *pStatus = 0) {return NULL;}
PRBool GetAutoQuoteReply() {return PR_FALSE;}
PRBool GetMailServerIsIMAP4() {return PR_FALSE;}
};
class MSG_FolderInfoMail
{
public:
char * GetPathname() {return "";}
};
class MSG_IMAPFolderInfoMail : public MSG_FolderInfoMail
{
public:
virtual MSG_IMAPFolderInfoMail *GetIMAPFolderInfoMail() {return NULL;}
};
class MSG_PostDeliveryActionInfo : public nsMsgZapIt
{
public:
MSG_PostDeliveryActionInfo(MSG_FolderInfo *folderInfo) {;}
MSG_FolderInfo *m_folderInfo;
// XPDWordArray m_msgKeyArray; /* origianl message keyArray */
uint32 m_flags;
char * MagicFolderName(PRUint32 flag, int *pStatus = 0) {return NULL;}
PRBool GetAutoQuoteReply() {return PR_FALSE;}
};
class TIMAPNamespace
{
public:
void * unsused;
};
class MSG_Master
{
public:
MSG_Prefs* GetPrefs() {return NULL;}
PRInt32 GetFolderTree(void) {return 0;}
HJ97882
PRBool IsUserAuthenticated() {return PR_FALSE;}
// msg_HostTable* GetHostTable() {return m_hosttable;}
MSG_FolderInfoMail *FindMailFolder(const char* pathname, PRBool createIfMissing) {return NULL;}
MSG_IMAPFolderInfoMail *FindImapMailFolder(const char *hostName, const char* onlineServerName, const char *owner, PRBool createIfMissing) {return NULL;}
MSG_IMAPHost *GetIMAPHost(const char *hostName) {return NULL;}
};
class MSG_Pane
{
public:
void* unused;
MSG_Prefs* m_prefs;
MWContext* m_context;
MSG_Master* m_master;
MSG_Pane() {;}
virtual ~MSG_Pane() {;}
void MSG_PaneCreate(MWContext* context, MSG_Master* master) {;}
MSG_Prefs* GetPrefs() {return m_prefs;}
PRInt32 GetCommandStatus(PRInt32 command,
const unsigned long * indices,
PRInt32 numindices,
PRBool* selectable_p,
void* selected_p,
const char **display_string,
PRBool * plural_p) {return 0;};
PRInt32 DoCommand(PRInt32 command, const unsigned long* indices, PRInt32 numIndices) {return 0;}
virtual void InterruptContext(PRBool safetoo) {;}
const char * GetHTMLPart() {return NULL;}
MWContext* GetContext() {return m_context;}
MSG_Pane* FindPane(MWContext* context, PRInt32 type, PRBool contextMustMatch = PR_FALSE) {return NULL;}
const char * GetQuoteUrl() {return NULL;}
const char * GetQuoteHtmlPart() {return NULL;}
void SetQuoteHtmlPart(const char * urlString) {/*NYI*/;}
void SetQuoteUrl(const char * urlString) {/*NYI*/;}
MSG_Master* GetMaster() {return m_master;}
virtual MSG_PaneType GetPaneType() {return MSG_PANE;}
void SetRequestForReturnReceipt(PRBool isNeeded) {return;}
MSG_PostDeliveryActionInfo *GetPostDeliveryActionInfo () {return NULL;}
void SetPostDeliveryActionInfo(MSG_PostDeliveryActionInfo *) {;}
virtual void SetIMAPListMailbox(const char *name) {;}
virtual XP_Bool IMAPListMailboxExist() {return PR_FALSE;}
};
#define QUEUE_FOLDER_NAME_OLD MSG_GetSpecialFolderName(MK_MSG_OUTBOX_L10N_NAME_OLD)
#define NotifyCode PRInt32
#define NET_parse_news_url(a, b, c, d, e, f) -1
#define FE_Alert(a, b) printf("ALERT: %s", b)
#define msg_InterruptContext(a, b) /*NYI*/
#define msg_GetDummyEnvelope() NULL
#define msg_IsSummaryValid(a, b) PR_FALSE
#define msg_ConfirmMailFile(a, b) PR_FALSE
#define msg_SetSummaryValid(a, b, c) /*NYI*/
#define AB_UserHasVCard() PR_TRUE
#define AB_InsertOrUpdateABookEntry(a, b, c, d) PR_TRUE
#define AB_LoadIdentityVCard(a) 0
#define AB_ExportVCardToTempFile(a, b) 0
const int kMaxFullNameLength = 256;
#define vCardMimeFormat "text/x-vcard"
#define AB_GetHTMLCapability(a, b) PR_TRUE
#define MSG_FORWARD_COOKIE "$forward_quoted$"
#define EDT_PasteQuoteBegin(a, b) PR_FALSE
#define EDT_PasteQuote(a, b) /*NYI*/
#define EDT_PasteQuoteEnd(a) /*NYI*/
#define msg_LineBuffer(a, b, c, d, e, f, g, h) NULL
#define eOUT_OF_MEMORY 0xFF7F
#define XL_InitializeTextSetup(a) /*NYI*/
#define FindFolderOfType(a) NULL
#define XP_CopyDialogString(a, b, c) /*NYI*/
#define MAX_WRITE_READY (((unsigned) (~0) << 1) >> 1) /* must be <= than MAXINT!!!!! */
#define APPLICATION_DIRECTORY "application/directory" /* text/x-vcard is synonym */
extern char *msg_MagicFolderName(MSG_Prefs* prefs, uint32 flag, int *pStatus);
#define MIME_MakeFromField(a) PL_strdup("testmsg@netscape.com")
#define DRAFTS_FOLDER_NAME "Draft"
#define SENT_FOLDER_NAME "Sent"
#define TEMPLATES_FOLDER_NAME "Template"
#define CreateIMAPSubscribeMailboxURL(a, b, c) ""
#define IMAPNS_GenerateFullFolderNameWithDefaultNamespace(a, b, c, d, e) NULL
#define IMAPNS_GetDelimiterForNamespace(a) '/'
#define CreateImapMailboxCreateUrl(a, b,c) NULL
#define MSG_CommandType PRUint32
#undef FE_Progress
#define FE_Progress(cx,msg) printf("Progress: %s\n", msg)
extern int MISC_ValidateReturnAddress (MWContext *,const char *);
extern History_entry * SHIST_GetCurrent(History *);
/*QUESTION: can we remove #ifdef XP_OS2 ?*/
/*REMARK: as #define MOZ_NEWADDR is always true, we should remove it when used*/
#endif //_MsgCompGlue_H_

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

@ -25,6 +25,8 @@ XPIDLSRCS = \
.\nsIMsgQuote.idl \
.\nsIMsgSendListener.idl \
.\nsIMsgSendLaterListener.idl \
.\nsIMsgSend.idl \
.\nsIMsgSendLater.idl \
$(NULL)
################################################################################
@ -33,14 +35,10 @@ XPIDLSRCS = \
EXPORTS = \
nsMsgComposeFact.h \
nsMsgCompFieldsFact.h \
nsIMsgSend.h \
nsMsgSendFact.h \
nsMsgSendLaterFact.h \
nsISmtpUrl.h \
nsISmtpService.h \
MsgCompGlue.h \
nsMsgComposeBE.h \
nsIMsgSendLater.h \
$(NULL)
include <$(DEPTH)\config\rules.mak>

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

@ -1,72 +0,0 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM nsIMsgSend.idl
*/
#ifndef __gen_nsIMsgSend_h__
#define __gen_nsIMsgSend_h__
#include "nsISupports.h" /* interface nsISupports */
#include "nsIMsgCompFields.h" /* interface nsIMsgCompFields */
#include "nsIMsgSendListener.h"
#include "nsIMsgIdentity.h"
#include "nsMsgComposeBE.h"
#include "nsIMessage.h"
#ifdef XPIDL_JS_STUBS
#include "jsapi.h"
#endif
/* starting interface: nsIMsgSend */
/* {9E9BD970-C5D6-11d2-8297-000000000000} */
#define NS_IMSGSEND_IID_STR "9E9BD970-C5D6-11d2-8297-000000000000"
#define NS_IMSGSEND_IID \
{0x9E9BD970, 0xC5D6, 0x11d2, \
{ 0x82, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
class nsIMsgSend : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMSGSEND_IID)
NS_IMETHOD CreateAndSendMessage(
nsIMsgIdentity *aUserIdentity,
nsIMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
nsMsgDeliverMode mode,
nsIMessage *msgToReplace,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
void *relatedPart /* nsMsgSendPart */,
nsIMsgSendListener **aListenerArray) = 0;
NS_IMETHOD SendMessageFile(
nsIMsgIdentity *aUserIdentity,
nsIMsgCompFields *fields,
nsFileSpec *sendFileSpec,
PRBool deleteSendFileOnCompletion,
PRBool digest_p,
nsMsgDeliverMode mode,
nsIMessage *msgToReplace,
nsIMsgSendListener **aListenerArray) = 0;
NS_IMETHOD SendWebPage(
nsIMsgIdentity *aUserIdentity,
nsIMsgCompFields *fields,
nsIURI *url,
nsMsgDeliverMode mode,
nsIMsgSendListener **aListenerArray) = 0;
NS_IMETHOD AddListener(nsIMsgSendListener *aListener) = 0;
NS_IMETHOD RemoveListener(nsIMsgSendListener *aListener) = 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIMsgSend *priv);
#endif
};
#endif /* __gen_nsIMsgSend_h__ */

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

@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __nsIMsgSendLater_h__
#define __nsIMsgSendLater_h__
#include "nsISupports.h" /* interface nsISupports */
#include "nsIMsgIdentity.h" /* interface nsIMsgCompFields */
#include "nsIOutputStream.h"
#include "nsIMsgSendLaterListener.h"
#include "nsMsgComposeBE.h"
#ifdef XPIDL_JS_STUBS
#include "jsapi.h"
#endif
/* starting interface: nsIMsgSendLater */
// {E15C83E8-1CF4-11d3-8EF0-00A024A7D144}
#define NS_IMSGSENDLATER_IID_STR "E15C83E8-1CF4-11d3-8EF0-00A024A7D144"
#define NS_IMSGSENDLATER_IID \
{ 0xe15c83e8, 0x1cf4, 0x11d3, \
{ 0x8e, 0xf0, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 } };
class nsIMsgSendLater : public nsIOutputStream {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMSGSENDLATER_IID)
NS_IMETHOD SendUnsentMessages(nsIMsgIdentity *identity,
nsIMsgSendLaterListener **listenerArray) = 0;
NS_IMETHOD RemoveListener(nsIMsgSendLaterListener *aListener) = 0;
NS_IMETHOD AddListener(nsIMsgSendLaterListener *aListener) = 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIMsgSendLater *priv);
#endif
};
#endif /* __nsIMsgSendLater_h__ */

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

@ -1,119 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsMsgComposeBE_H_
#define _nsMsgComposeBE_H_
#include "rosetta.h"
#include "nsIURL.h"
#include "nsFileSpec.h"
//
// Composition back end declarations...
//
//
// Callback declarations for message delivery
//
// For completion of send/message creation operations...
typedef nsresult (*nsMsgSendCompletionCallback) (nsresult aExitCode, void *tagData, nsFileSpec *returnFileSpec);
// For completion of sending unsent messages operations...
typedef nsresult (*nsMsgSendUnsentMessagesCallback) (nsresult aExitCode, PRUint32 totalSentCount,
PRUint32 totalSentSuccessfully, void *tagData);
// Message delivery modes
typedef enum
{
nsMsgDeliverNow,
nsMsgQueueForLater,
nsMsgSave,
nsMsgSaveAs,
nsMsgSaveAsDraft,
nsMsgSaveAsTemplate
} nsMsgDeliverMode;
// Attachment file/URL structures
struct nsMsgAttachmentData
{
nsIURI *url; // The URL to attach. This should be 0 to signify "end of list".
char *desired_type; // The type to which this document should be
// converted. Legal values are NULL, TEXT_PLAIN
// and APPLICATION_POSTSCRIPT (which are macros
// defined in net.h); other values are ignored.
char *real_type; // The type of the URL if known, otherwise NULL. For example, if
// you were attaching a temp file which was known to contain HTML data,
// you would pass in TEXT_HTML as the real_type, to override whatever type
// the name of the tmp file might otherwise indicate.
char *real_encoding; // Goes along with real_type
char *real_name; // The original name of this document, which will eventually show up in the
// Content-Disposition header. For example, if you had copied a document to a
// tmp file, this would be the original, human-readable name of the document.
char *description; // If you put a string here, it will show up as the Content-Description header.
// This can be any explanatory text; it's not a file name.
char *x_mac_type, *x_mac_creator; // Mac-specific data that should show up as optional parameters
// to the content-type header.
};
//
// When we have downloaded a URL to a tmp file for attaching, this
// represents everything we learned about it (and did to it) in the
// process.
//
typedef struct nsMsgAttachedFile
{
nsIURI *orig_url; // Where it came from on the network (or even elsewhere on the local disk.)
nsFileSpec *file_spec; // The tmp file in which the (possibly converted) data now resides.
char *type; // The type of the data in file_name (not necessarily the same as the type of orig_url.)
char *encoding; // Likewise, the encoding of the tmp file. This will be set only if the original
// document had an encoding already; we don't do base64 encoding and so forth until
// it's time to assemble a full MIME message of all parts.
char *description; // For Content-Description header
char *x_mac_type; // mac-specific info
char *x_mac_creator; // mac-specific info
char *real_name; // The real name of the file.
// Some statistics about the data that was written to the file, so that when
// it comes time to compose a MIME message, we can make an informed decision
// about what Content-Transfer-Encoding would be best for this attachment.
// (If it's encoded already, we ignore this information and ship it as-is.)
PRUint32 size;
PRUint32 unprintable_count;
PRUint32 highbit_count;
PRUint32 ctl_count;
PRUint32 null_count;
PRUint32 max_line_length;
HG68452
} nsMsgAttachedFile;
#endif /* _nsMsgComposeBE_H_ */

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

@ -20,3 +20,4 @@ MsgComposeCommands.js
defaultHtmlBody.html
defaultTextBody.html
messengercompose.xul
composebe_en.properties

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

@ -33,6 +33,7 @@ EXPORT_RESOURCE_SAMPLES = \
$(srcdir)/MsgComposeCommands.js \
$(srcdir)/defaultTextBody.html \
$(srcdir)/defaultHtmlBody.html \
$(srcdir)/composebe_en.properties \
$(NULL)
EXPORT_RESOURCE_SAMPLES_TO_REMOVE := $(addprefix $(SAMPLES_DIR)/, $(EXPORT_RESOURCE_SAMPLES))

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

@ -24,10 +24,11 @@ install::
$(MAKE_INSTALL) msgcomposecommands.js $(DIST)\bin\chrome\messengercompose\content\default
$(MAKE_INSTALL) defaultTextBody.html $(DIST)\bin\chrome\messengercompose\content\default
$(MAKE_INSTALL) defaultHtmlBody.html $(DIST)\bin\chrome\messengercompose\content\default
$(MAKE_INSTALL) composebe_en.properties $(DIST)\bin\chrome\messengercompose\content\default
clobber::
rm -f $(DIST)\bin\chrome\messengercompose\content\default\messengercompose.xul
rm -f $(DIST)\bin\chrome\messengercompose\content\default\msgcomposecommands.js
rm -f $(DIST)\bin\chrome\messengercompose\content\default\defaultTextBody.html
rm -f $(DIST)\bin\chrome\messengercompose\content\default\defaultHtmlBody.html
rm -f $(DIST)\bin\chrome\messengercompose\content\default\composebe_en.properties

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

@ -51,7 +51,6 @@ EXPORTS = \
CPPSRCS = \
nsMsgCompFields.cpp \
msgCompGlue.cpp \
nsSmtpUrl.cpp \
nsSmtpProtocol.cpp \
nsMsgSend.cpp \

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

@ -36,6 +36,7 @@ EXPORTS= nsSmtpUrl.h \
nsMsgCompFields.h \
nsMsgQuote.h \
nsURLFetcher.h \
nsMsgTransition.h \
$(NULL)
################################################################################
@ -45,7 +46,6 @@ LIBRARY_NAME=msgcompose_s
CPP_OBJS= .\$(OBJDIR)\nsMsgCompFields.obj \
.\$(OBJDIR)\nsSmtpUrl.obj \
.\$(OBJDIR)\MsgCompGlue.obj \
.\$(OBJDIR)\nsSmtpProtocol.obj \
.\$(OBJDIR)\nsMsgSend.obj \
.\$(OBJDIR)\nsMsgSendPart.obj \

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

@ -1,58 +0,0 @@
//
// All the definition here after are temporary and must be removed in the future when
// be defined somewhere else...
//
#define NS_IMPL_IDS
#include "nsISupports.h"
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsIPref.h"
#include "nsIMimeConverter.h"
#include "msgCore.h"
#include "rosetta_mailnews.h"
#include "nsMsgTransition.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID);
class MSG_Pane;
const char *FE_UsersSignature() {return NULL;}
void NET_FreeURLStruct (URL_Struct *) {return;}
URL_Struct *NET_CreateURLStruct (const char *, NET_ReloadMethod) {return NULL;}
char * NET_ParseURL (const char *, int ) {return NULL;}
int NET_URL_Type (const char *) {return nsnull;}
XP_Bool NET_IsLocalFileURL(char *address) {return PR_TRUE;}
int NET_InterruptWindow(MWContext * window_id) {return 0;}
XP_FILE_URL_PATH XP_PlatformFileToURL (const XP_FILE_NATIVE_PATH ) {return NULL;}
MWContext *XP_FindContextOfType(MWContext *, MWContextType) {return NULL;}
XP_FILE_NATIVE_PATH WH_FileName (const char *, XP_FileType ) {return NULL;}
int XP_Stat(const char * name, XP_StatStruct * outStat, XP_FileType type) {return 0;}
int XP_FileTruncate(const char* name, XP_FileType type, int32 length) {return 0;}
Bool XP_IsContextBusy(MWContext * context) {return PR_FALSE;}
const char * MSG_GetSpecialFolderName(int ) {return NULL;}
const char * MSG_GetQueueFolderName() {return NULL;}
MSG_Pane * MSG_FindPane(MWContext* , MSG_PaneType ) {return NULL;}
int MSG_ExplodeHeaderField(MSG_HEADER_SET,const char * ,MSG_HeaderEntry **) {return nsnull;}
char * MSG_MakeFullAddress (const char* , const char* ) {return NULL;}
void MSG_MailCompositionAllConnectionsComplete (MSG_Pane* /*pane*/) {return;}
char *MimeGuessURLContentName(MWContext *context, const char *url) {return NULL;}
void MIME_GetMessageCryptoState(MWContext *,PRBool *,PRBool *,PRBool *,PRBool *) {return;}
HJ10196
History_entry * SHIST_GetCurrent(History *) {return NULL;}
int MISC_ValidateReturnAddress (MWContext *,const char *) {return nsnull;}
char *msg_MagicFolderName(MSG_Prefs* prefs, uint32 flag, int *pStatus) {return NULL;}
extern "C" {
void FE_MsgShowHeaders(MSG_Pane *, MSG_HEADER_SET) {return;}
HJ98703
}

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

@ -25,6 +25,8 @@
#include "nsMsgEncoders.h"
#include "nsMsgI18N.h"
#include "nsURLFetcher.h"
#include "nsMimeTypes.h"
#include "nsMsgComposeStringBundle.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -289,7 +291,7 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset)
{
m_encoder_data = MIME_B64EncoderInit(mime_encoder_output_fn,
m_mime_delivery_state);
if (!m_encoder_data) return MK_OUT_OF_MEMORY;
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
}
else if (!PL_strcasecmp(m_encoding, ENCODING_UUENCODE))
{
@ -324,13 +326,13 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset)
mime_encoder_output_fn,
m_mime_delivery_state);
PR_FREEIF(tailName);
if (!m_encoder_data) return MK_OUT_OF_MEMORY;
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
}
else if (!PL_strcasecmp(m_encoding, ENCODING_QUOTED_PRINTABLE))
{
m_encoder_data = MIME_QPEncoderInit(mime_encoder_output_fn,
m_mime_delivery_state);
if (!m_encoder_data) return MK_OUT_OF_MEMORY;
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
}
else
{
@ -405,29 +407,29 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
NS_ASSERTION (! m_done, "Already done");
mCompFields = compFields;
if (!mURL)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
mCompFields = compFields;
// First, get as file spec and create the stream for the
// temp file where we will save this data
mFileSpec = nsMsgCreateTempFileSpec("nsmail.tmp");
if (! mFileSpec )
return (NS_ERROR_OUT_OF_MEMORY);
return (NS_ERROR_FAILURE);
mOutFile = new nsOutputFileStream(*mFileSpec, PR_WRONLY | PR_CREATE_FILE);
if (!mOutFile)
{
delete mFileSpec;
mFileSpec = nsnull;
//return MK_UNABLE_TO_OPEN_TMP_FILE;
return NS_ERROR_FAILURE;
return NS_MSG_UNABLE_TO_OPEN_TMP_FILE;
}
mURL->GetSpec(&url_string);
#ifdef XP_MAC
// do we need to add IMAP: to this list? NET_IsLocalFileURL returns PR_FALSE always for IMAP
// do we need to add IMAP: to this list? nsMsgIsLocalFileURL returns PR_FALSE always for IMAP
if ( (nsMsgIsLocalFile(url_string) &&
(PL_strncasecmp(url_string, "mailbox:", 8) != 0)) )
{
@ -435,7 +437,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
// address in the url.
char *src_filename = nsMsgGetLocalFileFromURL (url_string);
if (!src_filename)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
// Only use appledouble if we aren't uuencoding.
if( nsMsgIsMacFile(src_filename) && (! UseUUEncode_p()) )
@ -446,7 +448,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
if (!separator)
{
PR_FREEIF(src_filename);
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
mAppleFileSpec = nsMsgCreateTempFileSpec("nsmail.tmp");
@ -476,7 +478,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
{
PR_FREEIF(src_filename);
PR_FREEIF(separator);
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
if (NS_FAILED(nsMsgNewURL(&mURL, nsString(newURLSpec))))
@ -484,7 +486,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
PR_FREEIF(src_filename);
PR_FREEIF(separator);
PR_FREEIF(newURLSpec);
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(mURL);
@ -567,7 +569,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
{
delete mFetcher;
mFetcher = nsnull;
return NS_ERROR_FAILURE;
return NS_ERROR_UNEXPECTED;
}
return status;
@ -663,7 +665,7 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
{
m_mime_delivery_state->Fail(status, 0);
delete eMsg;
return NS_ERROR_FAILURE;
return NS_ERROR_UNEXPECTED;
}
}
}
@ -685,9 +687,7 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
else
{
// If this is not the last attachment, but it got an error,
// then report that error and continue (we won't actually
// abort the delivery until all the other pending URLs have
// caught up with the NET_InterruptWindow() we did up above.)
// then report that error and continue
if (NS_FAILED(status))
{
m_mime_delivery_state->Fail(status, eMsg);

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

@ -22,6 +22,7 @@
#include "nsMsgCompFieldsFact.h"
#include "nsIPref.h"
#include "nsMsgI18N.h"
#include "nsMsgComposeStringBundle.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -120,33 +121,7 @@ nsresult nsMsgCompFields::Copy(nsIMsgCompFields* pMsgCompFields)
nsresult nsMsgCompFields::SetHeader(PRInt32 header, const char *value)
{
int status = 0;
/* Since colon is not a legal character in a newsgroup name under son-of-1036
we're assuming that such a header contains a URL, and we should parse it out
to infer the news server. */
// RICHIE - for now we are not restricting this to a single mail host...// if (value && MSG_NEWSGROUPS_HEADER_MASK == header && PL_strchr(value, ':'))
if (PR_FALSE)
{
status = ParseNewsgroupsForUrls (value);
if (status == 0)
return status; /* it was a news URL, and we snarfed it up */
else
{
if (status == MK_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS)
{
#ifdef UNREAD_CODE
MSG_Pane *owner = GetOwner();
if (owner)
FE_Alert (owner->GetContext(), XP_GetString(status));
#endif
}
status = 0; /* It isn't a valid news URL, so treat it like a newsgroup
MSG_CompositionPane::SanityCheck will decide if it's a legal newsgroup name */
}
}
int status = 0;
int i = DecodeHeader(header);
if (i >= 0) {
char* old = m_headers[i]; /* Done with careful paranoia, in case the
@ -157,7 +132,7 @@ nsresult nsMsgCompFields::SetHeader(PRInt32 header, const char *value)
if (value) {
m_headers[i] = nsCRT::strdup(value);
if (!m_headers[i])
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
} else
m_headers[i] = NULL;
PR_FREEIF(old);
@ -516,64 +491,19 @@ HJ36954
if (newsPostUrl) {
const char *existingHeader = GetHeader(MSG_NEWSPOSTURL_HEADER_MASK);
if (existingHeader && *existingHeader && nsCRT::strcasecmp(newsPostUrl, existingHeader))
status = MK_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS; /* can only send to one news host at a time */
status = NS_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS; /* can only send to one news host at a time */
else {
SetHeader (MSG_NEWSPOSTURL_HEADER_MASK, newsPostUrl);
status = 0; /* we succeeded, no need to keep looking at this header */
}
PR_Free(newsPostUrl);
} else
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
}
return status;
}
PRInt16 nsMsgCompFields::ParseNewsgroupsForUrls (const char *value)
{
int status = 0;
//
// Here we pull apart the comma-separated header value and look for news
// URLs. We'll use the URL to set the newspost URL to determine the host
//
#if 0 // RICHIE - this will change with seth's new approach
msg_StringArray values (PR_TRUE /* owns memory for strings */);
values.ImportTokenList (value);
for (int i = 0; i < values.GetSize() && status == 0; i++) {
const char *singleValue = values.GetAt(i);
if (NEWS_TYPE_URL == NET_URL_Type (singleValue)) {
char *hostPort, *group, *id, *data;
HJ81279
if (status == 0) {
HJ78808
if (status == 0) {
values.RemoveAt(i); /* Remove the URL spec for this group */
values.InsertAt (i, group); /* Add in the plain old group name */
}
PR_FREEIF (hostPort);
PR_FREEIF (group);
PR_FREEIF (id);
PR_FREEIF (data);
}
} else
status = MK_MSG_INVALID_NEWS_HEADER;
}
if (status == 0) {
char *newValue = values.ExportTokenList ();
if (newValue) {
status = SetHeader (MSG_NEWSGROUPS_HEADER_MASK, newValue);
PR_Free(newValue);
}
}
#endif
return status;
}
nsresult nsMsgCompFields::SetBody(const PRUnichar *value)
{
long retval = 0;
@ -584,7 +514,7 @@ nsresult nsMsgCompFields::SetBody(const PRUnichar *value)
ConvertFromUnicode(m_internalCharSet, value, &cString);
m_body = cString;
if (!m_body)
retval = MK_OUT_OF_MEMORY;
retval = NS_ERROR_OUT_OF_MEMORY;
}
return retval;
}
@ -609,7 +539,7 @@ nsresult nsMsgCompFields::SetBody(const char *value)
if (value) {
m_body = nsCRT::strdup(value);
if (!m_body)
retval = MK_OUT_OF_MEMORY;
retval = NS_ERROR_OUT_OF_MEMORY;
}
return retval;
}
@ -620,7 +550,7 @@ const char* nsMsgCompFields::GetBody()
}
PRInt16 nsMsgCompFields::AppendBody(char* value)
nsresult nsMsgCompFields::AppendBody(char* value)
{
if (!value || !*value)
return 0;
@ -635,13 +565,13 @@ PRInt16 nsMsgCompFields::AppendBody(char* value)
PR_Free(m_body);
m_body = tmp;
} else {
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
}
return 0;
}
PRInt16 nsMsgCompFields::DecodeHeader(MSG_HEADER_SET header)
nsresult nsMsgCompFields::DecodeHeader(MSG_HEADER_SET header)
{
int result;
@ -679,7 +609,7 @@ PRInt16 nsMsgCompFields::DecodeHeader(MSG_HEADER_SET header)
return result;
}
PRInt16 nsMsgCompFields::AddForwardURL(const char* url)
nsresult nsMsgCompFields::AddForwardURL(const char* url)
{
NS_ASSERTION(url && *url, "empty url");
if (!url || !*url)
@ -689,7 +619,7 @@ PRInt16 nsMsgCompFields::AddForwardURL(const char* url)
m_maxforward += 10;
char** tmp = new char* [m_maxforward];
if (!tmp)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
for (PRInt32 i=0 ; i<m_numforward ; i++) {
tmp[i] = m_forwardurl[i];
}
@ -698,7 +628,7 @@ PRInt16 nsMsgCompFields::AddForwardURL(const char* url)
}
m_forwardurl[m_numforward] = new char[nsCRT::strlen(url) + 1];
if (!m_forwardurl[m_numforward])
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
m_forwardurl[m_numforward] = nsCRT::strdup(url);
m_numforward++;
return 0;

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

@ -26,7 +26,7 @@
#include "msgcom.h"
#include "nsMsgHeaderMasks.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsIMsgCompFields.h"
@ -197,12 +197,12 @@ public:
NS_IMETHOD SetBody(const char *value);
const char* GetBody();
PRInt16 AppendBody(char*);
nsresult AppendBody(char*);
// When forwarding a bunch of messages, we can have a bunch of
// "forward url's" instead of an attachment.
PRInt16 AddForwardURL(const char*);
nsresult AddForwardURL(const char*);
PRInt32 GetNumForwardURL();
const char* GetForwardURL(PRInt32 which);
@ -225,11 +225,10 @@ public:
PRBool GetUseMultipartAlternative() {return m_multipart_alt;}
protected:
PRInt16 DecodeHeader(MSG_HEADER_SET header);
nsresult DecodeHeader(MSG_HEADER_SET header);
// These methods allow news URLs in the newsgroups header
HJ30181
PRInt16 ParseNewsgroupsForUrls (const char *value);
#define MAX_HEADERS 32
MSG_Pane* m_owner;

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

@ -23,12 +23,13 @@
#include "nsINetService.h"
#include "nsMailHeaders.h"
#include "nsMsgI18N.h"
//#include "xp_time.h"
#include "nsMsgCompPrefs.h"
#include "nsIMsgHeaderParser.h"
#include "nsIMimeURLUtils.h"
#include "nsINntpService.h"
#include "nsMsgNewsCID.h"
#include "nsMimeTypes.h"
#include "nsMsgComposeStringBundle.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
@ -201,14 +202,14 @@ nsresult mime_sanity_check_fields (
/* #### sanity check other_random_headers for newline conventions */
if (!from || !*from)
return MK_MIME_NO_SENDER;
return NS_MSG_NO_SENDER;
else
if ((!to || !*to) && (!cc || !*cc) &&
(!bcc || !*bcc) && (!newsgroups || !*newsgroups))
#if 0
return MK_MIME_NO_RECIPIENTS;
return NS_MSG_NO_RECIPIENTS;
#else
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
#endif
else
return NS_OK;
@ -292,7 +293,7 @@ mime_generate_headers (nsMsgCompFields *fields,
buffer = (char *) PR_Malloc (size);
if (!buffer)
return 0; /* MK_OUT_OF_MEMORY */
return 0; /* NS_ERROR_OUT_OF_MEMORY */
buffer_tail = buffer;
@ -496,8 +497,10 @@ mime_generate_headers (nsMsgCompFields *fields,
if (tmpBuffer) PL_strfree(tmpBuffer);
tmpBuffer=nsnull;
/**** RICHIE - have to change this as we convert to new world stuff!
if (!fields->GetOwner()->GetMaster()->IsUserAuthenticated())
PUSH_STRING (" (Unverified)");
****************************/
PUSH_NEWLINE ();
}
}
@ -599,7 +602,7 @@ mime_generate_headers (nsMsgCompFields *fields,
ptr = PL_strdup(pNewsGrp);
if (!ptr) {
PR_FREEIF(buffer);
return 0; /* MK_OUT_OF_MEMORY */
return 0; /* NS_ERROR_OUT_OF_MEMORY */
}
n2 = nsMsgStripLine(ptr);
NS_ASSERTION(n2 == ptr, "n2 != ptr"); /* Otherwise, the PR_Free below is
@ -703,7 +706,7 @@ mime_generate_headers (nsMsgCompFields *fields,
ptr = PL_strdup(pFollow);
if (!ptr) {
PR_FREEIF(buffer);
return 0; /* MK_OUT_OF_MEMORY */
return 0; /* NS_ERROR_OUT_OF_MEMORY */
}
n2 = nsMsgStripLine (ptr);
NS_ASSERTION(n2 == ptr, "n2 != ptr"); /* Otherwise, the PR_Free below is
@ -896,7 +899,7 @@ mime_generate_attachment_headers (const char *type, const char *encoding,
char *buffer_tail = buffer;
if (! buffer)
return 0; /* MK_OUT_OF_MEMORY */
return 0; /* NS_ERROR_OUT_OF_MEMORY */
NS_ASSERTION (encoding, "null encoding");
@ -1577,19 +1580,19 @@ nsMsgMIMEGenerateMailtoFormPostHeaders (const char *old_post_url,
from = MIME_MakeFromField (CS_DEFAULT);
if (!from) {
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
to = nsMsgParseURL (old_post_url, GET_PATH_PART);
if (!to) {
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
if (!*to)
{
status = MK_MIME_NO_RECIPIENTS; /* rb -1; */
status = NS_MSG_NO_RECIPIENTS; /* rb -1; */
goto FAIL;
}
@ -1746,7 +1749,7 @@ nsMsgMIMEGenerateMailtoFormPostHeaders (const char *old_post_url,
*/
if (!fields)
{
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
@ -1755,7 +1758,7 @@ nsMsgMIMEGenerateMailtoFormPostHeaders (const char *old_post_url,
*headers_return = mime_generate_headers (fields, 0, nsMsgDeliverNow);
if (*headers_return == 0)
{
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
@ -1847,8 +1850,11 @@ msg_pick_real_name (nsMsgAttachmentHandler *attachment, const char *charset)
### mwelch Note that this function simply duplicates and returns an existing
MIME header, so we don't need to process it. */
MWContext *x = NULL;
attachment->m_real_name = MimeGuessURLContentName(x, url);
// RICHIE - NEED TO DO SOMETHING BETTER HERE!!!!!! THIS WILL HELP WITH FILENAMES
// FOR TEMP FILES
// RICHIE attachment->m_real_name = MimeGuessURLContentName(x, url);
attachment->m_real_name = nsnull;
if (attachment->m_real_name)
{
return;

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

@ -616,7 +616,10 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI, MSG_Compo
}
}
QuoteOriginalMessage(originalMsgURI, 1);
if (NS_FAILED(QuoteOriginalMessage(originalMsgURI, 1)))
{
LoadBody();
}
break;
}
@ -637,10 +640,13 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI, MSG_Compo
else
m_compFields->SetSubject(bString.GetUnicode());
nsresult tempRes;
if (type == MSGCOMP_TYPE_ForwardAsAttachment)
QuoteOriginalMessage(originalMsgURI, 0);
tempRes = QuoteOriginalMessage(originalMsgURI, 0);
else
QuoteOriginalMessage(originalMsgURI, 2);
tempRes = QuoteOriginalMessage(originalMsgURI, 2);
if (NS_FAILED(tempRes))
LoadBody();
break;
}
}
@ -819,6 +825,7 @@ nsMsgCompose::QuoteOriginalMessage(const PRUnichar *originalMsgURI, PRInt32 what
if (oldQuoting)
{
mQuotingToFollow = PR_FALSE;
printf("nsMsgCompose: using old quoting function!");
mQuotingToFollow = PR_FALSE;
HackToGetBody(what);
@ -851,97 +858,98 @@ nsMsgCompose::QuoteOriginalMessage(const PRUnichar *originalMsgURI, PRInt32 what
void nsMsgCompose::HackToGetBody(PRInt32 what)
{
char *buffer = (char *) PR_CALLOC(16384);
if (buffer)
char *buffer = (char *) PR_CALLOC(16384);
if (buffer)
{
nsString fileName(TEMP_PATH_DIR);
fileName += TEMP_MESSAGE_IN;
nsFileSpec fileSpec(fileName);
nsInputFileStream fileStream(fileSpec);
nsString msgBody = (what == 2 && !m_composeHTML) ? "--------Original Message--------\r\n"
: "";
// skip RFC822 header
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open())
{
nsString fileName(TEMP_PATH_DIR);
fileName += TEMP_MESSAGE_IN;
nsFileSpec fileSpec(fileName);
nsInputFileStream fileStream(fileSpec);
nsString msgBody = (what == 2 && !m_composeHTML) ? "--------Original Message--------\r\n"
: "";
// skip RFC822 header
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open())
{
fileStream.readline(buffer, 1024);
if (*buffer == 0)
break;
}
// copy message body
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open())
{
fileStream.readline(buffer, 1024);
if (what == 1 && ! m_composeHTML)
msgBody += "> ";
msgBody += buffer;
msgBody += MSG_LINEBREAK;
}
if (m_composeHTML)
{
nsString lowerMsgBody (msgBody);
lowerMsgBody.ToLowerCase();
PRInt32 startBodyOffset;
PRInt32 endBodyOffset = -1;
PRInt32 offset;
startBodyOffset = lowerMsgBody.Find("<html>");
if (startBodyOffset != -1) //it's an HTML body
{
//Does it have a <body> tag?
offset = lowerMsgBody.Find("<body");
if (offset != -1)
{
offset = lowerMsgBody.Find('>', offset);
if (offset != -1)
{
startBodyOffset = offset + 1;
endBodyOffset = lowerMsgBody.RFind("</body>");
}
}
if (endBodyOffset == -1)
endBodyOffset = lowerMsgBody.RFind("</html>");
}
if (startBodyOffset == -1)
startBodyOffset = 0;
if (endBodyOffset == -1)
endBodyOffset = lowerMsgBody.Length();
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
if (startBodyOffset == 0)
{
msgBody.Insert("</html>", endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
}
msgBody.Insert("</blockquote>", endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
msgBody.Insert("<blockquote TYPE=CITE>", startBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
if (startBodyOffset == 0)
{
msgBody.Insert("<html>", startBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
msgBody.Insert("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">", startBodyOffset);
}
}
else
{
//ducarroz: today, we are not converting HTML to plain text if needed!
}
// m_compFields->SetBody(msgBody.ToNewCString());
// SetBody() strdup()'s cmsgBody.
m_compFields->SetBody(nsAutoCString(msgBody));
PR_Free(buffer);
fileStream.readline(buffer, 1024);
if (*buffer == 0)
break;
}
// copy message body
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open())
{
fileStream.readline(buffer, 1024);
if (what == 1 && ! m_composeHTML)
msgBody += "> ";
msgBody += buffer;
msgBody += MSG_LINEBREAK;
}
if (m_composeHTML)
{
nsString lowerMsgBody (msgBody);
lowerMsgBody.ToLowerCase();
PRInt32 startBodyOffset;
PRInt32 endBodyOffset = -1;
PRInt32 offset;
startBodyOffset = lowerMsgBody.Find("<html>");
if (startBodyOffset != -1) //it's an HTML body
{
//Does it have a <body> tag?
offset = lowerMsgBody.Find("<body");
if (offset != -1)
{
offset = lowerMsgBody.Find('>', offset);
if (offset != -1)
{
startBodyOffset = offset + 1;
endBodyOffset = lowerMsgBody.RFind("</body>");
}
}
if (endBodyOffset == -1)
endBodyOffset = lowerMsgBody.RFind("</html>");
}
if (startBodyOffset == -1)
startBodyOffset = 0;
if (endBodyOffset == -1)
endBodyOffset = lowerMsgBody.Length();
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
if (startBodyOffset == 0)
{
msgBody.Insert("</html>", endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
}
msgBody.Insert("</blockquote>", endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, endBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
msgBody.Insert("<blockquote TYPE=CITE>", startBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
if (startBodyOffset == 0)
{
msgBody.Insert("<html>", startBodyOffset);
msgBody.Insert(MSG_LINEBREAK, startBodyOffset);
msgBody.Insert("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">", startBodyOffset);
}
}
else
{
//ducarroz: today, we are not converting HTML to plain text if needed!
}
// m_compFields->SetBody(msgBody.ToNewCString());
// SetBody() strdup()'s cmsgBody.
m_compFields->SetBody(nsAutoCString(msgBody));
PR_Free(buffer);
}
LoadBody();
}

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

@ -30,7 +30,7 @@ static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define COMPOSE_BE_URL "resource:/res/mailnews/messenger/compose_be.properties"
#define COMPOSE_BE_URL "resource:/chrome/messengercompose/content/default/composebe_en.properties"
extern "C"
char *

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

@ -21,6 +21,26 @@
#include "nscore.h"
//
// The defines needed for error conditions. The corresponding strings
// are defined in composebe_en.properties
//
typedef enum {
NS_MSG_UNABLE_TO_OPEN_FILE = 12500,
NS_MSG_UNABLE_TO_OPEN_TMP_FILE,
NS_MSG_UNABLE_TO_SAVE_TEMPLATE,
NS_MSG_UNABLE_TO_SAVE_DRAFT,
NS_MSG_LOAD_ATTACHMNTS,
NS_MSG_LOAD_ATTACHMNT,
NS_MSG_COULDNT_OPEN_FCC_FILE,
NS_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS,
NS_MSG_ASSEMB_DONE_MSG,
NS_MSG_ASSEMBLING_MSG,
NS_MSG_NO_SENDER,
NS_MSG_NO_RECIPIENTS,
NS_MSG_ERROR_WRITING_FILE
} nsMsgComposeErrorIDs;
NS_BEGIN_EXTERN_C
char *ComposeBEGetStringByID(PRInt32 stringID);

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

@ -41,6 +41,7 @@ CopyListener::CopyListener(void)
CopyListener::~CopyListener(void)
{
this;
}
nsresult
@ -134,7 +135,7 @@ nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
PRBool isDraft = PR_FALSE;
if (!aMsgSendObj)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
// Store away the server location...
if (aSavePref)
@ -179,7 +180,7 @@ nsMsgCopy::DoCopy(nsIFileSpec *aDiskFile, nsIMsgFolder *dstFolder,
// Check sanity
if ((!aDiskFile) || (!dstFolder))
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
//Call copyservice with dstFolder, disk file, and txnManager
NS_WITH_SERVICE(nsIMsgCopyService, copyService, kMsgCopyServiceCID, &rv);
@ -187,7 +188,7 @@ nsMsgCopy::DoCopy(nsIFileSpec *aDiskFile, nsIMsgFolder *dstFolder,
{
mCopyListener = do_QueryInterface(new CopyListener());
if (!mCopyListener)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
mCopyListener->SetMsgComposeAndSendObject(aMsgSendObj);
rv = copyService->CopyFileMessage(aDiskFile, dstFolder, aMsgToReplace, aIsDraft,

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

@ -21,7 +21,7 @@
#include "nscore.h"
#include "nsIFileSpec.h"
#include "nsMsgComposeBE.h"
// RICHIE #include "nsMsgComposeBE.h"
#include "nsMsgSend.h"
#include "nsIMsgFolder.h"
#include "nsITransactionManager.h"

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

@ -73,7 +73,7 @@ CreateVcardAttachment()
name = PL_strdup (pCompPrefs.GetUserFullName());
// write out a content description string
#ifdef UNREADY_CODE
PR_snprintf(buf, sizeof(buf), XP_GetString (MK_ADDR_BOOK_CARD), name);
PR_snprintf(buf, sizeof(buf), XP_GetString (NS_ADDR_BOOK_CARD), name);
#endif
PR_FREEIF(name);
@ -107,7 +107,7 @@ CreateVcardAttachment()
{
vCardFileName = PL_strdup("vcard.vcf");
if (!vCardFileName)
return MK_OUT_OF_MEMORY;
return NS_OUT_OF_MEMORY;
}
char * origurl = XP_PlatformFileToURL (vCardFileName);
@ -125,7 +125,7 @@ CreateVcardAttachment()
PR_Malloc((datacount + 2) * sizeof(nsMsgAttachmentData));
}
if (!alist)
return MK_OUT_OF_MEMORY;
return NS_OUT_OF_MEMORY;
m_attachData = alist;
memset (m_attachData + datacount, 0, 2 * sizeof (nsMsgAttachmentData));
m_attachData[datacount].url = fileurl;
@ -145,7 +145,7 @@ CreateVcardAttachment()
}
if (!aflist)
return MK_OUT_OF_MEMORY;
return NS_OUT_OF_MEMORY;
m_attachedFiles = aflist;
memset (m_attachedFiles + filecount, 0, 2 * sizeof (nsMsgAttachedFile));
@ -538,7 +538,7 @@ MungeThroughRecipients(PRBool* someNonHTML,
delete m_htmlrecip;
m_htmlrecip = new nsMsgHTMLRecipients();
if (!m_htmlrecip) return MK_OUT_OF_MEMORY;
if (!m_htmlrecip) return NS_OUT_OF_MEMORY;
PRUint32 i;
for (i=0 ; i < sizeof(masks) / sizeof(masks[0]) ; i++) {
@ -547,7 +547,7 @@ MungeThroughRecipients(PRBool* someNonHTML,
char* value = NULL;
value = PL_strdup(orig);
if (!value) {
status = MK_OUT_OF_MEMORY;
status = NS_OUT_OF_MEMORY;
goto FAIL;
}
@ -615,10 +615,10 @@ MungeThroughRecipients(PRBool* someNonHTML,
}
#ifdef UNREADY_CODE
char* tmp = PR_smprintf("%s@%s",
XP_GetString(MK_MSG_EVERYONE),
XP_GetString(NS_MSG_EVERYONE),
domain);
#endif
if (!tmp) return MK_OUT_OF_MEMORY;
if (!tmp) return NS_OUT_OF_MEMORY;
status = m_htmlrecip->AddOne(domain, tmp, Domain, found);
PR_Free(tmp);
if (status < 0) goto FAIL;
@ -643,7 +643,7 @@ MungeThroughRecipients(PRBool* someNonHTML,
name = PL_strdup(groups);
if (end) *end++ = ',';
if (!name) {
status = MK_OUT_OF_MEMORY;
status = NS_OUT_OF_MEMORY;
goto FAIL;
}
char* group = XP_StripLine(name);
@ -653,7 +653,7 @@ MungeThroughRecipients(PRBool* someNonHTML,
if (status < 0) goto FAIL;
char* tmp = PL_strdup(group);
if (!tmp) {
status = MK_OUT_OF_MEMORY;
status = NS_OUT_OF_MEMORY;
goto FAIL;
}
@ -662,7 +662,7 @@ MungeThroughRecipients(PRBool* someNonHTML,
char* desc = PR_smprintf("%s.*", tmp);
if (!desc) {
status = MK_OUT_OF_MEMORY;
status = NS_OUT_OF_MEMORY;
goto FAIL;
}
status = m_htmlrecip->AddOne(tmp, desc, GroupHierarchy, found);

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

@ -27,7 +27,7 @@ nsresult
nsMsgDeliveryListener::OnStartRunningUrl(nsIURI * aUrl)
{
#ifdef NS_DEBUG
printf("Starting to run the delivery operation\n");
// printf("Starting to run the delivery operation\n");
#endif
if (mMsgSendObj)
@ -44,7 +44,7 @@ nsMsgDeliveryListener::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
{
nsresult rv;
#ifdef NS_DEBUG
printf("\nOnStopRunningUrl() called!\n");
// printf("\nOnStopRunningUrl() called!\n");
#endif
// First, stop being a listener since we are done.

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

@ -15,14 +15,20 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.h"
// as does this
#define NS_IMPL_IDS
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsISupports.h"
#include "nsIPref.h"
#include "nsIMimeConverter.h"
#include "msgCore.h"
#include "rosetta_mailnews.h"
#include "nsMsgI18N.h"
#include "nsFileSpec.h"
#include "nsFileStream.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID);
@ -224,6 +230,53 @@ PRBool nsMsgI18N7bit_data_part(const char *charset, const char *inString, const
return PR_TRUE; // all 7 bit
}
// Simple parser to parse META charset.
// It only supports the case when the description is within one line.
const char *
nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec)
{
static char charset[65];
char buffer[512];
nsInputFileStream fileStream(*fileSpec);
*charset = '\0';
while (!fileStream.eof() && !fileStream.failed() &&
fileStream.is_open()) {
fileStream.readline(buffer, 512);
if (*buffer == CR || *buffer == LF || *buffer == 0)
continue;
for (int i = 0; i < (int)PL_strlen(buffer); i++) {
buffer[i] = toupper(buffer[i]);
}
if (PL_strstr(buffer, "/HEAD"))
break;
if (PL_strstr(buffer, "META") &&
PL_strstr(buffer, "HTTP-EQUIV") &&
PL_strstr(buffer, "CONTENT-TYPE") &&
PL_strstr(buffer, "CHARSET")
)
{
char *cp = PL_strstr(PL_strstr(buffer, "CHARSET"), "=") + 1;
char seps[] = " \"\'";
char *token;
char* newStr;
token = nsCRT::strtok(cp, seps, &newStr);
if (token != NULL)
{
PL_strcpy(charset, token);
}
}
}
return charset;
}
// RICHIE - not sure about this one?? need to see what it did in the old
// world.
char *

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

@ -40,10 +40,13 @@ nsresult ConvertToUnicode(const nsString& aCharset,
nsresult nsMsgI18NDecodeMimePartIIStr(const nsString& header, nsString& charset, nsString& decodedString);
const char *nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec);
//
// THIS IS BAD STUFF...MAKE IT GO AWAY!!!
//
#include "intl_csi.h"
void nsMsgI18NDestroyCharCodeConverter(CCCDataObject);
unsigned char * nsMsgI18NCallCharCodeConverter(CCCDataObject,const unsigned char *,int32);
int nsMsgI18NGetCharCodeConverter(int16 ,int16 ,CCCDataObject);

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

@ -31,7 +31,7 @@ nsMsgDisplayMessageByID(PRInt32 msgID)
char *msg = ComposeBEGetStringByID(msgID);
if (!msg)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
@ -39,7 +39,7 @@ nsMsgDisplayMessageByID(PRInt32 msgID)
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
nsAutoString alertText(msg);
if (dialog)
@ -63,7 +63,7 @@ nsMsgDisplayMessageByString(char *msg)
nsresult rv;
if ((!msg) || (!*msg))
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
@ -71,7 +71,7 @@ nsMsgDisplayMessageByString(char *msg)
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
nsAutoString alertText(msg);
if (dialog)
@ -96,7 +96,7 @@ nsMsgAskBooleanQuestionByID(PRInt32 msgID, PRBool *answer)
char *msg = ComposeBEGetStringByID(msgID);
if (!msg)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
@ -104,7 +104,7 @@ nsMsgAskBooleanQuestionByID(PRInt32 msgID, PRBool *answer)
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
nsAutoString confirmText(msg);
if (dialog)
@ -131,7 +131,7 @@ nsMsgAskBooleanQuestionByID(char *msg, PRBool *answer)
PRInt32 result;
if ((!msg) || (!*msg))
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
#ifdef NECKO
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
@ -139,7 +139,7 @@ nsMsgAskBooleanQuestionByID(char *msg, PRBool *answer)
NS_WITH_SERVICE(nsINetSupportDialogService, dialog, kNetSupportDialogCID, &rv);
#endif
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_REGISTERED;
nsAutoString confirmText(msg);
if (dialog)

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

@ -182,7 +182,7 @@ SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
if (!tagData)
{
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
}
nsMsgQuote *ptr = (nsMsgQuote *) tagData;
@ -224,7 +224,7 @@ SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
{
NS_RELEASE(ptr);
printf("Failed to create nsIInputStream\n");
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
}
if (NS_FAILED(fileStream->OpenDiskFile(*(ptr->mTmpFileSpec))))
@ -239,7 +239,7 @@ SaveQuoteMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
{
NS_RELEASE(ptr);
printf("Unable to set the output stream for the mime parser...\ncould be failure to create internal libmime data\n");
return NS_ERROR_FAILURE;
return NS_ERROR_UNEXPECTED;
}
// Assuming this is an RFC822 message...
@ -266,7 +266,7 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, nsIOutputStream *outStream)
nsresult rv;
if (!msgURI)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
mOutStream = outStream;
mTmpFileSpec = nsMsgCreateTempFileSpec("nsquot.tmp");
@ -281,12 +281,12 @@ nsresult rv;
mURI = convertString.ToNewCString();
if (!mURI)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
rv = GetMessageServiceFromURI(mURI, &mMessageService);
if (NS_FAILED(rv) && !mMessageService)
{
return NS_ERROR_FAILURE;
return rv;
}
NS_ADDREF(this);
@ -296,13 +296,13 @@ nsresult rv;
{
ReleaseMessageServiceFromURI(mURI, mMessageService);
mMessageService = nsnull;
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
}
rv = mMessageService->SaveMessageToDisk(mURI, mTmpIFileSpec, PR_FALSE, sendListener, nsnull);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return NS_OK;
return rv;
else
return NS_OK;
}

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

@ -46,21 +46,9 @@
#include "nsIMsgCopyServiceListener.h"
#include "nsIFileSpec.h"
#include "nsMsgCopy.h"
#include "nsMsgTransition.h"
#include "nsMsgPrompts.h"
// RICHIE - StringBundle Converstion Place Holder ////////////////////////////
//
#define MK_MSG_MIME_OBJECT_NOT_AVAILABLE -9999
#define MK_ATTACHMENT_LOAD_FAILED -9998
#define MK_MAIL_FAILED_COPY_OPERATION -9997
#define MK_NEWS_FAILED_COPY_OPERATION -9996
#define MIME_MULTIPART_BLURB "This is a multi-part message in MIME format."
//
// RICHIE - StringBundle Converstion Place Holder ////////////////////////////
/* use these macros to define a class IID for our component. Our object currently supports two interfaces
(nsISupports and nsIMsgCompose) so we want to define constants for these two interfaces */
static NS_DEFINE_IID(kIMsgSend, NS_IMSGSEND_IID);
@ -149,6 +137,9 @@ char * mime_get_stream_write_buffer(void)
return mime_mailto_stream_write_buffer;
}
// Don't I18N this line...this is per the spec!
#define MIME_MULTIPART_BLURB "This is a multi-part message in MIME format."
/* All of the desired attachments have been written to individual temp files,
and we know what's in them. Now we need to make a final temp file of the
actual mail message, containing all of the other files after having been
@ -310,7 +301,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
nsOutputFileStream tempfile(*mHTMLFileSpec);
if (! tempfile.is_open())
{
status = MK_UNABLE_TO_OPEN_TMP_FILE;
status = NS_MSG_UNABLE_TO_OPEN_TMP_FILE;
goto FAIL;
}
@ -318,7 +309,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
if (status < int(m_attachment1_body_length))
{
if (status >= 0)
status = MK_MIME_ERROR_WRITING_FILE;
status = NS_MSG_ERROR_WRITING_FILE;
goto FAIL;
}
@ -365,7 +356,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
NS_ASSERTION (m_attachment_pending_count == 0, "m_attachment_pending_count != 0");
#ifdef UNREADY_CODE
FE_Progress(GetContext(), XP_GetString(MK_MSG_ASSEMBLING_MSG));
FE_Progress(GetContext(), XP_GetString(NS_MSG_ASSEMBLING_MSG));
#endif
/* First, open the message file.
@ -377,8 +368,8 @@ nsMsgComposeAndSend::GatherMimeAttachments()
mOutputFile = new nsOutputFileStream(*mTempFileSpec);
if (! mOutputFile->is_open())
{
status = MK_UNABLE_TO_OPEN_TMP_FILE;
nsMsgDisplayMessageByID(MK_UNABLE_TO_OPEN_TMP_FILE);
status = NS_MSG_UNABLE_TO_OPEN_TMP_FILE;
nsMsgDisplayMessageByID(NS_MSG_UNABLE_TO_OPEN_TMP_FILE);
goto FAIL;
}
@ -522,7 +513,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
MimeEncoderData *plaintext_enc = MIME_QPEncoderInit(mime_encoder_output_fn, this);
if (!plaintext_enc)
{
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
plainpart->SetEncoderData(plaintext_enc);
@ -755,7 +746,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
if (mOutputFile) {
/* If we don't do this check...ZERO length files can be sent */
if (mOutputFile->failed()) {
status = MK_MIME_ERROR_WRITING_FILE;
status = NS_MSG_ERROR_WRITING_FILE;
goto FAIL;
}
@ -765,7 +756,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
mOutputFile = nsnull;
#ifdef UNREADY_CODE
FE_Progress(GetContext(), XP_GetString(MK_MSG_ASSEMB_DONE_MSG));
FE_Progress(GetContext(), XP_GetString(NS_MSG_ASSEMB_DONE_MSG));
#endif
if (m_dont_deliver_p && mListenerArrayCount > 0)
@ -778,7 +769,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
delete mTempFileSpec;
mTempFileSpec = nsnull;
if (!mReturnFileSpec)
NotifyListenersOnStopSending(nsnull, NS_ERROR_FAILURE, nsnull, nsnull);
NotifyListenersOnStopSending(nsnull, NS_ERROR_OUT_OF_MEMORY, nsnull, nsnull);
else
NotifyListenersOnStopSending(nsnull, NS_OK, nsnull, mReturnFileSpec);
@ -817,7 +808,7 @@ FAIL:
return status;
FAILMEM:
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
@ -850,7 +841,7 @@ mime_write_message_body (nsMsgComposeAndSend *state,
if (PRInt32(state->mOutputFile->write(buf, size)) < size)
{
return MK_MIME_ERROR_WRITING_FILE;
return NS_MSG_ERROR_WRITING_FILE;
}
else
{
@ -866,8 +857,8 @@ mime_encoder_output_fn (const char *buf, PRInt32 size, void *closure)
}
int nsMsgComposeAndSend::HackAttachments(
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments)
const nsMsgAttachmentData *attachments,
const nsMsgAttachedFile *preloaded_attachments)
{
MWContext *x = NULL;
INTL_CharSetInfo c;
@ -896,7 +887,7 @@ int nsMsgComposeAndSend::HackAttachments(
//
m_attachments = (nsMsgAttachmentHandler *) new nsMsgAttachmentHandler[m_attachment_count];
if (! m_attachments)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
for (i = 0; i < m_attachment_count; i++)
{
@ -969,7 +960,7 @@ int nsMsgComposeAndSend::HackAttachments(
new nsMsgAttachmentHandler[m_attachment_count];
if (! m_attachments)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
for (i = 0; i < m_attachment_count; i++) {
m_attachments[i].m_mime_delivery_state = this;
@ -1029,9 +1020,9 @@ int nsMsgComposeAndSend::HackAttachments(
#ifdef UNREADY_CODE
if (m_attachment_count == 1)
FE_Progress(GetContext(), XP_GetString(MK_MSG_LOAD_ATTACHMNT));
FE_Progress(GetContext(), XP_GetString(NS_MSG_LOAD_ATTACHMNT));
else
FE_Progress(GetContext(), XP_GetString(MK_MSG_LOAD_ATTACHMNTS));
FE_Progress(GetContext(), XP_GetString(NS_MSG_LOAD_ATTACHMNTS));
#endif
for (i = 0; i < m_attachment_count; i++) {
@ -1056,7 +1047,7 @@ int nsMsgComposeAndSend::HackAttachments(
int nsMsgComposeAndSend::SetMimeHeader(MSG_HEADER_SET header, const char *value)
{
char * dupHeader = nsnull;
PRInt32 ret = MK_OUT_OF_MEMORY;
PRInt32 ret = NS_ERROR_OUT_OF_MEMORY;
if (header & (MSG_FROM_HEADER_MASK | MSG_TO_HEADER_MASK | MSG_REPLY_TO_HEADER_MASK | MSG_CC_HEADER_MASK | MSG_BCC_HEADER_MASK))
dupHeader = mime_fix_addr_header(value);
@ -1081,13 +1072,8 @@ nsMsgComposeAndSend::InitCompositionFields(nsMsgCompFields *fields)
nsresult rv = NS_OK;
const char *pStr = nsnull;
if (mCompFields)
mCompFields->Release();
mCompFields = new nsMsgCompFields;
if (mCompFields)
mCompFields->AddRef();
else
mCompFields = do_QueryInterface( new nsMsgCompFields());
if (!mCompFields)
return NS_ERROR_OUT_OF_MEMORY;
const char *cset = fields->GetCharacterSet();
@ -1213,8 +1199,8 @@ nsMsgComposeAndSend::Init(
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
const nsMsgAttachmentData *attachments,
const nsMsgAttachedFile *preloaded_attachments,
nsMsgSendPart *relatedPart)
{
nsresult rv = NS_OK;
@ -1392,9 +1378,9 @@ nsMsgComposeAndSend::DeliverFileAsMail()
if (!buf)
{
// RICHIE_TODO: message loss here
char *eMsg = ComposeBEGetStringByID(MK_OUT_OF_MEMORY);
Fail(MK_OUT_OF_MEMORY, eMsg);
NotifyListenersOnStopSending(nsnull, MK_OUT_OF_MEMORY, nsnull, nsnull);
char *eMsg = ComposeBEGetStringByID(NS_ERROR_OUT_OF_MEMORY);
Fail(NS_ERROR_OUT_OF_MEMORY, eMsg);
NotifyListenersOnStopSending(nsnull, NS_ERROR_OUT_OF_MEMORY, nsnull, nsnull);
PR_FREEIF(eMsg);
return NS_ERROR_OUT_OF_MEMORY;
}
@ -1642,12 +1628,6 @@ nsMsgComposeAndSend::Clear()
PR_FREEIF (m_attachment1_encoding);
PR_FREEIF (m_attachment1_body);
if (mCompFields)
{
mCompFields->Release();
mCompFields = nsnull;
}
if (m_attachment1_encoder_data)
{
MIME_EncoderDestroy(m_attachment1_encoder_data, PR_TRUE);
@ -1822,7 +1802,7 @@ nsMsgComposeAndSend::SetListenerArray(nsIMsgSendListener **aListenerArray)
// now allocate an array to hold the number of entries.
mListenerArray = (nsIMsgSendListener **) PR_Malloc(sizeof(nsIMsgSendListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
nsCRT::memset(mListenerArray, 0, (sizeof(nsIMsgSendListener *) * mListenerArrayCount));
@ -1846,7 +1826,7 @@ nsMsgComposeAndSend::AddListener(nsIMsgSendListener *aListener)
mListenerArray = (nsIMsgSendListener **)
PR_Realloc(*mListenerArray, sizeof(nsIMsgSendListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
else
return NS_OK;
}
@ -1855,7 +1835,7 @@ nsMsgComposeAndSend::AddListener(nsIMsgSendListener *aListener)
mListenerArrayCount = 1;
mListenerArray = (nsIMsgSendListener **) PR_Malloc(sizeof(nsIMsgSendListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
nsCRT::memset(mListenerArray, 0, (sizeof(nsIMsgSendListener *) * mListenerArrayCount));
@ -1877,7 +1857,7 @@ nsMsgComposeAndSend::RemoveListener(nsIMsgSendListener *aListener)
return NS_OK;
}
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
}
nsresult
@ -2053,8 +2033,8 @@ nsMsgComposeAndSend::CreateAndSendMessage(
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
const nsMsgAttachmentData *attachments,
const nsMsgAttachedFile *preloaded_attachments,
void *relatedPart,
nsIMsgSendListener **aListenerArray)
{
@ -2082,7 +2062,7 @@ nsresult
nsMsgComposeAndSend::SendMessageFile(
nsIMsgIdentity *aUserIndentity,
nsIMsgCompFields *fields,
nsFileSpec *sendFileSpec,
nsIFileSpec *sendIFileSpec,
PRBool deleteSendFileOnCompletion,
PRBool digest_p,
nsMsgDeliverMode mode,
@ -2092,16 +2072,30 @@ nsMsgComposeAndSend::SendMessageFile(
nsresult rv;
if (!fields)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
//
// First check to see if the external file we are sending is a valid file.
//
if (!sendIFileSpec)
return NS_ERROR_INVALID_ARG;
PRBool valid;
if (NS_FAILED(sendIFileSpec->isValid(&valid)))
return NS_ERROR_INVALID_ARG;
if (!valid)
return NS_ERROR_INVALID_ARG;
nsFileSpec *sendFileSpec = nsnull;
nsFileSpec tempFileSpec;
if (NS_FAILED(sendIFileSpec->GetFileSpec(&tempFileSpec)))
return NS_ERROR_UNEXPECTED;
sendFileSpec = new nsFileSpec(tempFileSpec);
if (!sendFileSpec)
return NS_ERROR_FAILURE;
if (!sendFileSpec->Exists())
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
// Setup the listeners...
SetListenerArray(aListenerArray);
@ -2111,7 +2105,7 @@ nsMsgComposeAndSend::SendMessageFile(
{
NS_NewFileSpecWithSpec(*sendFileSpec, &mReturnFileSpec);
if (!mReturnFileSpec)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
}
rv = Init(aUserIndentity, (nsMsgCompFields *)fields, sendFileSpec,
@ -2176,7 +2170,7 @@ nsMsgComposeAndSend::SendWebPage(nsIMsgIdentity *aUserIndenti
// First check to see if the fields are valid...
//
if ((!fields) || (!url) )
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
tmpPageData = BuildURLAttachmentData(url);
@ -2204,8 +2198,8 @@ nsMsgComposeAndSend::SendWebPage(nsIMsgIdentity *aUserIndenti
TEXT_PLAIN, //const char *attachment1_type,
msgBody, //const char *attachment1_body,
bodyLen, // PRUint32 attachment1_body_length,
tmpPageData, // const struct nsMsgAttachmentData *attachments,
nsnull, // const struct nsMsgAttachedFile *preloaded_attachments,
tmpPageData, // const nsMsgAttachmentData *attachments,
nsnull, // const nsMsgAttachedFile *preloaded_attachments,
nsnull, // void *relatedPart,
aListenerArray);
return rv;
@ -2230,7 +2224,7 @@ nsMsgComposeAndSend::SendToMagicFolder(nsMsgDeliverMode mode)
{
// RICHIE_TODO: message loss here
char *eMsg = ComposeBEGetStringByID(rv);
Fail(MK_OUT_OF_MEMORY, eMsg);
Fail(NS_ERROR_OUT_OF_MEMORY, eMsg);
NotifyListenersOnStopCopy(rv, nsnull);
PR_FREEIF(eMsg);
}
@ -2315,6 +2309,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
char *obuffer = 0;
PRInt32 n;
char *envelopeLine = nsMsgGetEnvelopeLine();
PRBool folderIsLocal = PR_TRUE;
//
// Create the file that will be used for the copy service!
@ -2327,7 +2322,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
if (!mCopyFileSpec)
{
delete tFileSpec;
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
}
nsOutputFileStream tempOutfile(mCopyFileSpec);
@ -2337,14 +2332,14 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
switch (mode)
{
case nsMsgSaveAsDraft:
status = MK_MSG_UNABLE_TO_SAVE_DRAFT;
status = NS_MSG_UNABLE_TO_SAVE_DRAFT;
break;
case nsMsgSaveAsTemplate:
status = MK_MSG_UNABLE_TO_SAVE_TEMPLATE;
status = NS_MSG_UNABLE_TO_SAVE_TEMPLATE;
break;
case nsMsgDeliverNow:
default:
status = MK_MSG_COULDNT_OPEN_FCC_FILE;
status = NS_MSG_COULDNT_OPEN_FCC_FILE;
break;
}
delete tFileSpec;
@ -2358,7 +2353,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
nsInputFileStream inputFile(*input_file);
if (!inputFile.is_open())
{
status = MK_UNABLE_TO_OPEN_FILE;
status = NS_MSG_UNABLE_TO_OPEN_FILE;
goto FAIL;
}
@ -2381,7 +2376,8 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
// First, we we need to put a Berkely "From - " delimiter at the head of
// the file for parsing...
//
if (envelopeLine)
folderIsLocal = MessageFolderIsLocal(mUserIdentity, mode, mCompFields->GetFcc());
if ( (envelopeLine) && (folderIsLocal) )
{
PRInt32 len = PL_strlen(envelopeLine);
@ -2408,7 +2404,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
// this status information for summary file regeneration for us.
if ( (mode == nsMsgQueueForLater || mode == nsMsgSaveAsDraft ||
mode == nsMsgSaveAsTemplate || mode == nsMsgDeliverNow) &&
MessageFolderIsLocal(mUserIdentity, mode, mCompFields->GetFcc())
folderIsLocal
)
{
char *buf = 0;
@ -2597,7 +2593,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
n += tempOutfile.write(NS_LINEBREAK, NS_LINEBREAK_LEN);
if (n != (PRInt32) (PL_strlen(ibuffer) + NS_LINEBREAK_LEN)) // write failed
{
status = MK_MIME_ERROR_WRITING_FILE;
status = NS_MSG_ERROR_WRITING_FILE;
goto FAIL;
}
}
@ -2608,7 +2604,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
n = tempOutfile.write(NS_LINEBREAK, NS_LINEBREAK_LEN);
if (n != NS_LINEBREAK_LEN) // write failed
{
status = MK_MIME_ERROR_WRITING_FILE;
status = NS_MSG_ERROR_WRITING_FILE;
goto FAIL;
}

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

@ -124,12 +124,11 @@
#include "rosetta_mailnews.h"
#include "nsFileStream.h"
#include "nsMsgMessageFlags.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsIMsgSend.h"
#include "nsIURL.h"
#include "nsMsgAttachmentHandler.h"
#include "nsMsgCompFields.h"
#include "nsMsgComposeBE.h"
#include "nsIMsgSendListener.h"
#if 0
#include "nsMsgCopy.h"
@ -237,8 +236,8 @@ public:
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
const nsMsgAttachmentData *attachments,
const nsMsgAttachedFile *preloaded_attachments,
nsMsgSendPart *relatedPart);
//
@ -284,8 +283,8 @@ public:
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
const nsMsgAttachmentData *attachments,
const nsMsgAttachedFile *preloaded_attachments,
void *relatedPart,
// This is an array of nsIMsgSendListener objects...there must
// be N+1 entries in the array with the final entry set to nsnull
@ -294,7 +293,7 @@ public:
NS_IMETHOD SendMessageFile(
nsIMsgIdentity *aUserIdentity,
nsIMsgCompFields *fields,
nsFileSpec *sendFileSpec,
nsIFileSpec *sendIFileSpec,
PRBool deleteSendFileOnCompletion,
PRBool digest_p,
nsMsgDeliverMode mode,
@ -311,34 +310,34 @@ public:
//
// All vars necessary for this implementation
//
nsIMsgIdentity *mUserIdentity;
nsMsgCompFields *mCompFields; // All needed composition fields (header, etc...)
nsFileSpec *mTempFileSpec; // our temporary file
nsCOMPtr<nsIMsgIdentity> mUserIdentity;
nsCOMPtr<nsMsgCompFields> mCompFields; // All needed composition fields (header, etc...)
nsFileSpec *mTempFileSpec; // our temporary file
nsOutputFileStream *mOutputFile; // the actual output file stream
nsOutputFileStream *mOutputFile; // the actual output file stream
PRBool m_dont_deliver_p; // If set, we just return the nsFileSpec of the file
// created, instead of actually delivering message.
nsMsgDeliverMode m_deliver_mode; // nsMsgDeliverNow, nsMsgQueueForLater, nsMsgSaveAsDraft,
// nsMsgSaveAsTemplate
nsIMessage *mMsgToReplace; // If the mode is nsMsgSaveAsDraft, this is the message it will
// replace
PRBool m_dont_deliver_p; // If set, we just return the nsFileSpec of the file
// created, instead of actually delivering message.
nsMsgDeliverMode m_deliver_mode; // nsMsgDeliverNow, nsMsgQueueForLater, nsMsgSaveAsDraft,
// nsMsgSaveAsTemplate
nsCOMPtr<nsIMessage> mMsgToReplace; // If the mode is nsMsgSaveAsDraft, this is the message it will
// replace
// These are needed for callbacks to the FE...
nsIMsgSendListener **mListenerArray;
PRInt32 mListenerArrayCount;
nsMsgDeliveryListener *mSendListener;
nsIMsgSendListener **mListenerArray;
PRInt32 mListenerArrayCount;
nsMsgDeliveryListener *mSendListener;
nsIFileSpec *mReturnFileSpec; // a holder for file spec's to be returned to caller
nsIFileSpec *mReturnFileSpec; // a holder for file spec's to be returned to caller
// File where we stored our HTML so that we could make the plaintext form.
nsFileSpec *mHTMLFileSpec;
nsFileSpec *mHTMLFileSpec;
//
// These variables are needed for message Copy operations!
//
nsIFileSpec *mCopyFileSpec;
nsMsgCopy *mCopyObj;
nsIFileSpec *mCopyFileSpec;
nsMsgCopy *mCopyObj;
//
// The first attachment, if any (typed in by the user.)

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

@ -43,6 +43,7 @@
#include "nsIMsgSendListener.h"
#include "nsIMsgSendLaterListener.h"
#include "nsMsgCopy.h"
#include "nsMsgComposeStringBundle.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
@ -187,7 +188,7 @@ nsMsgSendLater::RebufferLeftovers(char *startBuf, PRUint32 aLen)
PR_FREEIF(mLeftoverBuffer);
mLeftoverBuffer = (char *)PR_Malloc(aLen + 1);
if (!mLeftoverBuffer)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
nsCRT::memcpy(mLeftoverBuffer, startBuf, aLen);
mLeftoverBuffer[aLen] = '\0';
@ -430,7 +431,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
// Get the recipients...
if (NS_FAILED(mMessage->GetRecipients(recips)))
return NS_ERROR_FAILURE;
return NS_ERROR_UNEXPECTED;
else
mMessage->GetCCList(ccList);
@ -439,7 +440,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
(void **) getter_AddRefs(compFields));
if (NS_FAILED(res) || !compFields)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
}
// Get the message send interface
@ -447,7 +448,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
(void **) getter_AddRefs(pMsgSend));
if (NS_FAILED(res) || !pMsgSend)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
}
// Since we have already parsed all of the headers, we are simply going to
@ -476,7 +477,7 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
mSendListener = new SendOperationListener();
if (!mSendListener)
{
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(mSendListener);
@ -486,21 +487,23 @@ nsCOMPtr<nsIMsgSend> pMsgSend = nsnull;
if (!tArray)
{
NS_RELEASE(mSendListener);
return NS_ERROR_FAILURE;
mSendListener = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(this);
rv = pMsgSend->SendMessageFile(mIdentity,
compFields, // nsIMsgCompFields *fields,
mTempFileSpec, // nsFileSpec *sendFileSpec,
mTempIFileSpec, // nsIFileSpec *sendFileSpec,
PR_TRUE, // PRBool deleteSendFileOnCompletion,
PR_FALSE, // PRBool digest_p,
nsMsgDeliverNow, // nsMsgDeliverMode mode,
nsnull, // nsIMessage *msgToReplace,
tArray);
NS_RELEASE(mSendListener);
mSendListener = nsnull;
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return rv;
return NS_OK;
}
@ -539,20 +542,20 @@ nsMsgSendLater::StartNextMailFileSend()
rv = mEnumerator->CurrentItem(getter_AddRefs(currentItem));
if (NS_FAILED(rv))
{
return NS_ERROR_FAILURE;
return rv;
}
mMessage = do_QueryInterface(currentItem);
if(!mMessage)
{
return NS_ERROR_FAILURE;
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsIRDFResource> myRDFNode ;
myRDFNode = do_QueryInterface(mMessage, &rv);
if(NS_FAILED(rv) || (!myRDFNode))
{
return NS_ERROR_FAILURE;
return NS_ERROR_NOT_AVAILABLE;
}
myRDFNode->GetValue(&aMessageURI);
@ -583,7 +586,7 @@ nsMsgSendLater::StartNextMailFileSend()
nsIMsgMessageService * messageService = nsnull;
rv = GetMessageServiceFromURI(aMessageURI, &messageService);
if (NS_FAILED(rv) && !messageService)
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
++mTotalSendCount;
@ -613,18 +616,17 @@ nsMsgSendLater::StartNextMailFileSend()
if (!mSaveListener)
{
ReleaseMessageServiceFromURI(aMessageURI, messageService);
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(mSaveListener);
mSaveListener->SetMsgSendLaterObject(this);
rv = messageService->SaveMessageToDisk(aMessageURI, mHackTempIFileSpec, PR_FALSE, mSaveListener, nsnull);
ReleaseMessageServiceFromURI(aMessageURI, messageService);
// RICHIE NS_RELEASE(mSendListener); - this is causing us grief! Looks like messageService is not addref'ing
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
return rv;
return NS_OK;
}
@ -662,9 +664,10 @@ nsresult
nsMsgSendLater::SendUnsentMessages(nsIMsgIdentity *identity,
nsIMsgSendLaterListener **listenerArray)
{
if (!identity)
return NS_ERROR_INVALID_ARG;
mIdentity = identity;
if (!mIdentity)
return NS_ERROR_FAILURE;
NS_ADDREF(mIdentity);
// Set the listener array
@ -673,11 +676,19 @@ nsMsgSendLater::SendUnsentMessages(nsIMsgIdentity *identity,
mMessageFolder = GetUnsentMessagesFolder(mIdentity);
if (!mMessageFolder)
{
NS_RELEASE(mIdentity);
mIdentity = nsnull;
return NS_ERROR_FAILURE;
}
nsresult ret = mMessageFolder->GetMessages(&mEnumerator);
if (NS_FAILED(ret) || (!mEnumerator))
{
NS_RELEASE(mIdentity);
mIdentity = nsnull;
return NS_ERROR_FAILURE;
}
mFirstTime = PR_TRUE;
return StartNextMailFileSend();
@ -693,7 +704,7 @@ nsMsgSendLater::DeleteCurrentMessage()
(void **) getter_AddRefs(msgArray));
if (NS_FAILED(res) || !msgArray)
{
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
}
msgArray->InsertElementAt(mMessage, 0);
@ -933,7 +944,7 @@ nsMsgSendLater::DriveFakeStream(nsIOutputStream *stream)
inFile = new nsIOFileStream(*mHackTempFileSpec);
if (!inFile)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
m_headersFP = 0;
inFile->seek(0);
@ -968,7 +979,7 @@ DoGrowBuffer(PRInt32 desired_size, PRInt32 element_size, PRInt32 quantum,
: (char *) PR_Malloc ((*size + increment)
* (element_size / sizeof(char))));
if (! new_buf)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
*buffer = new_buf;
*size += increment;
}
@ -1031,14 +1042,14 @@ nsMsgSendLater::DeliverQueuedLine(char *line, PRInt32 length)
mOutFile = new nsOutputFileStream(*mTempFileSpec, PR_WRONLY | PR_CREATE_FILE);
if ( (!mOutFile) || (!mOutFile->is_open()) )
return MK_MIME_ERROR_WRITING_FILE;
return NS_MSG_ERROR_WRITING_FILE;
nsresult status = BuildHeaders();
if (NS_FAILED(status))
return status;
if (mOutFile->write(m_headers, m_headersFP) != m_headersFP)
return MK_MIME_ERROR_WRITING_FILE;
return NS_MSG_ERROR_WRITING_FILE;
}
else
{
@ -1067,7 +1078,7 @@ nsMsgSendLater::DeliverQueuedLine(char *line, PRInt32 length)
{
PRInt32 wrote = mOutFile->write(line, length);
if (wrote < (PRInt32) length)
return MK_MIME_ERROR_WRITING_FILE;
return NS_MSG_ERROR_WRITING_FILE;
}
}
@ -1093,7 +1104,7 @@ nsMsgSendLater::SetListenerArray(nsIMsgSendLaterListener **aListenerArray)
// now allocate an array to hold the number of entries.
mListenerArray = (nsIMsgSendLaterListener **) PR_Malloc(sizeof(nsIMsgSendLaterListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
nsCRT::memset(mListenerArray, 0, (sizeof(nsIMsgSendLaterListener *) * mListenerArrayCount));
@ -1117,7 +1128,7 @@ nsMsgSendLater::AddListener(nsIMsgSendLaterListener *aListener)
mListenerArray = (nsIMsgSendLaterListener **)
PR_Realloc(*mListenerArray, sizeof(nsIMsgSendLaterListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
else
return NS_OK;
}
@ -1126,7 +1137,7 @@ nsMsgSendLater::AddListener(nsIMsgSendLaterListener *aListener)
mListenerArrayCount = 1;
mListenerArray = (nsIMsgSendLaterListener **) PR_Malloc(sizeof(nsIMsgSendLaterListener *) * mListenerArrayCount);
if (!mListenerArray)
return NS_ERROR_FAILURE;
return NS_ERROR_OUT_OF_MEMORY;
nsCRT::memset(mListenerArray, 0, (sizeof(nsIMsgSendLaterListener *) * mListenerArrayCount));
@ -1148,7 +1159,7 @@ nsMsgSendLater::RemoveListener(nsIMsgSendLaterListener *aListener)
return NS_OK;
}
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
}
nsresult

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

@ -27,7 +27,7 @@
#include "nsMsgCompUtils.h"
#include "nsFileStream.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
// defined in msgCompGlue.cpp
static char *mime_mailto_stream_read_buffer = 0;
@ -104,7 +104,7 @@ int nsMsgSendPart::CopyString(char** dest, const char* src)
else
*dest = PL_strdup(src);
return *dest? 0 : MK_OUT_OF_MEMORY;
return *dest? 0 : NS_ERROR_OUT_OF_MEMORY;
}
@ -112,8 +112,9 @@ int nsMsgSendPart::SetFile(nsFileSpec *filename)
{
m_filespec = new nsFileSpec(*filename);
if (!m_filespec)
return NS_ERROR_FAILURE;
return NS_OK;
return NS_ERROR_OUT_OF_MEMORY;
else
return NS_OK;
}
@ -128,7 +129,7 @@ int nsMsgSendPart::SetType(const char* type)
{
PR_FREEIF(m_type);
m_type = PL_strdup(type);
return m_type ? 0 : MK_OUT_OF_MEMORY;
return m_type ? 0 : NS_ERROR_OUT_OF_MEMORY;
}
@ -162,7 +163,7 @@ int nsMsgSendPart::AppendOtherHeaders(const char* more)
char* tmp = (char *) PR_Malloc(sizeof(char) * (PL_strlen(m_other) + PL_strlen(more) + 2));
if (!tmp)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
PL_strcpy(tmp, m_other);
PL_strcat(tmp, more);
@ -189,7 +190,7 @@ int nsMsgSendPart::AddChild(nsMsgSendPart* child)
{
m_numchildren++;
nsMsgSendPart** tmp = new nsMsgSendPart* [m_numchildren];
if (tmp == NULL) return MK_OUT_OF_MEMORY;
if (tmp == NULL) return NS_ERROR_OUT_OF_MEMORY;
for (int i=0 ; i<m_numchildren-1 ; i++) {
tmp[i] = m_children[i];
}
@ -308,7 +309,7 @@ int nsMsgSendPart::PushBody(char* buffer, PRInt32 length)
buffer = mime_get_stream_write_buffer();
if (!buffer) return MK_OUT_OF_MEMORY;
if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
NS_ASSERTION(encoded_data != buffer, "encoded_data == buffer");
out = buffer;
@ -395,19 +396,19 @@ itself. (This relies on the fact that all body-related headers begin with
*message_headers = (char *)PR_Malloc(L+1);
if (!*message_headers)
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
*content_headers = (char *)PR_Malloc(L+1);
if (!*content_headers) {
PR_Free(*message_headers);
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
*content_type_header = (char *)PR_Malloc(L+1);
if (!*content_type_header) {
PR_Free(*message_headers);
PR_Free(*content_headers);
return MK_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
}
message_tail = *message_headers;
@ -612,7 +613,7 @@ int nsMsgSendPart::Write()
if (!content_type_header) {
if (content_headers)
PR_Free(content_headers);
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
}
@ -628,7 +629,7 @@ int nsMsgSendPart::Write()
if (!separator) {
separator = mime_make_separator("");
if (!separator) {
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
}
@ -645,7 +646,7 @@ int nsMsgSendPart::Write()
if (!ct2) {
if (content_headers)
PR_Free(content_headers);
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
@ -697,7 +698,7 @@ int nsMsgSendPart::Write()
mime_mailto_stream_read_buffer = (char *)
PR_Malloc(MIME_BUFFER_SIZE);
if (!mime_mailto_stream_read_buffer) {
status = MK_OUT_OF_MEMORY;
status = NS_ERROR_OUT_OF_MEMORY;
goto FAIL;
}
}

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

@ -24,7 +24,7 @@
#include "net.h" /* should be defined into msgCore.h? */
#include "intl_csi.h"
#include "msgcom.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsMsgZapIt.h"
#include "nsMsgSend.h"

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

@ -16,37 +16,44 @@
* Reserved.
*/
#ifndef _MsgCompose_H_
#define _MsgCompose_H_
//
// The goal is to get this file to ZERO and then all old world stuff will
// be gone...we're getting much closer :-)
//
#include "msgCore.h"
#include "prprf.h" /* should be defined into msgCore.h? */
#include "net.h" /* should be defined into msgCore.h? */
#include "MailNewsTypes.h"
#include "intl_csi.h"
#ifndef _nsMsgTransition_h_
#define _nsMsgTransition_h_
#define NS_IMPL_IDS
#include "mimeenc.h"
#include "xpgetstr.h"
#include "xp_qsort.h"
#include "msgcom.h"
#include "rosetta_mailnews.h"
#include "nsMsgZapIt.h"
#include "MsgCompGlue.h"
#include "nsMsgHeaderMasks.h"
#include "nsMsgFolderFlags.h"
#include "nsMsgCompFields.h"
#include "nsIMsgCompose.h"
#include "nsMsgSend.h"
// These are transitional defines that will go away when we
// define new NS_... error codes...nsSmptProtocol.cpp is the last
// holdout.
//
#define MK_SMTP_SERVER_ERROR -234
#define MK_TCP_READ_ERROR -252
#define MK_COULD_NOT_LOGIN_TO_SMTP_SERVER -229
#define MK_COULD_NOT_GET_USERS_MAIL_ADDRESS -235
#define MK_OUT_OF_MEMORY -207
#define MK_POP3_PASSWORD_UNDEFINED -313
#define MK_ERROR_SENDING_FROM_COMMAND -230
#define MK_ERROR_SENDING_RCPT_COMMAND -231
#define MK_ERROR_SENDING_DATA_COMMAND -232
#define MK_ERROR_SENDING_MESSAGE -233
#define MK_MIME_NO_RECIPIENTS -267
/* The MSG_REPLY_TYPE shares the same space as MSG_CommandType, to avoid
possible weird errors, but is restricted to the `composition' commands
(MSG_ReplyToSender through MSG_ForwardMessage.)
*/
typedef MSG_CommandType MSG_REPLY_TYPE;
class MSG_Pane
{
public:
void *unused;
};
#define MIME_MakeFromField(a) PL_strdup("testmsg@netscape.com")
struct MSG_AttachedFile;
typedef struct PrintSetup_ PrintSetup;
typedef struct _XPDialogState XPDialogState;
HJ08142
class MSG_NewsHost;
class MSG_HTMLRecipients;
#endif /* _MsgCompose_H_ */
#endif /* _nsMsgTransition_h_ */

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

@ -16,7 +16,7 @@
* Reserved.
*/
#include "msgCore.h"
#include "MsgCompGlue.h" // need this to get MK_ defines...
#include "nsMsgTransition.h" // need this to get MK_ defines...
#include "nsSmtpProtocol.h"
#include "nscore.h"
@ -497,7 +497,7 @@ PRInt32 nsSmtpProtocol::SendHeloResponse(nsIInputStream * inputStream, PRUint32
if(!userAddress)
{
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(m_runningURL);
url->SetErrorMessage(NET_ExplainErrorDetails(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS));
url->SetErrorMessage(NET_ExplainErrorDetails(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS));
return(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS);
}
@ -1261,7 +1261,7 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI * aURL, nsISupports * /* aConsumer */)
*/
if (addrs1 && *addrs1)
{
rv = parser->ParseHeaderAddresses(nsnull, addrs1, nsnull, &addrs2, m_addressesLeft);
rv = parser->ParseHeaderAddresses(nsnull, addrs1, nsnull, &addrs2, &m_addressesLeft);
PR_FREEIF (addrs1);
}

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

@ -131,7 +131,7 @@ nsURLFetcher::OnDataAvailable(nsIURI* aURL, nsIInputStream *aIStream,
PRUint32 wroteIt;
if (!mOutStream)
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
char *buf = (char *)PR_Malloc(aLength);
if (!buf)
@ -247,7 +247,7 @@ nsURLFetcher::FireURLRequest(nsIURI *aURL, nsOutputFileStream *fOut,
if ( (!aURL) || (!fOut) )
{
return NS_ERROR_FAILURE;
return NS_ERROR_INVALID_ARG;
}
if (!fOut->is_open())
@ -259,13 +259,13 @@ nsURLFetcher::FireURLRequest(nsIURI *aURL, nsOutputFileStream *fOut,
(nsISupports **)&mNetService);
if ((rv != NS_OK) || (!mNetService))
{
return NS_ERROR_FAILURE;
return NS_ERROR_FACTORY_NOT_LOADED;
}
if (NS_FAILED(mNetService->OpenStream(aURL, this)))
{
nsServiceManager::ReleaseService(kNetServiceCID, mNetService);
return NS_ERROR_FAILURE;
return NS_ERROR_UNEXPECTED;
}
mURL = aURL;

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

@ -1,3 +1,8 @@
// as does this
#define NS_IMPL_IDS
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsCOMPtr.h"
#include "msgCore.h"
#include "nsMsgBaseCID.h"
@ -17,7 +22,6 @@
#include "nsIMsgCompFields.h"
#include "nsIMsgSend.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nscore.h"
#include "nsIMsgMailSession.h"
#include "nsINetSupportDialogService.h"
@ -38,12 +42,11 @@
#include "nsIEventQueue.h"
#include "nsIFileLocator.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsCRT.h"
#include "prmem.h"
#include "nsIMimeURLUtils.h"
#include "nsICharsetConverterManager.h"
#ifdef XP_PC
#define NETLIB_DLL "netlib.dll"
@ -66,10 +69,6 @@
#endif
#endif
// {588595CB-2012-11d3-8EF0-00A024A7D144}
#define CONV_CID { 0x1e3f79f1, 0x6b6b, 0x11d2, { 0x8a, 0x86, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 } };
#define CONV_IID { 0x1e3f79f0, 0x6b6b, 0x11d2, { 0x8a, 0x86, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 } }
/////////////////////////////////////////////////////////////////////////////////
// Define keys for all of the interfaces we are going to require for this test
/////////////////////////////////////////////////////////////////////////////////
@ -94,9 +93,7 @@ static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
static NS_DEFINE_CID(kGenericFactoryCID, NS_GENERICFACTORY_CID);
static NS_DEFINE_CID(kAllocatorCID, NS_ALLOCATOR_CID);
// I18N
static NS_DEFINE_CID(charsetCID, CONV_CID);
NS_DEFINE_IID(kConvMeIID, CONV_IID);
PRBool keepOnRunning = PR_TRUE;
nsICharsetConverterManager *ccMan = nsnull;
@ -238,31 +235,12 @@ in RED!</font></font></b>\n\
</body>\n\
</html>"};
nsresult
CallMe(nsresult aExitCode, void *tagData, nsFileSpec *fs)
{
char *buf = (char *)tagData;
printf("Called ME!\n");
printf("Exit code = %d\n", aExitCode);
printf("What were the magic words => [%s]\n", buf);
PR_FREEIF(buf);
if (fs)
{
printf("Delivery NOT Requested: Just created an RFC822 file. URL=[%s]\n", fs->GetCString());
delete fs;
}
return NS_OK;
}
static nsresult
SetupRegistry(void)
{
// i18n
nsComponentManager::RegisterComponent(charsetCID, NULL, NULL, UNICHAR_DLL, PR_FALSE, PR_FALSE);
nsresult res = nsServiceManager::GetService(charsetCID, kConvMeIID, (nsISupports **)&ccMan);
nsComponentManager::RegisterComponent(kCharsetConverterManagerCID, NULL, NULL, UNICHAR_DLL, PR_FALSE, PR_FALSE);
nsresult res = nsServiceManager::GetService(kCharsetConverterManagerCID, nsICharsetConverterManager::GetIID(), (nsISupports **)&ccMan);
if (NS_FAILED(res))
{
printf("ERROR at GetService() code=0x%x.\n",res);
@ -403,8 +381,8 @@ int main(int argc, char *argv[])
if (rv == NS_OK && pMsgCompFields)
{
pMsgCompFields->SetFrom(nsAutoString(", rhp@netscape.com, ").GetUnicode());
//pMsgCompFields->SetTo(nsAutoString("rhp@netscape.com").GetUnicode());
pMsgCompFields->SetNewsgroups(nsAutoString("news://news.mozilla.org./netscape.test").GetUnicode());
pMsgCompFields->SetTo(nsAutoString("rhp@netscape.com").GetUnicode());
//pMsgCompFields->SetNewsgroups(nsAutoString("news://news.mozilla.org./netscape.test").GetUnicode());
pMsgCompFields->SetSubject(nsAutoString("[spam] test").GetUnicode());
// pMsgCompFields->SetTheForcePlainText(PR_TRUE, &rv);
pMsgCompFields->SetBody(nsAutoString(email).GetUnicode());
@ -453,7 +431,7 @@ int main(int argc, char *argv[])
#ifdef XP_PC
printf("Sitting in an event processing loop ...Hit Cntl-C to exit...");
while (1)
while (keepOnRunning)
{
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
@ -468,7 +446,6 @@ int main(int argc, char *argv[])
pMsgSend->Release();
pMsgCompFields->Release();
return 0;
}

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

@ -25,7 +25,7 @@
#include "nsIEventQueueService.h"
#include "nsIEventQueue.h"
#include "nsIFileLocator.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsCRT.h"
#include "prmem.h"
#include "nsIMimeURLUtils.h"
@ -316,6 +316,7 @@ int main(int argc, char *argv[])
nsIMsgSend *pMsgSend;
nsresult rv = NS_OK;
nsFileSpec *mailFile = nsnull;
nsIFileSpec *mailIFile = nsnull;
nsComponentManager::RegisterComponent(kNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE);
nsComponentManager::RegisterComponent(kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);
@ -381,6 +382,10 @@ int main(int argc, char *argv[])
return 0;
}
NS_NewFileSpecWithSpec(*mailFile, &mailIFile);
if (!mailIFile)
return NS_ERROR_FAILURE;
rv = nsComponentManager::CreateInstance(kMsgSendCID, NULL, kIMsgSendIID, (void **) &pMsgSend);
if (rv == NS_OK && pMsgSend)
{
@ -389,7 +394,9 @@ int main(int argc, char *argv[])
(void **) &pMsgCompFields);
if (rv == NS_OK && pMsgCompFields)
{
pMsgCompFields->SetTo("rhp@netscape.com", NULL);
const char *to = "rhp@netscape.com";
pMsgCompFields->SetTo(nsString(to).GetUnicode());
// Create the listener for the send operation...
SendOperationListener *mSendListener = new SendOperationListener();
@ -408,7 +415,7 @@ int main(int argc, char *argv[])
pMsgSend->SendMessageFile(GetHackIdentity(), // identity...
pMsgCompFields, // nsIMsgCompFields *fields,
mailFile, // nsFileSpec *sendFileSpec,
mailIFile, // nsFileSpec *sendFileSpec,
PR_TRUE, // PRBool deleteSendFileOnCompletion,
PR_FALSE, // PRBool digest_p,
nsMsgDeliverNow, // nsMsgDeliverMode mode,

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

@ -21,6 +21,11 @@
The program takes a single parameter: url to fetch
*/
// as does this
#define NS_IMPL_IDS
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsCOMPtr.h"
#include "nsIURL.h"
#include "nsIEventQueueService.h"
@ -28,13 +33,11 @@
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIStreamListener.h"
#include "nsFileStream.h"
#include "nsFileSpec.h"
#include "nsMimeTypes.h"
#include "nsIPref.h"
#include "nsICharsetConverterManager.h"
#include "prprf.h"
#include "nsIAllocator.h" // for the CID
#include "nsURLFetcher.h"
@ -66,16 +69,6 @@
#define UNICHAR_DLL "UNICHARUTIL_DLL"
#endif
// {588595CB-2012-11d3-8EF0-00A024A7D144}
#define CONV_CID { 0x1e3f79f1, 0x6b6b, 0x11d2, { 0x8a, 0x86, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 } };
#define CONV_IID { 0x1e3f79f0, 0x6b6b, 0x11d2, { 0x8a, 0x86, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 } }
// CIDs
// I18N
static NS_DEFINE_CID(charsetCID, CONV_CID);
NS_DEFINE_IID(kConvMeIID, CONV_IID);
// prefs
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -92,8 +85,8 @@ static nsresult
SetupRegistry(void)
{
// i18n
nsComponentManager::RegisterComponent(charsetCID, NULL, NULL, UNICHAR_DLL, PR_FALSE, PR_FALSE);
nsresult res = nsServiceManager::GetService(charsetCID, kConvMeIID, (nsISupports **)&ccMan);
nsComponentManager::RegisterComponent(kCharsetConverterManagerCID, NULL, NULL, UNICHAR_DLL, PR_FALSE, PR_FALSE);
nsresult res = nsServiceManager::GetService(kCharsetConverterManagerCID, nsICharsetConverterManager::GetIID(), (nsISupports **)&ccMan);
if (NS_FAILED(res))
{
printf("ERROR at GetService() code=0x%x.\n",res);

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

@ -18,6 +18,6 @@
DEPTH=..\..\..
DIRS=compose smtp sendpage
#DIRS=$(DIRS) compose2 geturl sendlater
DIRS=$(DIRS) compose2 geturl sendlater
include <$(DEPTH)\config\rules.mak>

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

@ -32,7 +32,7 @@
#include "nsIEventQueue.h"
#include "nsIFileLocator.h"
#include "MsgCompGlue.h"
#include "nsMsgTransition.h"
#include "nsCRT.h"
#include "prmem.h"

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

@ -268,7 +268,11 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI, nsIFileS
// unimplemented for imap right now....if we feel it would be useful to
// be able to spool an imap message to disk then this is the method we need to implement.
nsresult rv = NS_OK;
//
// Returning success causes us much grief with the editor because we wait until this is
// complete to do anything...so changing this to failure.
//
nsresult rv = NS_ERROR_FAILURE;
return rv;
}

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

@ -1148,7 +1148,7 @@ int nsParseMailMessageState::FinalizeHeaders()
char *names;
char *addresses;
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, recipient->value, &names, &addresses, numAddresses);
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, recipient->value, &names, &addresses, &numAddresses);
if (ret == NS_OK)
{
m_newMsgHdr->SetRecipientsArray(names, addresses, numAddresses);
@ -1164,7 +1164,7 @@ int nsParseMailMessageState::FinalizeHeaders()
char *names;
char *addresses;
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, ccList->value, &names, &addresses, numAddresses);
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, ccList->value, &names, &addresses, &numAddresses);
if (ret == NS_OK)
{
m_newMsgHdr->SetCCListArray(names, addresses, numAddresses);

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

@ -23,9 +23,12 @@ MODULE = mime
include $(DEPTH)/config/autoconf.mk
XPIDLSRCS = \
$(NULL)
EXPORTS = \
nsIMimeConverter.h \
nsIStreamConverter.h \
nsIMimeConverter.idl \
nsIMimeObjectClassAccess.h \
nsIMimeEmitter.h \
nsMailHeaders.h \

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

@ -18,15 +18,18 @@
DEPTH=..\..\..
MODULE=mime
XPIDLSRCS = \
.\nsIMimeURLUtils.idl \
.\nsIMsgHeaderParser.idl \
$(NULL)
EXPORTS = \
nsIStreamConverter.h \
nsIMimeObjectClassAccess.h \
nsIMimeConverter.h \
nsIMimeConverter.h \
nsIMimeEmitter.h \
nsMailHeaders.h \
nsIMsgHeaderParser.h \
nsIMimeContentTypeHandler.h \
NSIMimeURLUtils.h \
nsIStreamConverter.h \
$(NULL)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -38,7 +38,7 @@ ParseRFC822Addresses (const char *line,
(void **) getter_AddRefs(pHeader));
if (NS_SUCCEEDED(res) && pHeader)
{
pHeader->ParseHeaderAddresses(NULL, line, names, addresses, numAddresses);
pHeader->ParseHeaderAddresses(NULL, line, names, addresses, &numAddresses);
return numAddresses;
}

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

@ -149,6 +149,8 @@
#define PARAM_X_MAC_CREATOR "x-mac-creator"
#define PARAM_X_MAC_TYPE "x-mac-type"
#define UNKNOWN_CONTENT_TYPE "application/x-unknown-content-type"
#define UNKNOWN_CONTENT_TYPE "application/x-unknown-content-type"
#define APPLICATION_DIRECTORY "application/directory" /* text/x-vcard is synonym */
#endif /* nsMimeTypes_h_ */

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

@ -433,7 +433,7 @@ IsThisAnAmbitiousLinkType(char *link, char *mailToTag, char **linkPrefix)
}
nsresult
nsMimeURLUtils::ScanForURLs(const char *input, int32 input_size,
nsMimeURLUtils::ScanForURLs(const char *input, PRInt32 input_size,
char *output, int output_size, PRBool urls_only)
{
int col = 0;
@ -835,7 +835,7 @@ nsMimeURLUtils::ReduceURL (char *url, char **retURL)
* Always returns a malloc'd string or NULL on out of memory error
*/
nsresult
nsMimeURLUtils::MakeAbsoluteURL(char * absolute_url, char * relative_url, char **retURL)
nsMimeURLUtils::MakeAbsoluteURL(char * absolute_url, const char * relative_url, char **retURL)
{
char * ret_url=0;
int new_length;
@ -1157,7 +1157,7 @@ nsMimeURLUtils::MakeAbsoluteURL(char * absolute_url, char * relative_url, char *
}
static void
Append(char** output, int32* output_max, char** curoutput, const char* buf, int32 length)
Append(char** output, PRInt32* output_max, char** curoutput, const char* buf, PRInt32 length)
{
if (length + (*curoutput) - (*output) >= *output_max) {
int offset = (*curoutput) - (*output);
@ -1177,10 +1177,10 @@ nsMimeURLUtils::ScanHTMLForURLs(const char* input, char **retBuf)
{
char* output = NULL;
char* curoutput;
int32 output_max;
PRInt32 output_max;
char* tmpbuf = NULL;
int32 tmpbuf_max;
int32 inputlength;
PRInt32 tmpbuf_max;
PRInt32 inputlength;
const char* inputend;
const char* linestart;
const char* lineend;

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

@ -35,20 +35,20 @@ public:
/* this macro defines QueryInterface, AddRef and Release for this class */
NS_DECL_ISUPPORTS
static const nsIID& GetIID(void) { static nsIID iid = NS_IMIME_URLUTILS_IID; return iid; }
static const nsIID& GetIID(void) { static nsIID iid = NS_IMIMEURLUTILS_IID; return iid; }
NS_IMETHOD URLType(const char *URL, PRInt32 *retType);
NS_IMETHOD ReduceURL (char *url, char **retURL);
NS_IMETHOD ScanForURLs(const char *input, int32 input_size,
char *output, int output_size, PRBool urls_only);
NS_IMETHOD ScanForURLs(const char *input, PRInt32 input_size,
char *output, PRInt32 output_size, PRBool urls_only);
NS_IMETHOD MakeAbsoluteURL(char * absolute_url, char * relative_url, char **retURL);
NS_IMETHOD MakeAbsoluteURL(char * absolute_url, const char * relative_url, char **retURL);
NS_IMETHOD ScanHTMLForURLs(const char* input, char **retBuf);
NS_IMETHOD ParseURL(const char *url, int parts_requested, char **returnVal);
NS_IMETHOD ParseURL(const char *url, PRInt32 parts_requested, char **returnVal);
};

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

@ -81,7 +81,7 @@ NS_IMPL_ADDREF(nsMsgHeaderParser)
NS_IMPL_RELEASE(nsMsgHeaderParser)
NS_IMPL_QUERY_INTERFACE(nsMsgHeaderParser, nsIMsgHeaderParser::GetIID()); /* we need to pass in the interface ID of this interface */
nsresult nsMsgHeaderParser::ParseHeaderAddresses (const char *charset, const char *line, char **names, char **addresses, PRUint32& numAddresses)
nsresult nsMsgHeaderParser::ParseHeaderAddresses (const char *charset, const char *line, char **names, char **addresses, PRUint32 *numAddresses)
{
char *utf8Str, *outStrings;
@ -89,14 +89,14 @@ nsresult nsMsgHeaderParser::ParseHeaderAddresses (const char *charset, const cha
utf8Str = nsnull;
}
numAddresses = msg_parse_Header_addresses((const char *) utf8Str, names, addresses);
*numAddresses = msg_parse_Header_addresses((const char *) utf8Str, names, addresses);
PR_FREEIF(utf8Str);
if (nsnull != names && nsnull != *names) {
char *s = *names;
PRInt32 i, len, len_all = 0, outStrLen;
for (i = 0; i < (PRInt32) numAddresses; i++) {
for (i = 0; i < (PRInt32) *numAddresses; i++) {
len = PL_strlen(s) + 1;
len_all += len;
s += len;
@ -110,7 +110,7 @@ nsresult nsMsgHeaderParser::ParseHeaderAddresses (const char *charset, const cha
if (nsnull != addresses && nsnull != *addresses) {
char *s = *addresses;
PRInt32 i, len, len_all = 0, outStrLen;
for (i = 0; i < (PRInt32) numAddresses; i++) {
for (i = 0; i < (PRInt32) *numAddresses; i++) {
len = PL_strlen(s) + 1;
len_all += len;
s += len;

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

@ -52,7 +52,7 @@
Either of the provided pointers may be NULL if the caller is not interested
in those components.
*/
NS_IMETHOD ParseHeaderAddresses (const char *charset, const char *line, char **names, char **addresses, PRUint32& numAddresses);
NS_IMETHOD ParseHeaderAddresses (const char *charset, const char *line, char **names, char **addresses, PRUint32 *numAddresses);
/* Given a string which contains a list of Header addresses, returns a
comma-seperated list of just the `mailbox' portions.

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

@ -130,7 +130,12 @@ NS_IMETHODIMP nsNntpService::SaveMessageToDisk(const char *aMessageURI, nsIFileS
{
// unimplemented for news right now....if we feel it would be useful to
// be able to spool a news article to disk then this is the method we need to implement.
nsresult rv = NS_OK;
//
// Returning success causes us much grief with the editor because we wait until this is
// complete to do anything...so changing this to failure.
//
nsresult rv = NS_ERROR_FAILURE;
return rv;
}