General work on composition back end

This commit is contained in:
rhp%netscape.com 1999-05-12 22:13:58 +00:00
Родитель 98c1ab5c7e
Коммит f78a7f1071
13 изменённых файлов: 1008 добавлений и 1222 удалений

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

@ -104,6 +104,7 @@ LINCS=$(LINCS) -I, \
-I$(PUBLIC)\dom \
-I$(PUBLIC)\appcores \
-I$(PUBLIC)\mime \
-I$(PUBLIC)\security \
$(NULL)
#//------------------------------------------------------------------------

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

@ -264,18 +264,6 @@ public:
#define FE_Alert(a, b) printf("ALERT: %s", b)
/* The three ways to deliver a message.
*/
typedef enum
{
MSG_DeliverNow,
MSG_QueueForLater,
MSG_Save,
MSG_SaveAs,
MSG_SaveAsDraft,
MSG_SaveAsTemplate
} MSG_Deliver_Mode;
#define msg_InterruptContext(a, b) /*NYI*/
#define msg_GetDummyEnvelope() NULL
#define msg_IsSummaryValid(a, b) PR_FALSE

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

@ -47,8 +47,8 @@ class nsIDOMComposeAppCore : public nsIDOMBaseAppCore {
/* void NewMessage (in nsAutoString url, in nsAutoString args, in nsIDOMXULTreeElement tree, in nsIDOMNodeList node, in nsIDOMMsgAppCore msgAppCore, in long messageType); */
NS_IMETHOD NewMessage(nsAutoString& url, nsAutoString& args, nsIDOMXULTreeElement *tree, nsIDOMNodeList *node, nsIDOMMsgAppCore *msgAppCore, PRInt32 messageType) = 0;
/* void SendMessage (in nsAutoString addrTo, in nsAutoString addrCc, in nsAutoString addrBcc, in nsAutoString newsgroup, in nsAutoString subject, in nsAutoString msg); */
NS_IMETHOD SendMessage(nsAutoString& addrTo, nsAutoString& addrCc, nsAutoString& addrBcc, nsAutoString& newsgroup, nsAutoString& subject, nsAutoString& msg) = 0;
/* void SendMsg (in nsAutoString addrTo, in nsAutoString addrCc, in nsAutoString addrBcc, in nsAutoString newsgroup, in nsAutoString subject, in nsAutoString msg); */
NS_IMETHOD SendMsg(nsAutoString& addrTo, nsAutoString& addrCc, nsAutoString& addrBcc, nsAutoString& newsgroup, nsAutoString& subject, nsAutoString& msg) = 0;
/* long SendMessage2 (); */
NS_IMETHOD SendMessage2(PRInt32 *_retval) = 0;

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

@ -8,11 +8,111 @@
#include "nsISupports.h" /* interface nsISupports */
#include "nsIMsgCompFields.h" /* interface nsIMsgCompFields */
#include "nsID.h" /* interface nsID */
#include "rosetta.h"
#ifdef XPIDL_JS_STUBS
#include "jsapi.h"
#endif
typedef enum
{
nsMsgDeliverNow,
nsMsgQueueForLater,
nsMsgSave,
nsMsgSaveAs,
nsMsgSaveAsDraft,
nsMsgSaveAsTemplate
} nsMsgDeliverMode;
struct nsMsgAttachmentData
{
char *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.
*/
};
/* This structure is the interface between compose.c and composew.c.
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.
*/
/* Used by libmime -- mimedrft.c
* Front end shouldn't use this structure.
*/
typedef struct nsMsgAttachedFile
{
char *orig_url; /* Where it came from on the network (or even elsewhere
on the local disk.)
*/
char *file_name; /* 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.
*/
/* #### I'm not entirely sure where this data is going to come from...
*/
char *description; /* For Content-Description header */
char *x_mac_type, *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.)
*/
uint32 size;
uint32 unprintable_count;
uint32 highbit_count;
uint32 ctl_count;
uint32 null_count;
uint32 max_line_length;
HG68452
} nsMsgAttachedFile;
/* starting interface: nsIMsgSend */
/* {9E9BD970-C5D6-11d2-8297-000000000000} */
@ -25,8 +125,20 @@ class nsIMsgSend : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMSGSEND_IID)
/* void SendMessage (in nsIMsgCompFields fields, in string smtp); */
NS_IMETHOD SendMessage(nsIMsgCompFields *fields, const char *smtp) = 0;
NS_IMETHOD SendMessage(
nsIMsgCompFields *fields,
const char *smtp,
PRBool digest_p,
PRBool dont_deliver_p,
PRInt32 mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
void *relatedPart, /* nsMsgSendPart */
void (*message_delivery_done_callback)(void *context, void *fe_data,
int status, const char *error_message)) = 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);

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

@ -24,7 +24,6 @@ void FE_UpdateCompToolbar(MSG_Pane*) {return;}
void FE_SetWindowLoading(MWContext *, URL_Struct *,Net_GetUrlExitFunc **) {return;}
XP_Bool NET_AreThereActiveConnectionsForWindow(MWContext *) {return PR_FALSE;}
int NET_SilentInterruptWindow(MWContext * window_id) {return 0;}
int NET_ScanForURLs(MSG_Pane*, const char *, PRInt32,char *, int, PRBool) {return nsnull;}
void NET_FreeURLStruct (URL_Struct *) {return;}
URL_Struct *NET_CreateURLStruct (const char *, NET_ReloadMethod) {return NULL;}
char * NET_ParseURL (const char *, int ) {return NULL;}
@ -32,7 +31,6 @@ 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_Bool NET_IsOffline() {return PR_FALSE;}
char* NET_ScanHTMLForURLs(const char* input) {return NULL;}
XP_FILE_URL_PATH XP_PlatformFileToURL (const XP_FILE_NATIVE_PATH ) {return NULL;}
MWContext *XP_FindContextOfType(MWContext *, MWContextType) {return NULL;}

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

@ -27,6 +27,7 @@
#include "nsIDOMXULDocument.h"
#include "nsIDOMNodeList.h"
#include "nsIScriptContextOwner.h"
#include "nsMsgSend.h"
/* rhp - for access to webshell */
#include "prmem.h"
@ -137,7 +138,7 @@ public:
nsIDOMNodeList *nodeList,
nsIDOMMsgAppCore * msgAppCore,
PRInt32 messageType);
NS_IMETHOD SendMessage(nsAutoString& aAddrTo, nsAutoString& aAddrCc,
NS_IMETHOD SendMsg(nsAutoString& aAddrTo, nsAutoString& aAddrCc,
nsAutoString& aAddrBcc,
nsAutoString& aAddrNewsgroup,
nsAutoString& aSubject,
@ -767,12 +768,12 @@ done:
}
NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo,
nsAutoString& aAddrCc,
nsAutoString& aAddrBcc,
nsAutoString& aAddrNewsgroup,
nsAutoString& aSubject,
nsAutoString& aMsg)
NS_IMETHODIMP nsComposeAppCore::SendMsg(nsAutoString& aAddrTo,
nsAutoString& aAddrCc,
nsAutoString& aAddrBcc,
nsAutoString& aAddrNewsgroup,
nsAutoString& aSubject,
nsAutoString& aMsg)
{
nsMsgCompPrefs pCompPrefs;
char* pUserEmail = nsnull;
@ -855,7 +856,21 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage(nsAutoString& aAddrTo,
mMsgCompFields->SetBody(nsAutoCString(aMsg), NULL);
if (mMsgSend)
mMsgSend->SendMessage(mMsgCompFields, NULL);
{
mMsgSend->SendMessage(mMsgCompFields,
"", // const char *smtp,
PR_FALSE, // PRBool digest_p,
PR_FALSE, // PRBool dont_deliver_p,
nsMsgDeliverNow, // nsMsgDeliverMode mode,
TEXT_HTML, // const char *attachment1_type,
nsAutoCString(aMsg), // const char *attachment1_body,
PL_strlen(nsAutoCString(aMsg)), // PRUint32 attachment1_body_length,
NULL, // const struct nsMsgAttachmentData *attachments,
NULL, // const struct nsMsgAttachedFile *preloaded_attachments,
NULL, // nsMsgSendPart *relatedPart,
NULL); // void (*message_delivery_done_callback)(MWContext *context, void *fe_data,
// int status, const char *error_message))
}
}
if (nsnull != mScriptContext) {
const char* url = "";
@ -928,7 +943,7 @@ NS_IMETHODIMP nsComposeAppCore::SendMessage2(PRInt32 * _retval)
if (mEditor)
{
mEditor->GetContentsAsText(msgBody);
SendMessage(msgTo, msgCc, msgBcc, msgNewsgroup, msgSubject, msgBody);
SendMsg(msgTo, msgCc, msgBcc, msgNewsgroup, msgSubject, msgBody);
}
}
}

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

@ -346,7 +346,7 @@ ComposeAppCoreSendMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
nsJSUtils::nsConvertJSValToString(b4, cx, argv[4]);
nsJSUtils::nsConvertJSValToString(b5, cx, argv[5]);
if (NS_OK != nativeThis->SendMessage(b0, b1, b2, b3, b4, b5)) {
if (NS_OK != nativeThis->SendMsg(b0, b1, b2, b3, b4, b5)) {
return JS_FALSE;
}

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

@ -18,48 +18,17 @@
#include "rosetta_mailnews.h"
#include "nsMsgSend.h"
#include "nsMsgSendPart.h"
#include "nsMsgComposeFact.h"
#include "nsMsgCompPrefs.h"
#include "nsMsgCompose.h"
#include "nsEscape.h"
#include "nsIMsgHeaderParser.h"
#include "nsIMimeURLUtils.h"
#include "nsQuickSort.h"
static NS_DEFINE_CID(kCMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
/*JFD
#include "msg.h"
#include "errcode.h"
#include "dberror.h"
#include "mime.h"
#include "shist.h"
#include "xlate.h"
#include "bkmks.h"
#include "libi18n.h"
#include "xpgetstr.h"
#include "msgsec.h"
#include "msgcpane.h"
#include "msgprefs.h"
#include "msgsec.h"
#include "msgcflds.h"
#include "msgimap.h"
#include "msgurlq.h"
#include "maildb.h"
#include "abcom.h"
#include "dirprefs.h"
#include "edt.h" // to invoke save on the html compose pane
#include "mhtmlstm.h"
#include "prefapi.h"
#include "htmldlgs.h"
#include "hosttbl.h"
#include "newshost.h"
#include "intl_csi.h"
*/
#include "nsQuickSort.h"
static NS_DEFINE_CID(kCMimeURLUtilsCID, NS_IMIME_URLUTILS_CID);
#ifdef UNREADY_CODE
HJ04305
@ -322,13 +291,13 @@ MSG_HTMLRecipients::FreeChangedList(char** list)
}
static void msg_free_attachment_list(struct MSG_AttachmentData *list);
static void msg_free_attachment_list(struct nsMsgAttachmentData *list);
/*JFD
static void
msg_delete_attached_files(struct MSG_AttachedFile *attachments)
msg_delete_attached_files(struct nsMsgAttachedFile *attachments)
{
struct MSG_AttachedFile *tmp;
struct nsMsgAttachedFile *tmp;
if (!attachments) return;
for (tmp = attachments; tmp->orig_url; tmp++) {
PR_FREEIF(tmp->orig_url);
@ -371,7 +340,7 @@ nsMsgCompose::nsMsgCompose()
m_deliveryInProgress = PR_FALSE;
m_attachmentInProgress = PR_FALSE;
m_pendingAttachmentsCount = 0;
m_deliver_mode = MSG_DeliverNow;
m_deliver_mode = nsMsgDeliverNow;
m_cited = PR_FALSE;
m_duplicatePost = PR_FALSE;
m_htmlaction = MSG_HTMLAskUser;
@ -443,7 +412,7 @@ nsresult nsMsgCompose::Initialize(/*MWContext**/PRInt32 old_context, nsIMsgCompF
InitializeHeaders((MWContext*)old_context, fields);
m_visible_headers = GetInterestingHeaders();
m_deliver_mode = MSG_DeliverNow;
m_deliver_mode = nsMsgDeliverNow;
m_haveAttachedVcard = PR_FALSE;
m_fields->SetForcePlainText(PR_FALSE); // Coming into us, this field meant
@ -588,43 +557,43 @@ int nsMsgCompose::CreateVcardAttachment ()
char * origurl = XP_PlatformFileToURL (vCardFileName);
int datacount = 0, filecount = 0;
for (MSG_AttachmentData *tmp1 = m_attachData; tmp1 && tmp1->url; tmp1++) datacount++;
for (MSG_AttachedFile *tmp = m_attachedFiles; tmp && tmp->orig_url; tmp++) filecount++;
for (nsMsgAttachmentData *tmp1 = m_attachData; tmp1 && tmp1->url; tmp1++) datacount++;
for (nsMsgAttachedFile *tmp = m_attachedFiles; tmp && tmp->orig_url; tmp++) filecount++;
MSG_AttachmentData *alist;
nsMsgAttachmentData *alist;
if (datacount) {
alist = (MSG_AttachmentData *)
PR_REALLOC(m_attachData, (datacount + 2) * sizeof(MSG_AttachmentData));
alist = (nsMsgAttachmentData *)
PR_REALLOC(m_attachData, (datacount + 2) * sizeof(nsMsgAttachmentData));
}
else {
alist = (MSG_AttachmentData *)
PR_Malloc((datacount + 2) * sizeof(MSG_AttachmentData));
alist = (nsMsgAttachmentData *)
PR_Malloc((datacount + 2) * sizeof(nsMsgAttachmentData));
}
if (!alist)
return MK_OUT_OF_MEMORY;
m_attachData = alist;
memset (m_attachData + datacount, 0, 2 * sizeof (MSG_AttachmentData));
memset (m_attachData + datacount, 0, 2 * sizeof (nsMsgAttachmentData));
m_attachData[datacount].url = fileurl;
m_attachData[datacount].real_type = PL_strdup(vCardMimeFormat);
m_attachData[datacount].description = PL_strdup (buf);
m_attachData[datacount].real_name = PL_strdup (vCardFileName);
m_attachData[datacount + 1].url = NULL;
MSG_AttachedFile *aflist;
nsMsgAttachedFile *aflist;
if (filecount) {
aflist = (struct MSG_AttachedFile *)
PR_REALLOC(m_attachedFiles, (filecount + 2) * sizeof(MSG_AttachedFile));
aflist = (struct nsMsgAttachedFile *)
PR_REALLOC(m_attachedFiles, (filecount + 2) * sizeof(nsMsgAttachedFile));
}
else {
aflist = (struct MSG_AttachedFile *)
PR_Malloc((filecount + 2) * sizeof(MSG_AttachedFile));
aflist = (struct nsMsgAttachedFile *)
PR_Malloc((filecount + 2) * sizeof(nsMsgAttachedFile));
}
if (!aflist)
return MK_OUT_OF_MEMORY;
m_attachedFiles = aflist;
memset (m_attachedFiles + filecount, 0, 2 * sizeof (MSG_AttachedFile));
memset (m_attachedFiles + filecount, 0, 2 * sizeof (nsMsgAttachedFile));
m_attachedFiles[filecount].orig_url = origurl;
m_attachedFiles[filecount].file_name = filename;
m_attachedFiles[filecount].type = PL_strdup(vCardMimeFormat);
@ -742,7 +711,7 @@ nsMsgCompose::GetCommandStatus(MSG_CommandType command,
if (m_attachmentInProgress || m_deliveryInProgress)
selectable_p = PR_FALSE;
break;
case MSG_Save:
case nsMsgSave:
case MSG_SaveDraft:
case MSG_SaveDraftThenClose:
#ifdef UNREADY_CODE
@ -879,7 +848,7 @@ nsMsgCompose::DoCommand(MSG_CommandType command, nsMsgViewIndex* indices,
case MSG_SendMessageLater:
status = QueueMessageForLater();/* ###tw Error-return-type mismatch! */
break;
case MSG_Save:
case nsMsgSave:
status = SaveMessage();
break;
case MSG_SaveDraft:
@ -1029,8 +998,8 @@ nsMsgCompose::InitializeHeaders(MWContext* old_context, const nsIMsgCompFields*
if (count > 0) {
// if forwarding one or more messages
PR_ASSERT(*attachment == '\0');
MSG_AttachmentData *alist = (struct MSG_AttachmentData *)
PR_Malloc((count + 1) * sizeof(MSG_AttachmentData));
nsMsgAttachmentData *alist = (struct nsMsgAttachmentData *)
PR_Malloc((count + 1) * sizeof(nsMsgAttachmentData));
if (alist) {
memset(alist, 0, (count + 1) * sizeof(*alist));
for (count--; count >= 0; count--) {
@ -1045,10 +1014,10 @@ nsMsgCompose::InitializeHeaders(MWContext* old_context, const nsIMsgCompFields*
} else if (*attachment) {
// forwarding a single url
// typically a web page
MSG_AttachmentData *alist;
nsMsgAttachmentData *alist;
count = 1;
alist = (struct MSG_AttachmentData *)
PR_Malloc((count + 1) * sizeof(MSG_AttachmentData));
alist = (struct nsMsgAttachmentData *)
PR_Malloc((count + 1) * sizeof(nsMsgAttachmentData));
if (alist) {
memset(alist, 0, (count + 1) * sizeof(*alist));
alist[0].url = (char *)attachment;
@ -1620,9 +1589,17 @@ QuotePlainIntoHTML::QuoteLine(char* line, PRUint32 length)
delete [] m_outbuf;
m_outbuf = new char [m_outbufsize];
}
if (m_outbuf) {
if (m_outbuf)
{
nsCOMPtr<nsIMimeURLUtils> myURLUtil;
int res = nsComponentManager::CreateInstance(kCMimeURLUtilsCID,
NULL, nsIMimeURLUtils::GetIID(),
(void **) getter_AddRefs(myURLUtil));
if (!NS_SUCCEEDED(res))
return 0;
*m_outbuf = '\0';
//JFD NET_ScanForURLs(NULL, line, length, m_outbuf, m_outbufsize, PR_TRUE);
myURLUtil->ScanForURLs(line, length, m_outbuf, m_outbufsize, PR_TRUE);
EDT_PasteQuote(m_context, m_outbuf);
}
return 0;
@ -1879,11 +1856,11 @@ nsMsgCompose::PastePlaintextQuotation(const char* str)
int
nsMsgCompose::SetAttachmentList(struct MSG_AttachmentData* list)
nsMsgCompose::SetAttachmentList(struct nsMsgAttachmentData* list)
{
int count = 0;
MSG_AttachmentData *tmp;
MSG_AttachmentData *tmp2;
nsMsgAttachmentData *tmp;
nsMsgAttachmentData *tmp2;
int status = 0;
ClearCompositionMessageID(); /* Since the attachment list has changed,
@ -1897,8 +1874,8 @@ nsMsgCompose::SetAttachmentList(struct MSG_AttachmentData* list)
for (tmp = list; tmp && tmp->url; tmp++) count++;
if (count > 0) {
m_attachData = (MSG_AttachmentData*)
PR_Malloc((count + 1) * sizeof(MSG_AttachmentData));
m_attachData = (nsMsgAttachmentData*)
PR_Malloc((count + 1) * sizeof(nsMsgAttachmentData));
if (!m_attachData) {
#ifdef UNREADY_CODE
FE_Alert(m_context, XP_GetString(MK_OUT_OF_MEMORY));
@ -1906,7 +1883,7 @@ nsMsgCompose::SetAttachmentList(struct MSG_AttachmentData* list)
return MK_OUT_OF_MEMORY;
}
memset(m_attachData, 0, (count + 1) * sizeof(MSG_AttachmentData));
memset(m_attachData, 0, (count + 1) * sizeof(nsMsgAttachmentData));
}
if (count > 0) {
@ -1945,7 +1922,7 @@ nsMsgCompose::NoPendingAttachments() const
return (m_pendingAttachmentsCount == 0);
}
const struct MSG_AttachmentData *
const struct nsMsgAttachmentData *
nsMsgCompose::GetAttachmentList()
{
if (m_attachData && m_attachData[0].url != NULL) return m_attachData;
@ -1954,9 +1931,9 @@ nsMsgCompose::GetAttachmentList()
static void
msg_free_attachment_list(struct MSG_AttachmentData *list)
msg_free_attachment_list(struct nsMsgAttachmentData *list)
{
MSG_AttachmentData* tmp;
nsMsgAttachmentData* tmp;
if (!list) return;
for (tmp = list ; tmp->url ; tmp++) {
PR_Free((char*) tmp->url);
@ -1977,8 +1954,8 @@ msg_free_attachment_list(struct MSG_AttachmentData *list)
URL (in source and type-conversion.)
*/
static PRBool
msg_attachments_match (MSG_AttachmentData *attachment,
MSG_AttachedFile *file)
msg_attachments_match (nsMsgAttachmentData *attachment,
nsMsgAttachedFile *file)
{
const char *dt;
PR_ASSERT(attachment && file);
@ -2015,9 +1992,9 @@ nsMsgCompose::DownloadAttachments()
int attachment_count = 0;
int new_download_count = 0;
int download_overlap_count = 0;
MSG_AttachmentData *tmp;
MSG_AttachmentData *downloads = 0;
MSG_AttachedFile *tmp2;
nsMsgAttachmentData *tmp;
nsMsgAttachmentData *downloads = 0;
nsMsgAttachedFile *tmp2;
int returnValue = 0;
// *** Relax the rule a little bit to enable resume downloading at
@ -2081,11 +2058,11 @@ nsMsgCompose::DownloadAttachments()
/* Now download any new files that are in the list.
*/
if (download_overlap_count != attachment_count) {
MSG_AttachmentData *dfp;
nsMsgAttachmentData *dfp;
new_download_count = attachment_count - download_overlap_count;
m_pendingAttachmentsCount = new_download_count;
downloads = (MSG_AttachmentData *)
PR_Malloc(sizeof(MSG_AttachmentData) * (new_download_count + 1));
downloads = (nsMsgAttachmentData *)
PR_Malloc(sizeof(nsMsgAttachmentData) * (new_download_count + 1));
if (!downloads) {
#ifdef UNREADY_CODE
FE_Alert(m_context, XP_GetString(MK_OUT_OF_MEMORY));
@ -2119,7 +2096,7 @@ nsMsgCompose::DownloadAttachments()
/*JFD
returnValue = msg_DownloadAttachments(this, this, downloads,
#ifdef XP_OS2
(void (_Optlink*) (MWContext*,void*,int,const char*,MSG_AttachedFile*))
(void (_Optlink*) (MWContext*,void*,int,const char*,nsMsgAttachedFile*))
#endif
nsMsgCompose::DownloadAttachmentsDone_S);
*/
@ -2133,7 +2110,7 @@ nsMsgCompose::DownloadAttachmentsDone_S(MWContext *context,
void *fe_data,
int status,
const char *error_message,
struct MSG_AttachedFile *attachments)
struct nsMsgAttachedFile *attachments)
{
((nsMsgCompose*) fe_data)->DownloadAttachmentsDone(context, status,
error_message,
@ -2143,14 +2120,14 @@ nsMsgCompose::DownloadAttachmentsDone_S(MWContext *context,
void
nsMsgCompose::DownloadAttachmentsDone(MWContext* context, int status,
const char* error_message,
struct MSG_AttachedFile *attachments)
struct nsMsgAttachedFile *attachments)
{
PR_ASSERT(context == m_context);
int i, old_count = 0;
int new_count = 0;
struct MSG_AttachedFile *tmp;
MSG_AttachedFile *newd;
struct nsMsgAttachedFile *tmp;
nsMsgAttachedFile *newd;
// *** Relax the rule a little bit to enable resume downloading at
// *** send time.
@ -2174,10 +2151,10 @@ nsMsgCompose::DownloadAttachmentsDone(MWContext* context, int status,
}
if (old_count + new_count == 0) goto FAIL;
newd = (MSG_AttachedFile *)
newd = (nsMsgAttachedFile *)
PR_REALLOC(m_attachedFiles,
((old_count + new_count + 1)
* sizeof(MSG_AttachedFile)));
* sizeof(nsMsgAttachedFile)));
if (!newd) {
status = MK_OUT_OF_MEMORY;
@ -2190,7 +2167,7 @@ nsMsgCompose::DownloadAttachmentsDone(MWContext* context, int status,
memcpy(newd + old_count,
attachments,
sizeof(MSG_AttachedFile) * (new_count + 1));
sizeof(nsMsgAttachedFile) * (new_count + 1));
// memcpy doesn't allocate string, so do it
for(i=0; i<new_count; i++)
@ -2272,7 +2249,7 @@ nsMsgCompose::GetAttachmentString()
{
/* #### bug 8688 */
MSG_AttachmentData *tmp;
nsMsgAttachmentData *tmp;
int count;
int chars_per_attachment;
int default_field_width = 63; /* 72 - some space for the word
@ -2738,10 +2715,10 @@ nsMsgCompose::DeliveryDoneCB(MWContext* context, int status,
// *** We don't want to set m_status to status. The default value
// of m_status (-1) prevents the composition pane from closing down
// once we done with saving draft. The composition pane should remain up.
if ((m_deliver_mode != MSG_SaveAsDraft &&
m_deliver_mode != MSG_SaveAsTemplate &&
m_deliver_mode != MSG_SaveAs) ||
(m_deliver_mode == MSG_SaveAsDraft && m_closeAfterSave))
if ((m_deliver_mode != nsMsgSaveAsDraft &&
m_deliver_mode != nsMsgSaveAsTemplate &&
m_deliver_mode != nsMsgSaveAs) ||
(m_deliver_mode == nsMsgSaveAsDraft && m_closeAfterSave))
m_status = status;
PR_ASSERT(!m_attachmentInProgress);
@ -2883,7 +2860,7 @@ nsMsgCompose::DeliveryDoneCB(MWContext* context, int status,
m_actionInfo->m_folderInfo->SummaryChanged();
JFD*/
if (m_deliver_mode == MSG_DeliverNow)
if (m_deliver_mode == nsMsgDeliverNow)
{
// If we're delivering the mail right now, tell the FE
// the Sent folder has new counts
@ -2898,7 +2875,7 @@ JFD*/
folder->SummaryChanged();
*/
}
else if (m_deliver_mode == MSG_QueueForLater)
else if (m_deliver_mode == nsMsgQueueForLater)
{
// If we're delivering the mail into the Outbox/queue folder,
// tell the FE the Outbox folder has new counts
@ -2962,7 +2939,7 @@ nsMsgCompose::GetHTMLMarkup(void)
}
int
nsMsgCompose::DoneComposeMessage( MSG_Deliver_Mode deliver_mode )
nsMsgCompose::DoneComposeMessage( nsMsgDeliverMode deliver_mode )
{
int attachment_count = 0;
PRBool digest_p = PR_FALSE;
@ -2978,9 +2955,9 @@ nsMsgCompose::DoneComposeMessage( MSG_Deliver_Mode deliver_mode )
if (groups && *groups && !m_host)
m_host = InferNewsHost (groups);
if (m_markup && (deliver_mode != MSG_SaveAs &&
deliver_mode != MSG_SaveAsDraft &&
deliver_mode != MSG_SaveAsTemplate)) {
if (m_markup && (deliver_mode != nsMsgSaveAs &&
deliver_mode != nsMsgSaveAsDraft &&
deliver_mode != nsMsgSaveAsTemplate)) {
MSG_HTMLComposeAction action = DetermineHTMLAction();
if (action == MSG_HTMLAskUser)
{
@ -3059,7 +3036,7 @@ nsMsgCompose::DoneComposeMessage( MSG_Deliver_Mode deliver_mode )
;
if (m_attachData && m_attachData[0].url && m_attachData[1].url ) {
MSG_AttachmentData* s;
nsMsgAttachmentData* s;
digest_p = PR_TRUE;
for (s = m_attachData ; s->url ; s++) {
/* When there are attachments, start out assuming it is a digest,
@ -3143,23 +3120,23 @@ nsMsgCompose::SendMessageNow()
{
PREF_SetBoolPref("network.online", PR_TRUE); // make sure we're online.
// remember if we're queued so we know which folder
m_deliver_mode = MSG_DeliverNow;
m_deliver_mode = nsMsgDeliverNow;
if (m_fields->GetAttachVCard())
CreateVcardAttachment();
// counts we need to update.
return DoneComposeMessage(MSG_DeliverNow);
return DoneComposeMessage(nsMsgDeliverNow);
}
int
nsMsgCompose::QueueMessageForLater()
{
// remember if we're queued so we know which folder
m_deliver_mode = MSG_QueueForLater;
m_deliver_mode = nsMsgQueueForLater;
if (m_fields->GetAttachVCard())
CreateVcardAttachment();
// counts we need to update.
return DoneComposeMessage(MSG_QueueForLater);
return DoneComposeMessage(nsMsgQueueForLater);
}
int
@ -3177,7 +3154,7 @@ nsMsgCompose::SaveMessage()
else
*/
{
m_deliver_mode = MSG_SaveAsDraft;
m_deliver_mode = nsMsgSaveAsDraft;
}
return DoneComposeMessage(m_deliver_mode);
@ -3186,7 +3163,7 @@ nsMsgCompose::SaveMessage()
MSG_CommandType
nsMsgCompose::PreviousSaveCommand()
{
if (m_deliver_mode == MSG_SaveAsTemplate)
if (m_deliver_mode == nsMsgSaveAsTemplate)
return MSG_SaveTemplate;
else
return MSG_SaveDraft;
@ -3211,8 +3188,8 @@ nsMsgCompose::SaveMessageAsDraft()
(MSG_FOLDER_FLAG_DRAFTS, PR_FALSE);
}
*/
m_deliver_mode = MSG_SaveAsDraft;
return DoneComposeMessage(MSG_SaveAsDraft);
m_deliver_mode = nsMsgSaveAsDraft;
return DoneComposeMessage(nsMsgSaveAsDraft);
}
int
@ -3231,7 +3208,7 @@ nsMsgCompose::SaveMessageAsTemplate()
(MSG_FOLDER_FLAG_TEMPLATES, PR_FALSE);
}
*/
m_deliver_mode = MSG_SaveAsTemplate;
m_deliver_mode = nsMsgSaveAsTemplate;
#ifdef SUPPORT_X_TEMPLATE_NAME
char *defaultName = NULL;
@ -3248,7 +3225,7 @@ nsMsgCompose::SaveMessageAsTemplate()
}
#endif /* SUPPORT_X_TEMPLATE_NAME */
return DoneComposeMessage(MSG_SaveAsTemplate);
return DoneComposeMessage(nsMsgSaveAsTemplate);
}
static int
@ -3487,8 +3464,8 @@ HJ53211
int
nsMsgCompose::SetPreloadedAttachments ( MWContext *context,
struct MSG_AttachmentData *attachmentData,
struct MSG_AttachedFile *attachments,
struct nsMsgAttachmentData *attachmentData,
struct nsMsgAttachedFile *attachments,
int attachments_count )
{
PR_ASSERT ( context == m_context );
@ -3500,8 +3477,8 @@ nsMsgCompose::SetPreloadedAttachments ( MWContext *context,
PR_ASSERT ( m_attachData == NULL );
m_attachData = (MSG_AttachmentData *) PR_Malloc ( (attachments_count+1) *
sizeof (MSG_AttachmentData) );
m_attachData = (nsMsgAttachmentData *) PR_Malloc ( (attachments_count+1) *
sizeof (nsMsgAttachmentData) );
if ( !m_attachData ) {
#ifdef UNREADY_CODE
FE_Alert ( m_context, XP_GetString ( MK_OUT_OF_MEMORY ) );
@ -3509,10 +3486,10 @@ nsMsgCompose::SetPreloadedAttachments ( MWContext *context,
return MK_OUT_OF_MEMORY;
}
memset (m_attachData, 0, (attachments_count +1) * sizeof (MSG_AttachmentData));
memset (m_attachData, 0, (attachments_count +1) * sizeof (nsMsgAttachmentData));
memcpy ( m_attachData, attachmentData,
sizeof (MSG_AttachmentData) * attachments_count );
sizeof (nsMsgAttachmentData) * attachments_count );
m_pendingAttachmentsCount = attachments_count;
m_attachmentInProgress = PR_TRUE;
@ -3525,9 +3502,9 @@ nsMsgCompose::SetPreloadedAttachments ( MWContext *context,
void
nsMsgCompose::SetIMAPMessageUID ( nsMsgKey key )
{
PR_ASSERT (m_deliver_mode == MSG_SaveAsDraft ||
m_deliver_mode == MSG_SaveAs ||
m_deliver_mode == MSG_SaveAsTemplate);
PR_ASSERT (m_deliver_mode == nsMsgSaveAsDraft ||
m_deliver_mode == nsMsgSaveAs ||
m_deliver_mode == nsMsgSaveAsTemplate);
PR_ASSERT(key != nsMsgKey_None);
if (key == nsMsgKey_None)

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

@ -1,317 +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 _MsgCompose_H_
#define _MsgCompose_H_
#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"
#include "msgcom.h"
#include "MsgCompGlue.h"
//#include "nsMsgPtrArray.h"
#include "nsMsgHeaderMasks.h"
#include "nsMsgFolderFlags.h"
#include "nsMsgCompFields.h"
#include "nsIMsgCompose.h"
/*JFD
#include "msg.h"
#include "msgpane.h"
#include "xlate.h"
*/
/* 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;
struct MSG_AttachedFile;
typedef struct PrintSetup_ PrintSetup;
typedef struct _XPDialogState XPDialogState;
HJ08142
class MSG_NewsHost;
class MSG_HTMLRecipients;
class nsMsgCompose : public nsIMsgCompose, public MSG_Pane {
public:
nsMsgCompose();
virtual ~nsMsgCompose();
/* this macro defines QueryInterface, AddRef and Release for this class */
NS_DECL_ISUPPORTS
NS_IMETHOD CreateAndInitialize(/*MWContext* */PRInt32 a_context, /* MWContext* */PRInt32 old_context,
/* MSG_Prefs* */PRInt32 prefs, nsIMsgCompFields* initfields,
/* MSG_Master* */PRInt32 master);
// Or, if you prefer, construct using below constructor and be sure to
// soon call the Initialize() method:
NS_IMETHOD Create(/* MWContext* */PRInt32 a_context, /* MSG_Prefs* */PRInt32 prefs,
/* MSG_Master* */PRInt32 master);
NS_IMETHOD Initialize(/* MWContext* */PRInt32 old_context, nsIMsgCompFields* initfields);
NS_IMETHOD Dispose();
virtual MSG_PaneType GetPaneType();
virtual void NotifyPrefsChange(NotifyCode code);
MSG_CommandType PreviousSaveCommand();
virtual nsresult GetCommandStatus(MSG_CommandType command,
const nsMsgViewIndex* indices,
PRInt32 numindices,
PRBool *selectable_p,
MSG_COMMAND_CHECK_STATE *selected_p,
const char **display_string,
PRBool * plural_p);
virtual nsresult DoCommand(MSG_CommandType command,
nsMsgViewIndex* indices, PRInt32 numindices);
const char* GetDefaultURL();
virtual void SetDefaultURL(const char *defaultUrl = NULL,
const char *htmlPart = NULL);
int SetCallbacks(MSG_CompositionPaneCallbacks* callbacks, void* closure);
nsIMsgCompFields* GetInitialFields();
MSG_HEADER_SET GetInterestingHeaders();
int SetAttachmentList(struct MSG_AttachmentData*);
PRBool NoPendingAttachments() const;
char* GetAttachmentString();
PRBool ShouldAutoQuote();
const char* GetCompHeader(MSG_HEADER_SET);
PRInt32 SetCompHeader(MSG_HEADER_SET, const char*);
PRBool GetCompBoolHeader(MSG_BOOL_HEADER_SET);
PRInt32 SetCompBoolHeader(MSG_BOOL_HEADER_SET, PRBool);
const char* GetCompBody();
int SetCompBody(const char*);
void ToggleCompositionHeader(PRUint32 header);
PRBool ShowingAllCompositionHeaders();
PRBool ShowingCompositionHeader(PRUint32 mask);
PRBool GetHTMLMarkup(void);
void SetHTMLMarkup(PRBool flag);
nsresult QuoteMessage(int (*func)(void* closure, const char* data),
void* closure);
int PastePlaintextQuotation(const char* str);
const struct MSG_AttachmentData *GetAttachmentList();
int DownloadAttachments();
char* UpdateHeaderContents(MSG_HEADER_SET which_header, const char* value);
const char* GetWindowTitle();
void SetBodyEdited(PRBool value);
void MailCompositionAllConnectionsComplete();
void CheckExpansion(MSG_HEADER_SET header);
PRBool DeliveryInProgress();
int SendMessageNow();
int QueueMessageForLater();
int SaveMessage();
int SaveMessageAsDraft();
int SaveMessageAsTemplate();
PRBool IsDuplicatePost();
const char* GetCompositionMessageID();
void ClearCompositionMessageID();
HJ13591
HJ86782
HJ02278
HJ95534
int RemoveNoCertRecipients();
PRBool SanityCheckNewsgroups (const char *newsgroups);
int SanityCheck(int skippast);
HJ42055
/* draft */
int SetPreloadedAttachments ( MWContext *context,
struct MSG_AttachmentData *attachmentData,
struct MSG_AttachedFile *attachments,
int attachments_count );
virtual void SetIMAPMessageUID (nsMsgKey key);
int RetrieveStandardHeaders(MSG_HeaderEntry ** return_list);
int SetHeaderEntries(MSG_HeaderEntry * in_list,int count);
void ClearComposeHeaders();
HJ37212
HJ42256
int SetHTMLAction(MSG_HTMLComposeAction action) {
m_htmlaction = action;
return 0;
}
MSG_HTMLComposeAction GetHTMLAction() {return m_htmlaction;}
int PutUpRecipientsDialog(void *pWnd = NULL);
int ResultsRecipients(PRBool cancelled, PRInt32* nohtml, PRInt32* htmlok);
PRBool m_confirmed_uuencode_p; // Have we confirmed sending uuencoded data?
// For qutoing plain text to html then convert back to plain text
void SetLineWidth(int width) { m_lineWidth = width; }
int GetLineWidth() { return m_lineWidth; }
// #$@%&*
protected:
static void QuoteHTMLDone_S(URL_Struct* url,
int status, MWContext* context);
void InitializeHeaders(MWContext* old_context, const nsIMsgCompFields* fields);
char* FigureBcc(PRBool newsBcc);
const char* CheckForLosingFcc(const char* fcc);
static void GetUrlDone_S(PrintSetup*);
void GetUrlDone(PrintSetup*);
static void DownloadAttachmentsDone_S(MWContext *context,
void *fe_data,
int status,
const char *error_message,
struct MSG_AttachedFile *attachmnts);
void DownloadAttachmentsDone(MWContext* context, int status,
const char* error_message,
struct MSG_AttachedFile *attachments);
int DoneComposeMessage(MSG_Deliver_Mode deliver_mode);
static void DeliveryDoneCB_s(MWContext *context, void *fe_data, int status,
const char *error_message);
void DeliveryDoneCB(MWContext* context, int status,
const char* error_message);
int RemoveNoCertRecipientsFromList(MSG_HEADER_SET header);
PRBool HasNoMarkup();
MSG_HTMLComposeAction DetermineHTMLAction();
int MungeThroughRecipients(PRBool* someNonHTML, PRBool* groupNonHTML);
static PRBool AskDialogDone_s(XPDialogState *state, char **argv, int argc,
unsigned int button);
PRBool AskDialogDone(XPDialogState *state, char **argv, int argc,
unsigned int button);
static PRBool RecipientDialogDone_s(XPDialogState *state, char **argv,
int argc, unsigned int button);
PRBool RecipientDialogDone(XPDialogState *state, char **argv, int argc,
unsigned int button);
int CreateVcardAttachment ();
MSG_NewsHost *InferNewsHost (const char *groups);
MSG_REPLY_TYPE m_replyType; /* The kind of message composition in
progress (reply, forward, etc.) */
PRBool m_markup; /* Whether we should generate messages
whose first part is text/html rather
than text/plain. */
MSG_AttachmentData *m_attachData; /* null-terminated list of the URLs and
desired types currently scheduled
for attachment. */
MSG_AttachedFile *m_attachedFiles; /* The attachments which have already
been downloaded, and some info about
them. */
char *m_defaultUrl; /* Default URL for attaching, etc. */
nsMsgCompFields* m_initfields; // What all the fields were,
// initially.
nsMsgCompFields* m_fields; // Current value of all the fields.
char* m_messageId; // Message-Id to use for composition.
char* m_attachmentString; // Storage for string to display in UI for
// the list of attachments.
char* m_quotedText; // The results of quoting the original text.
/* Stuff used while quoting a message. */
PrintSetup* m_print;
MWContext *m_textContext;
MWContext *m_oldContext;
char* m_quoteUrl;
URL_Struct *m_dummyUrl;
Net_GetUrlExitFunc *m_exitQuoting;
int (*m_quotefunc)(void* closure, const char* data);
void* m_quoteclosure;
PRBool m_deliveryInProgress; /* True while mail is being sent. */
PRBool m_attachmentInProgress; /* True while attachments being
saved. */
int m_pendingAttachmentsCount;
MSG_Deliver_Mode m_deliver_mode; /* MSG_DelverNow, MSG_QueueForLater,
* MSG_SaveAs,
* MSG_SaveAsDraft, MSG_SaveAsTemplate
*/
HJ21695
PRBool m_cited;
PRBool m_duplicatePost; /* Whether we seem to be trying for a
second time to post the same message.
(If this is true, then we know to ignore
435 errors from the newsserver.) */
HJ92535
MSG_HTMLComposeAction m_htmlaction;
MSG_HTMLRecipients* m_htmlrecip;
int m_status;
// I'm sure this isn't what Terry had in mind... // ### dmb
MSG_HEADER_SET m_visible_headers;
MSG_NewsHost* m_host; // Which newshost we're posting to. This is
// lazily evaluated, so a NULL does necessarily
// mean we have no news host specified.
PRBool m_closeAfterSave;
PRBool m_haveQuoted;
PRBool m_haveAttachedVcard;
MSG_CompositionPaneCallbacks m_callbacks;
void* m_callbackclosure;
int m_lineWidth; // for quoting plain text to html then convert back
// to plain text
};
#endif /* _MsgCompose_H_ */

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

@ -72,7 +72,6 @@ static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID);
#include "prefapi.h"
#include "abdefn.h"
#include "prsembst.h"
#include "secrng.h" /* for RNG_GenerateGlobalRandomBytes() */
#include "addrbook.h"
#include "imaphost.h"
#include "imapoff.h"
@ -394,7 +393,7 @@ nsMsgSendMimeDeliveryState::nsMsgSendMimeDeliveryState()
m_fields = NULL; /* Where to send the message once it's done */
m_dont_deliver_p = PR_FALSE;
m_deliver_mode = MSG_DeliverNow;
m_deliver_mode = nsMsgDeliverNow;
m_attachments_only_p = PR_FALSE;
m_pre_snarfed_attachments_p = PR_FALSE;
@ -433,45 +432,35 @@ nsMsgSendMimeDeliveryState::~nsMsgSendMimeDeliveryState()
/* the following macro actually implement addref, release and query interface for our component. */
NS_IMPL_ISUPPORTS(nsMsgSendMimeDeliveryState, nsIMsgSend::GetIID());
nsresult nsMsgSendMimeDeliveryState::SendMessage(nsIMsgCompFields *fields, const char *smtp)
nsresult nsMsgSendMimeDeliveryState::SendMessage(
nsIMsgCompFields *fields,
const char *smtp,
PRBool digest_p,
PRBool dont_deliver_p,
PRInt32 mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
void *relatedPart,
void (*message_delivery_done_callback)(void *context, void *fe_data,
int status, const char *error_message))
{
const char* pBody;
PRInt32 nBodyLength;
pSmtpServer = smtp;
if (fields) {
pBody = ((nsMsgCompFields *)fields)->GetBody();
if (pBody)
nBodyLength = PL_strlen(pBody);
else
nBodyLength = 0;
StartMessageDelivery(NULL, NULL, (nsMsgCompFields *)fields, PR_FALSE, PR_FALSE,
MSG_DeliverNow, TEXT_PLAIN, pBody, nBodyLength, 0, NULL, NULL, NULL);
/**********
void nsMsgSendMimeDeliveryState::StartMessageDelivery(
MSG_Pane *pane,
void *fe_data,
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments,
nsMsgSendPart *relatedPart,
void (*message_delivery_done_callback)
(MWContext *context,
void *fe_data,
int status,
const char *error_message))
**********/
}
StartMessageDelivery(NULL, NULL,
(nsMsgCompFields *)fields,
digest_p,
dont_deliver_p,
(nsMsgDeliverMode) mode,
attachment1_type,
attachment1_body,
attachment1_body_length,
attachments,
preloaded_attachments,
(nsMsgSendPart *)relatedPart,
NULL /*message_delivery_done_callback*/);
return NS_OK;
}
@ -495,7 +484,7 @@ static int mime_sanity_check_fields (const char *from,
const char *other_random_headers);
static char *mime_generate_headers (nsMsgCompFields *fields,
const char *charset,
MSG_Deliver_Mode deliver_mode);
nsMsgDeliverMode deliver_mode);
static char *mime_generate_attachment_headers (const char *type,
const char *encoding,
const char *description,
@ -2315,7 +2304,7 @@ int nsMsgSendMimeDeliveryState::GatherMimeAttachments ()
/* If we get here, we shouldn't have the "generating a message" cb. */
NS_ASSERTION(!m_dont_deliver_p && !m_message_delivery_done_callback, "Shouldn't be here");
if (m_attachments_done_callback) {
struct MSG_AttachedFile *attachments;
struct nsMsgAttachedFile *attachments;
NS_ASSERTION(m_attachment_count > 0, "not more attachment");
if (m_attachment_count <= 0) {
@ -2325,7 +2314,7 @@ int nsMsgSendMimeDeliveryState::GatherMimeAttachments ()
goto FAIL;
}
attachments = (struct MSG_AttachedFile *)PR_Malloc((m_attachment_count + 1) * sizeof(*attachments));
attachments = (struct nsMsgAttachedFile *)PR_Malloc((m_attachment_count + 1) * sizeof(*attachments));
if (!attachments)
goto FAILMEM;
@ -2474,7 +2463,7 @@ int nsMsgSendMimeDeliveryState::GatherMimeAttachments ()
}
if (NET_IsOffline() && IsSaveMode()) {
status = InitImapOfflineDB( m_deliver_mode == MSG_SaveAsTemplate ?
status = InitImapOfflineDB( m_deliver_mode == nsMsgSaveAsTemplate ?
MSG_FOLDER_FLAG_TEMPLATES :
MSG_FOLDER_FLAG_DRAFTS );
if (status < 0) {
@ -2673,9 +2662,12 @@ int nsMsgSendMimeDeliveryState::GatherMimeAttachments ()
goto FAIL;
if (!m_crypto_closure) {
#ifdef UNREADY_CODE
status = toppart->SetBuffer(XP_GetString (MK_MIME_MULTIPART_BLURB));
status = toppart->SetBuffer(XP_GetString (MK_MIME_MULTIPART_BLURB));
#else
status = toppart->SetBuffer("string not implemented yet");
// RICHIE
#define MIME_MULTIPART_BLURB "This is a multi-part message in MIME format."
status = toppart->SetBuffer(MIME_MULTIPART_BLURB);
#endif
if (status < 0)
@ -2993,10 +2985,7 @@ char * msg_generate_message_id (void)
const char *host = 0;
const char *from = pCompPrefs.GetUserEmail();
#ifdef UNREADY_CODE
RNG_GenerateGlobalRandomBytes((void *) &salt, sizeof(salt));
#endif
GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
if (from) {
host = PL_strchr (from, '@');
if (host) {
@ -3021,13 +3010,13 @@ char * msg_generate_message_id (void)
static char * mime_generate_headers (nsMsgCompFields *fields,
const char *charset,
MSG_Deliver_Mode deliver_mode)
nsMsgDeliverMode deliver_mode)
{
int size = 0;
char *buffer = 0, *buffer_tail = 0;
PRBool isDraft = deliver_mode == MSG_SaveAsDraft ||
deliver_mode == MSG_SaveAsTemplate ||
deliver_mode == MSG_QueueForLater;
PRBool isDraft = deliver_mode == nsMsgSaveAsDraft ||
deliver_mode == nsMsgSaveAsTemplate ||
deliver_mode == nsMsgQueueForLater;
const char* pFrom;
const char* pTo;
@ -3086,8 +3075,8 @@ static char * mime_generate_headers (nsMsgCompFields *fields,
if (fields->GetReturnReceipt() &&
(fields->GetReturnReceiptType() == 2 ||
fields->GetReturnReceiptType() == 3) &&
(deliver_mode != MSG_SaveAsDraft &&
deliver_mode != MSG_SaveAsTemplate))
(deliver_mode != nsMsgSaveAsDraft &&
deliver_mode != nsMsgSaveAsTemplate))
{
PRInt32 receipt_header_type = 0;
@ -3778,7 +3767,7 @@ int MIME_GenerateMailtoFormPostHeaders (const char *old_post_url,
fields->SetDefaultBody(body, NULL);
*headers_return = mime_generate_headers (fields, 0, MSG_DeliverNow);
*headers_return = mime_generate_headers (fields, 0, nsMsgDeliverNow);
if (*headers_return == 0)
{
status = MK_OUT_OF_MEMORY;
@ -4283,8 +4272,8 @@ msg_pick_real_name (MSG_DeliverMimeAttachment *attachment, const char *charset)
int nsMsgSendMimeDeliveryState::HackAttachments(
const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments)
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments)
{
INTL_CharSetInfo c = LO_GetDocumentCharacterSetInfo(GetContext());
if (preloaded_attachments)
@ -4464,12 +4453,12 @@ void nsMsgSendMimeDeliveryState::StartMessageDelivery(
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
nsMsgSendPart *relatedPart,
//#endif
@ -4535,13 +4524,13 @@ nsMsgSendMimeDeliveryState::Init(
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
nsMsgSendPart *relatedPart,
//#endif
@ -4675,7 +4664,7 @@ nsMsgSendMimeDeliveryState::Init(
/* Check the fields for legitimacy, and run the callback if they're not
ok. */
if (mode != MSG_SaveAsDraft && mode != MSG_SaveAsTemplate ) {
if (mode != nsMsgSaveAsDraft && mode != nsMsgSaveAsTemplate ) {
failure = mime_sanity_check_fields (m_fields->GetFrom(), m_fields->GetReplyTo(),
m_fields->GetTo(), m_fields->GetCc(),
m_fields->GetBcc(), m_fields->GetFcc(),
@ -4718,7 +4707,7 @@ nsMsgSendMimeDeliveryState::Init(
if all attachments are provided externally.
Subsequent attachments are provided as URLs to load, described in the
MSG_AttachmentData structures.
nsMsgAttachmentData structures.
If `dont_deliver_p' is false, then we actually deliver the message to the
SMTP and/or NNTP server, and the message_delivery_done_callback will be
@ -4744,7 +4733,7 @@ MSG_StartMessageDelivery (MSG_Pane *pane,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
const struct nsMsgAttachmentData *attachments,
void *relatedPart,
void (*message_delivery_done_callback)
(MWContext *context,
@ -4776,11 +4765,11 @@ msg_StartMessageDeliveryWithAttachments (MSG_Pane *pane,
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachedFile *attachments,
const struct nsMsgAttachedFile *attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
void *relatedPart,
//#endif
@ -4808,12 +4797,12 @@ msg_StartMessageDeliveryWithAttachments (MSG_Pane *pane,
extern "C" int
msg_DownloadAttachments (MSG_Pane *pane,
void *fe_data,
const struct MSG_AttachmentData *attachments,
const struct nsMsgAttachmentData *attachments,
void (*attachments_done_callback)
(MWContext *context,
void *fe_data,
int status, const char *error_message,
struct MSG_AttachedFile *attachments))
struct nsMsgAttachedFile *attachments))
{
nsMsgSendMimeDeliveryState *state = 0;
int failure = 0;
@ -4838,7 +4827,7 @@ msg_DownloadAttachments (MSG_Pane *pane,
state->m_attachments_done_callback =
#ifdef XP_OS2
//DSR040297 - see comment above about 'Casting away extern "C"'
(void(*)(MWContext*,void*,int,const char*,MSG_AttachedFile*))
(void(*)(MWContext*,void*,int,const char*,nsMsgAttachedFile*))
#endif
attachments_done_callback;
@ -4979,19 +4968,19 @@ void nsMsgSendMimeDeliveryState::DeliverMessage ()
PRBool news_p = (m_fields->GetNewsgroups() &&
*(m_fields->GetNewsgroups()) ? PR_TRUE : PR_FALSE);
if ( m_deliver_mode != MSG_SaveAsDraft &&
m_deliver_mode != MSG_SaveAsTemplate )
if ( m_deliver_mode != nsMsgSaveAsDraft &&
m_deliver_mode != nsMsgSaveAsTemplate )
NS_ASSERTION(mail_p || news_p, "message without destination");
if (m_deliver_mode == MSG_QueueForLater) {
if (m_deliver_mode == nsMsgQueueForLater) {
QueueForLater();
return;
}
else if (m_deliver_mode == MSG_SaveAsDraft) {
else if (m_deliver_mode == nsMsgSaveAsDraft) {
SaveAsDraft();
return;
}
else if (m_deliver_mode == MSG_SaveAsTemplate) {
else if (m_deliver_mode == nsMsgSaveAsTemplate) {
SaveAsTemplate();
return;
}
@ -5277,7 +5266,7 @@ static int
mime_do_fcc_1 (MSG_Pane *pane,
const char *input_file_name, XP_FileType input_file_type,
const char *output_name, XP_FileType output_file_type,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *bcc_header,
const char *fcc_header,
const char *news_url)
@ -5370,13 +5359,13 @@ mime_do_fcc_1 (MSG_Pane *pane,
MK_MSG_COULDNT_OPEN_FCC_FILE */
switch (mode)
{
case MSG_SaveAsDraft:
case nsMsgSaveAsDraft:
status = MK_MSG_UNABLE_TO_SAVE_DRAFT;
break;
case MSG_SaveAsTemplate:
case nsMsgSaveAsTemplate:
status = MK_MSG_UNABLE_TO_SAVE_TEMPLATE;
break;
case MSG_DeliverNow:
case nsMsgDeliverNow:
default:
status = MK_MSG_COULDNT_OPEN_FCC_FILE;
break;
@ -5445,9 +5434,9 @@ mime_do_fcc_1 (MSG_Pane *pane,
For FCC files, we don't necessarily need one, but we might as well put
one in so that it's marked as read already.
*/
if (mode == MSG_QueueForLater ||
mode == MSG_SaveAsDraft ||
mode == MSG_SaveAsTemplate ||
if (mode == nsMsgQueueForLater ||
mode == nsMsgSaveAsDraft ||
mode == nsMsgSaveAsTemplate ||
mark_as_read)
{
char *buf = 0;
@ -5455,7 +5444,7 @@ mime_do_fcc_1 (MSG_Pane *pane,
mark_as_read = PR_TRUE;
flags |= MSG_FLAG_READ;
if (mode == MSG_QueueForLater )
if (mode == nsMsgQueueForLater )
flags |= MSG_FLAG_QUEUED;
buf = PR_smprintf(X_MOZILLA_STATUS_FORMAT MSG_LINEBREAK, flags);
if (buf)
@ -5467,7 +5456,7 @@ mime_do_fcc_1 (MSG_Pane *pane,
}
PRUint32 flags2 = 0;
if (mode == MSG_SaveAsTemplate)
if (mode == nsMsgSaveAsTemplate)
flags2 |= MSG_FLAG_TEMPLATE;
buf = PR_smprintf(X_MOZILLA_STATUS2_FORMAT MSG_LINEBREAK, flags2);
if (buf)
@ -5506,9 +5495,9 @@ mime_do_fcc_1 (MSG_Pane *pane,
folder, and that message is forwarded to someone, then the attachment
code will strip out the BCC header before forwarding it.)
*/
if ((mode == MSG_QueueForLater ||
mode == MSG_SaveAsDraft ||
mode == MSG_SaveAsTemplate) &&
if ((mode == nsMsgQueueForLater ||
mode == nsMsgSaveAsDraft ||
mode == nsMsgSaveAsTemplate) &&
fcc_header && *fcc_header)
{
PRInt32 L = PL_strlen(fcc_header) + 20;
@ -5553,9 +5542,9 @@ mime_do_fcc_1 (MSG_Pane *pane,
Convert a URL like "snews://host:123/" to the form "host:123/secure"
or "news://user@host:222" to simply "host:222".
*/
if ((mode == MSG_QueueForLater ||
mode == MSG_SaveAsDraft ||
mode == MSG_SaveAsTemplate) && news_url && *news_url)
if ((mode == nsMsgQueueForLater ||
mode == nsMsgSaveAsDraft ||
mode == nsMsgSaveAsTemplate) && news_url && *news_url)
{
PRBool secure_p = (news_url[0] == 's' || news_url[0] == 'S');
char *orig_hap = NET_ParseURL (news_url, GET_HOST_PART);
@ -5685,7 +5674,7 @@ mime_do_fcc_1 (MSG_Pane *pane,
}
if (mail_db != NULL && status >= 0) {
if ( mode == MSG_SaveAsDraft || mode == MSG_SaveAsTemplate )
if ( mode == nsMsgSaveAsDraft || mode == nsMsgSaveAsTemplate )
{
MSG_PostDeliveryActionInfo *actionInfo =
pane->GetPostDeliveryActionInfo();
@ -5795,7 +5784,7 @@ msg_DoFCC (MSG_Pane *pane,
return mime_do_fcc_1 (pane,
input_file, input_file_type,
output_file, output_file_type,
MSG_DeliverNow, bcc_header_value,
nsMsgDeliverNow, bcc_header_value,
fcc_header_value,
0);
}
@ -5863,9 +5852,9 @@ nsMsgSendMimeDeliveryState::GetOnlineFolderName(PRUint32 flag, const char
PRBool
nsMsgSendMimeDeliveryState::IsSaveMode()
{
return (m_deliver_mode == MSG_SaveAsDraft ||
m_deliver_mode == MSG_SaveAsTemplate ||
m_deliver_mode == MSG_SaveAs);
return (m_deliver_mode == nsMsgSaveAsDraft ||
m_deliver_mode == nsMsgSaveAsTemplate ||
m_deliver_mode == nsMsgSaveAs);
}
@ -6406,15 +6395,15 @@ PRUint32 nsMsgSendMimeDeliveryState::GetFolderFlagAndDefaultName(
switch (m_deliver_mode)
{
case MSG_SaveAsDraft:
case nsMsgSaveAsDraft:
*defaultName = DRAFTS_FOLDER_NAME;
flag = MSG_FOLDER_FLAG_DRAFTS;
break;
case MSG_SaveAsTemplate:
case nsMsgSaveAsTemplate:
*defaultName = TEMPLATES_FOLDER_NAME;
flag = MSG_FOLDER_FLAG_TEMPLATES;
break;
case MSG_DeliverNow:
case nsMsgDeliverNow:
*defaultName = SENT_FOLDER_NAME;
flag = MSG_FOLDER_FLAG_SENTMAIL;
break;
@ -6478,7 +6467,7 @@ nsMsgSendMimeDeliveryState::PostListImapMailboxFolder ( URL_Struct *url,
{
/* rhp- This is to handle failed copy operation BUT only if we are trying to send the
message. If not, then this was not a Send operation and this prompt doesn't make sense. */
if (state->m_deliver_mode == MSG_DeliverNow)
if (state->m_deliver_mode == nsMsgDeliverNow)
{
#ifdef UNREADY_CODE
if (FE_Confirm(state->GetContext(), XP_GetString(MK_MSG_FAILED_COPY_OPERATION)))

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

@ -54,11 +54,11 @@ msg_StartMessageDeliveryWithAttachments (MSG_Pane *pane,
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachedFile *attachments,
const struct nsMsgAttachedFile *attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
void *relatedPart,
//#endif
@ -80,20 +80,18 @@ public:
/* this macro defines QueryInterface, AddRef and Release for this class */
NS_DECL_ISUPPORTS
NS_IMETHOD SendMessage(nsIMsgCompFields *fields, const char *smtp);
void StartMessageDelivery(MSG_Pane *pane,
void StartMessageDelivery(MSG_Pane *pane,
void *fe_data,
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData
const struct nsMsgAttachmentData
*attachments,
const struct MSG_AttachedFile
const struct nsMsgAttachedFile
*preloaded_attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
nsMsgSendPart *relatedPart,
@ -104,17 +102,32 @@ public:
int status,
const char *error_message));
NS_IMETHOD SendMessage(
nsIMsgCompFields *fields,
const char *smtp,
PRBool digest_p,
PRBool dont_deliver_p,
PRInt32 mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
void *relatedPart,
void (*message_delivery_done_callback)(void *context, void *fe_data,
int status, const char *error_message));
int Init(MSG_Pane *pane,
void *fe_data,
nsMsgCompFields *fields,
PRBool digest_p,
PRBool dont_deliver_p,
MSG_Deliver_Mode mode,
nsMsgDeliverMode mode,
const char *attachment1_type,
const char *attachment1_body,
PRUint32 attachment1_body_length,
const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments,
const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments,
//#ifdef MSG_SEND_MULTIPART_RELATED
nsMsgSendPart *relatedPart,
//#endif
@ -159,8 +172,8 @@ public:
int DoFcc();
int HackAttachments(const struct MSG_AttachmentData *attachments,
const struct MSG_AttachedFile *preloaded_attachments);
int HackAttachments(const struct nsMsgAttachmentData *attachments,
const struct nsMsgAttachedFile *preloaded_attachments);
void DeliverFileAsMail();
void DeliverFileAsNews();
@ -183,15 +196,15 @@ public:
we created, instead of actually delivering
this message. */
MSG_Deliver_Mode m_deliver_mode; /* MSG_DeliverNow, MSG_QueueForLater,
MSG_SaveAsDraft, MSG_SaveAsTemplate
nsMsgDeliverMode m_deliver_mode; /* nsMsgDeliverNow, nsMsgQueueForLater,
nsMsgSaveAsDraft, nsMsgSaveAsTemplate
*/
PRBool m_attachments_only_p; /* If set, then we don't construct a complete
MIME message; instead, we just retrieve the
attachments from the network, store them in
tmp files, and return a list of
MSG_AttachedFile structs which describe
nsMsgAttachedFile structs which describe
them. */
PRBool m_pre_snarfed_attachments_p; /* If true, then the attachments were
@ -251,7 +264,7 @@ public:
void (*m_attachments_done_callback) (MWContext *context,
void * fe_data, int status,
const char * error_msg,
struct MSG_AttachedFile *attachments);
struct nsMsgAttachedFile *attachments);
char *m_msg_file_name; /* Our temporary file */
nsOutputFileStream * m_msg_file;

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

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

@ -19,10 +19,6 @@
#ifndef _MsgSendPart_H_
#define _MsgSendPart_H_
/*JFD
#include "msgzap.h"
#include "mimeenc.h"
*/
#include "msgCore.h"
#include "prprf.h" /* should be defined into msgCore.h? */
#include "net.h" /* should be defined into msgCore.h? */
@ -36,7 +32,6 @@ class nsMsgSendMimeDeliveryState;
typedef int (*MSG_SendPartWriteFunc)(const char* line, PRInt32 size,
PRBool isheader, void* closure);
class nsMsgSendPart : public MSG_ZapIt {
public:
nsMsgSendPart(nsMsgSendMimeDeliveryState* state, const char *part_charset = NULL);