From 302bf1b523012e11b60425d6eee1221ebc2724eb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 3 Nov 2019 00:17:46 -0400 Subject: Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1 --- mailnews/compose/public/moz.build | 35 ++ mailnews/compose/public/nsIMsgAttachment.idl | 124 +++++++ .../compose/public/nsIMsgAttachmentHandler.idl | 45 +++ mailnews/compose/public/nsIMsgCompFields.idl | 97 +++++ mailnews/compose/public/nsIMsgCompUtils.idl | 14 + mailnews/compose/public/nsIMsgCompose.idl | 307 ++++++++++++++++ mailnews/compose/public/nsIMsgComposeParams.idl | 81 +++++ .../compose/public/nsIMsgComposeProgressParams.idl | 16 + mailnews/compose/public/nsIMsgComposeSecure.idl | 25 ++ mailnews/compose/public/nsIMsgComposeService.idl | 147 ++++++++ mailnews/compose/public/nsIMsgQuote.idl | 35 ++ .../public/nsIMsgQuotingOutputStreamListener.idl | 16 + mailnews/compose/public/nsIMsgSend.idl | 405 +++++++++++++++++++++ mailnews/compose/public/nsIMsgSendLater.idl | 66 ++++ .../compose/public/nsIMsgSendLaterListener.idl | 86 +++++ mailnews/compose/public/nsIMsgSendListener.idl | 57 +++ mailnews/compose/public/nsIMsgSendReport.idl | 47 +++ mailnews/compose/public/nsISmtpServer.idl | 131 +++++++ mailnews/compose/public/nsISmtpService.idl | 134 +++++++ mailnews/compose/public/nsISmtpUrl.idl | 110 ++++++ mailnews/compose/public/nsIURLFetcher.idl | 38 ++ mailnews/compose/public/nsMsgAttachmentData.h | 115 ++++++ mailnews/compose/public/nsMsgCompCID.h | 247 +++++++++++++ 23 files changed, 2378 insertions(+) create mode 100644 mailnews/compose/public/moz.build create mode 100644 mailnews/compose/public/nsIMsgAttachment.idl create mode 100644 mailnews/compose/public/nsIMsgAttachmentHandler.idl create mode 100644 mailnews/compose/public/nsIMsgCompFields.idl create mode 100644 mailnews/compose/public/nsIMsgCompUtils.idl create mode 100644 mailnews/compose/public/nsIMsgCompose.idl create mode 100644 mailnews/compose/public/nsIMsgComposeParams.idl create mode 100644 mailnews/compose/public/nsIMsgComposeProgressParams.idl create mode 100644 mailnews/compose/public/nsIMsgComposeSecure.idl create mode 100644 mailnews/compose/public/nsIMsgComposeService.idl create mode 100644 mailnews/compose/public/nsIMsgQuote.idl create mode 100644 mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl create mode 100644 mailnews/compose/public/nsIMsgSend.idl create mode 100644 mailnews/compose/public/nsIMsgSendLater.idl create mode 100644 mailnews/compose/public/nsIMsgSendLaterListener.idl create mode 100644 mailnews/compose/public/nsIMsgSendListener.idl create mode 100644 mailnews/compose/public/nsIMsgSendReport.idl create mode 100644 mailnews/compose/public/nsISmtpServer.idl create mode 100644 mailnews/compose/public/nsISmtpService.idl create mode 100644 mailnews/compose/public/nsISmtpUrl.idl create mode 100644 mailnews/compose/public/nsIURLFetcher.idl create mode 100644 mailnews/compose/public/nsMsgAttachmentData.h create mode 100644 mailnews/compose/public/nsMsgCompCID.h (limited to 'mailnews/compose/public') diff --git a/mailnews/compose/public/moz.build b/mailnews/compose/public/moz.build new file mode 100644 index 000000000..038ebfd60 --- /dev/null +++ b/mailnews/compose/public/moz.build @@ -0,0 +1,35 @@ +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPIDL_SOURCES += [ + 'nsIMsgAttachment.idl', + 'nsIMsgAttachmentHandler.idl', + 'nsIMsgCompFields.idl', + 'nsIMsgCompose.idl', + 'nsIMsgComposeParams.idl', + 'nsIMsgComposeProgressParams.idl', + 'nsIMsgComposeSecure.idl', + 'nsIMsgComposeService.idl', + 'nsIMsgCompUtils.idl', + 'nsIMsgQuote.idl', + 'nsIMsgQuotingOutputStreamListener.idl', + 'nsIMsgSend.idl', + 'nsIMsgSendLater.idl', + 'nsIMsgSendLaterListener.idl', + 'nsIMsgSendListener.idl', + 'nsIMsgSendReport.idl', + 'nsISmtpServer.idl', + 'nsISmtpService.idl', + 'nsISmtpUrl.idl', + 'nsIURLFetcher.idl', +] + +XPIDL_MODULE = 'msgcompose' + +EXPORTS += [ + 'nsMsgAttachmentData.h', + 'nsMsgCompCID.h', +] + diff --git a/mailnews/compose/public/nsIMsgAttachment.idl b/mailnews/compose/public/nsIMsgAttachment.idl new file mode 100644 index 000000000..9a9c74859 --- /dev/null +++ b/mailnews/compose/public/nsIMsgAttachment.idl @@ -0,0 +1,124 @@ +/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(d17d2d60-ec3a-46de-8bd1-24c77dd9b87b)] +interface nsIMsgAttachment : nsISupports { + + /** + * name attribute + * + * @Attachment real name, will be sent with the attachment's header. + * @If no name has been provided, a name will be generated using the url. + */ + attribute AString name; + + /** + * url attribute + * + * @specify where the attachment live (localy or remotely) + */ + attribute AUTF8String url; + + /** + * urlCharset attribute + * + * @specify the Charset of url (used to convert url to Unicode after + * unescaping) + */ + attribute ACString urlCharset; + + + /** + * temporary attribute + * + * @If set to true, the file pointed by the url will be destroyed when this object is destroyed. + * @This is only for local attachment. + */ + attribute boolean temporary; + + /** + * Are we storing this attachment via a cloud provider and linking to it? + */ + attribute boolean sendViaCloud; + + /** + * Cloud provider account key for this attachment, if any. + */ + attribute ACString cloudProviderKey; + + /** + * This allows the compose front end code to put whatever html annotation + * it wants for the cloud part, e.g., with expiration time, etc. + */ + attribute AString htmlAnnotation; + + /** + * contentLocation attribute + * + * @Specify the origin url of the attachment, used normally when attaching + * a locally saved html document, but also used for cloud files. + */ + attribute ACString contentLocation; + + /** + * contentType attribute + * + * @Specify the content-type of the attachment, this does not include extra content-type parameters. If + * @you need to specify extra information, use contentTypeParam, charset, macType or macCreator. + * @If ommitted, it will be determined base on either the name, the url or the content of the file. + */ + attribute string contentType; + + /** + * contentTypeParam attribute + * + * @Specify the any content-type parameter (other than the content-type itself, charset, macType or macCreator). + * @It will be added to the content-type during the send/save operation. + */ + attribute string contentTypeParam; + + /** + * charset attribute + * + * @Specify the charset of the attachment. It will be added to the content-type during the + * @send/save operation + * @If omitted, will be determined automatically (if possible). + */ + attribute string charset; + + /** + * size attribute + * + * @Specify the size of the attachment. + */ + attribute int64_t size; + + /** + * macType attribute + * + * @Specify the Mac file type of the attachment. It will be added to the content-type during the + * @send/save operation + * @If omitted, will be determined automatically on Macintosh OS. + */ + attribute string macType; + + /** + * macCreator attribute + * + * @Specify the Mac file creator of the attachment. It will be added to the content-type during the + * @send/save operation + * @If omitted, will be determined automatically on Macintosh OS. + */ + attribute string macCreator; + + /** + * equalsUrl + * + * @ determines if both attachments have the same url. + */ + boolean equalsUrl(in nsIMsgAttachment attachment); +}; diff --git a/mailnews/compose/public/nsIMsgAttachmentHandler.idl b/mailnews/compose/public/nsIMsgAttachmentHandler.idl new file mode 100644 index 000000000..ac7c4f825 --- /dev/null +++ b/mailnews/compose/public/nsIMsgAttachmentHandler.idl @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +interface nsIFile; + +// This interface provides minimal XPCONNECT access to objects of type +// nsMsgAttachmentHandler. This is primarily for use with new account +// types and JsAccount, so this is probably not the interface that you +// want if you are working with standard account types. + +[scriptable, uuid(1731283c-60fe-4102-a804-622a84cc1a08)] +interface nsIMsgAttachmentHandler : nsISupports +{ + /// The real type, once we know it. + readonly attribute ACString type; + + /// URI with link to the attachment. + readonly attribute ACString uri; + + /// The temp file to which we save it. + readonly attribute nsIFile tmpFile; + + /// The name for the headers, if different from the URL. + readonly attribute AUTF8String name; + + /// Size of the attachment, in bytes. + readonly attribute unsigned long size; + + /// This is for multipart/related Content-ID's. + readonly attribute ACString contentId; + + /// True if this should be sent as a link to a file. + readonly attribute boolean sendViaCloud; + + /// Name of the character set for the attachment. + readonly attribute ACString charset; + + /// The encoding, once we've decided. + readonly attribute ACString encoding; + + /// Whether the attachment has been encoded, for example to base64. + readonly attribute boolean alreadyEncoded; +}; diff --git a/mailnews/compose/public/nsIMsgCompFields.idl b/mailnews/compose/public/nsIMsgCompFields.idl new file mode 100644 index 000000000..5562457d9 --- /dev/null +++ b/mailnews/compose/public/nsIMsgCompFields.idl @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "msgIStructuredHeaders.idl" + +interface nsIMsgAttachment; +interface nsISimpleEnumerator; + +/** + * A collection of headers and other attributes for building a mail message. + */ +[scriptable, uuid(10928477-4F24-4357-9397-FBD847F46F0A)] +interface nsIMsgCompFields : msgIWritableStructuredHeaders { + + attribute AString from; + attribute AString replyTo; + attribute AString to; + attribute AString cc; + attribute AString bcc; + readonly attribute bool hasRecipients; + + attribute AString fcc; + attribute AString fcc2; + + attribute AString newsgroups; + attribute string newspostUrl; + attribute AString followupTo; + + attribute AString subject; + + attribute AString organization; + attribute string references; + attribute string priority; + attribute string messageId; + attribute string characterSet; + readonly attribute string defaultCharacterSet; + + attribute AString templateName; + attribute string draftId; + + attribute boolean returnReceipt; + attribute long receiptHeaderType; + attribute boolean DSN; + attribute boolean attachVCard; + attribute boolean forcePlainText; + attribute boolean useMultipartAlternative; + attribute boolean bodyIsAsciiOnly; + attribute boolean forceMsgEncoding; + /// Status of manually-activated attachment reminder. + attribute boolean attachmentReminder; + /// Delivery format for the mail being composed + /// (auto = 4, text = 1, html = 2, text and html = 3). + attribute long deliveryFormat; + attribute string contentLanguage; + /// This is populated with the key of the identity which created the draft or template. + attribute string creatorIdentityKey; + + /** + * Beware that when setting this property, your body must be properly wrapped, + * and the line endings must match MSG_LINEBREAK, namely "\r\n" on Windows + * and "\n" on Linux and OSX. + */ + attribute AString body; + + readonly attribute nsISimpleEnumerator attachments; + void addAttachment(in nsIMsgAttachment attachment); + void removeAttachment(in nsIMsgAttachment attachment); + void removeAttachments(); + + /** + * This function will split the recipients into an array. + * + * @param aRecipients The recipients list to split. + * @param aEmailAddressOnly Set to true to drop display names from the results + * array. + * @param aLength The length of the aResult array. + * @param aResult An array of the recipients. + */ + void splitRecipients(in AString aRecipients, in boolean aEmailAddressOnly, + out unsigned long aLength, + [array, size_is(aLength), retval] out wstring aResult); + + void ConvertBodyToPlainText(); + + /** + * Indicates whether we need to check if the current |DocumentCharset| + * can represent all the characters in the message body. It should be + * initialized to true and set to false when 'Send Anyway' is selected + * by a user. (bug 249530) + */ + attribute boolean needToCheckCharset; + + attribute nsISupports securityInfo; +}; + diff --git a/mailnews/compose/public/nsIMsgCompUtils.idl b/mailnews/compose/public/nsIMsgCompUtils.idl new file mode 100644 index 000000000..6d37a8474 --- /dev/null +++ b/mailnews/compose/public/nsIMsgCompUtils.idl @@ -0,0 +1,14 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIMsgIdentity.idl" + +[scriptable, uuid(00b4569a-077e-4236-b993-980fd82bb948)] +interface nsIMsgCompUtils : nsISupports { + string mimeMakeSeparator(in string prefix); + string msgGenerateMessageId(in nsIMsgIdentity identity); + readonly attribute boolean msgMimeConformToStandard; +}; diff --git a/mailnews/compose/public/nsIMsgCompose.idl b/mailnews/compose/public/nsIMsgCompose.idl new file mode 100644 index 000000000..cc98d2460 --- /dev/null +++ b/mailnews/compose/public/nsIMsgCompose.idl @@ -0,0 +1,307 @@ +/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIMsgCompFields.idl" +#include "nsIMsgComposeParams.idl" +#include "nsIMsgSendListener.idl" + +%{C++ +#include "nsStringGlue.h" +%} + +interface nsIMsgSend; +interface nsIMsgIdentity; +interface nsIMsgProgress; +interface nsIDocShell; +interface mozIDOMWindowProxy; +interface nsIEditor; +interface nsIMsgWindow; + +typedef long MSG_ComposeSaveType; + +[scriptable, uuid(6953e50a-7531-11d3-85fe-006008948010)] +interface nsIMsgCompSaveType { + const long File = 0; + const long Template = 1; + const long Draft = 2; +}; + +typedef long MSG_DeliverMode; + +[scriptable, uuid(a9f27dd7-8f89-4de3-8fbf-41b789c16ee5)] +interface nsIMsgCompDeliverMode { + const long Now = 0; + const long Later = 1; + const long Save = 2; + const long SaveAs = 3; + const long SaveAsDraft = 4; + const long SaveAsTemplate = 5; + const long SendUnsent = 6; + const long AutoSaveAsDraft = 7; + const long Background = 8; +}; + +[scriptable, uuid(f38ea280-e090-11d3-a449-e3153319347c)] +interface nsIMsgCompSendFormat { + const long AskUser = 4; /* Hack: Bug 44512. If this is 0 and passed + as results.action to the askSendFormat + dialog, the args object gets destroyed.*/ + const long PlainText = 1; + const long HTML = 2; + const long Both = 3; +}; + +[scriptable, uuid(9638af92-1dd1-11b2-bef1-ca5fee0abc62)] +interface nsIMsgCompConvertible/*ToTXT*/ { + const long Plain = 1; // Like 4.x: Only ,

,
, ... + const long Yes = 2; // *Minor* alterations of the look:

    ,
    , ... + const long Altering = 3; /* Look altered: , ,

    , ... + Can be expressed in plaintext, but not in + the way it looked in the HTML composer. */ + const long No = 4; /* Will lose data: , ... + Really *requires* visual formatting or + is not supported by our HTML->TXT converter. */ + /* The values here have meaning, they are "levels": + convertible({a; b}) == max(convertible({a}), convertible({b})) + must be true, i.e. the higher value counts. */ +}; + +[scriptable, uuid(6ce49b2a-07dc-4783-b307-9a355423163f)] +interface nsIMsgComposeStateListener : nsISupports +{ + /* ... */ + void NotifyComposeFieldsReady(); + void ComposeProcessDone(in nsresult aResult); + void SaveInFolderDone(in string folderName); + void NotifyComposeBodyReady(); +}; + +[scriptable, uuid(061aae23-7e0a-4818-9a15-1b5db3ceb7f4)] +interface nsIMsgComposeNotificationType +{ + const long ComposeFieldsReady = 0; + const long ComposeProcessDone = 1; + const long SaveInFolderDone = 2; + const long ComposeBodyReady = 3; +}; + +native nsString(nsString); +[ref] native nsStringRef(nsString); + +[scriptable, uuid(c6544b6b-06dd-43ac-89b5-949d7c81bb7b)] +interface nsIMsgCompose : nsIMsgSendListener { + + /** + * Initializes the msg compose object. + * + * @param aParams An nsIMsgComposeParams object containing the initial + * details for the compose. + * @param aWindow The optional window associated with this compose object. + * @param aDocShell The optional docShell of the editor element that is used + * for composing. + */ + void initialize(in nsIMsgComposeParams aParams, + [optional] in mozIDOMWindowProxy aWindow, + [optional] in nsIDocShell aDocShell); + + /* ... */ + void SetDocumentCharset(in string charset); + + /* ... */ + void RegisterStateListener(in nsIMsgComposeStateListener stateListener); + + /* ... */ + void UnregisterStateListener(in nsIMsgComposeStateListener stateListener); + + /* ... */ + void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in string accountKey, in nsIMsgWindow aMsgWindow, in nsIMsgProgress progress); + + /** + * After all Compose preparations are complete, send the prepared message to + * the server. This exists primarily to allow an override of the sending to + * use a non-SMTP method for send. + * + * @param deliverMode One of the nsIMsgCompDeliverMode values. + * @param identity The message identity. + * @param accountKey The message account key. + */ + void sendMsgToServer(in MSG_DeliverMode deliverMode, + in nsIMsgIdentity identity, + in string accountKey); + + /* ... */ + void CloseWindow(); + + /* ... */ + void abort(); + + /* ... */ + void quoteMessage(in string msgURI); + + /* + AttachmentPrettyName will return only the leafName if the it's a file URL. + It will also convert the filename to Unicode assuming it's in the file system + charset. In case of URL, |charset| parameter will be used in the conversion. + This UI utility function should probably go into it's own class + */ + AUTF8String AttachmentPrettyName(in AUTF8String url, in string charset); + + /** + * Expand all mailing lists in the relevant compose fields to include the + * members of their output. This method will additionally update the + * popularity field of cards in the addressing header. + */ + void expandMailingLists(); + + /** + * Returns how we should send this message in terms of HTML, plaintext, or + * both. Note that this method should not be called until after mailing lists + * have been expanded if correct results are desired. + * + * @param aConvertible The convertability of the body (from + * nsIMsgCompConvertible). + * @return The HTML action to use (from nsIMsgCompSendFormat). + */ + long determineHTMLAction(in long aConvertible); + + /** + * The level of "convertibility" of the message body (whole HTML document) + * to plaintext. + * + * @return a value from nsIMsgCompConvertible. + */ + long bodyConvertible(); + + /** + * The identity currently selected for the message compose object. When set + * this may change the signature on a message being composed. Note that + * typically SendMsg will be called with the same identity as is set here, but + * if it is different the SendMsg version will overwrite this identity. + */ + attribute nsIMsgIdentity identity; + + /* Check if the composing mail headers (and identity) can be converted to a mail charset. + */ + boolean checkCharsetConversion(in nsIMsgIdentity identity, out string fallbackCharset); + + /* The message send object. This is created by default to be the SMTP server + * in sendMsgToServer, but if that method is overridden, set the actual + * value used here. + */ + attribute nsIMsgSend messageSend; + + /* + * Clear the messageSend object to break any circular references + */ + void clearMessageSend(); + + /* ... */ + attribute nsIEditor editor; + + /* ... */ + readonly attribute mozIDOMWindowProxy domWindow; + + /* ... */ + readonly attribute nsIMsgCompFields compFields; + + /* ... */ + readonly attribute boolean composeHTML; + + /* ... */ + attribute MSG_ComposeType type; + + /* ... */ + readonly attribute long wrapLength; + + /* by reading this value, you can determine if yes or not the message has been mofified + by the user. When you set this value to false, you reset the modification count + of the body to 0 (clean). + */ + attribute boolean bodyModified; + + /* The body string is stored as a byte string in comp fields, but is converted to + * UTF16 when fetched by GetBody(). Fetch the body without conversion. + */ + readonly attribute ACString bodyRaw; + + /** + * Init the editor THIS USED TO BE [noscript] + * Now, this is called after editor is created, + * which is triggered by loading startup url from JS. + * The completion of document loading is detected by observing + * the "obs_documentCreated" command + */ + void initEditor(in nsIEditor editor, in mozIDOMWindowProxy contentWindow); + + /* The following functions are for internal use, essentially for the listener */ + + /* ... */ + [noscript] void setCiteReference(in nsString citeReference); + + /* Set the URI of the folder where the message has been saved */ + attribute string savedFolderURI; + + /* Append the signature defined in the identity to the msgBody */ + [noscript] void processSignature(in nsIMsgIdentity identity, + in boolean aQuoted, + inout nsString aMsgBody); + + /* set any reply flags on the original message's folder */ + [noscript] void processReplyFlags(); + [noscript] void rememberQueuedDisposition(); + + /* ... */ + [noscript] void convertAndLoadComposeWindow(in nsStringRef aPrefix, + in nsStringRef aBuf, + in nsStringRef aSignature, + in boolean aQuoted, + in boolean aHTMLEditor); + + /* Tell the doc state listeners that the doc state has changed + * aNotificationType is from nsIMsgComposeNotificationType + */ + [noscript] void notifyStateListeners(in long aNotificationType, in nsresult aResult); + + /* Retreive the progress object */ + readonly attribute nsIMsgProgress progress; + + /* ... */ + [noscript] void buildBodyMessageAndSignature(); + + /* ... */ + [noscript] void buildQuotedMessageAndSignature(); + + /* ... */ + [noscript] void getQuotingToFollow(out boolean quotingToFollow); + + readonly attribute string originalMsgURI; + + attribute boolean deleteDraft; + + /* true when the compose window is in the process of inserting quoted content + (i.e. via reply, forward inline or a quoting operation) into the document + */ + attribute boolean insertingQuotedContent; + + /* for easier use of nsIMsgSendListener */ + void addMsgSendListener(in nsIMsgSendListener sendListener); + + /* for easier use of nsIMsgSendListener */ + void removeMsgSendListener(in nsIMsgSendListener sendListener); + + /// Access during mail-set-sender observer if needed, see nsIMsgCompDeliverMode. + readonly attribute MSG_DeliverMode deliverMode; + +}; + +/* send listener interface */ +[scriptable, uuid(ad6ee068-b225-47f9-a50e-8e48440282ca)] +interface nsIMsgComposeSendListener : nsISupports { + + void setMsgCompose(in nsIMsgCompose msgCompose); + void setDeliverMode(in MSG_DeliverMode deliverMode); + +}; diff --git a/mailnews/compose/public/nsIMsgComposeParams.idl b/mailnews/compose/public/nsIMsgComposeParams.idl new file mode 100644 index 000000000..87c15eac3 --- /dev/null +++ b/mailnews/compose/public/nsIMsgComposeParams.idl @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "nsISupports.idl" +#include "nsIMsgIdentity.idl" +#include "nsIMsgCompFields.idl" +#include "nsIMsgSendListener.idl" + +interface nsIMsgDBHdr; +typedef long MSG_ComposeType; + +[scriptable, uuid(c7035852-7531-11d3-9a73-006008948010)] +interface nsIMsgCompType { + const long New = 0; + const long Reply = 1; + const long ReplyAll = 2; + const long ForwardAsAttachment = 3; + const long ForwardInline = 4; + const long NewsPost = 5; + const long ReplyToSender = 6; + const long ReplyToGroup = 7; + const long ReplyToSenderAndGroup = 8; + const long Draft = 9; + const long Template = 10; + const long MailToUrl = 11; + const long ReplyWithTemplate = 12; + const long ReplyToList = 13; + + /** + * Will resend the original message keeping the Subject and the body the + * same, and will set the Reply-To: header to the sender of the original + * message. This gets the redirector "out of the loop" because replies + * to the message will go to the original sender. This is not the same + * as the Resent mechanism described in section 3.6.6 of RFC 2822, and + * so therefore does not use Resent-* headers. + */ + const long Redirect = 14; + + /** + * Add this value to a reply type to suppress quoting the current selection + * which may not belong to the message being replied to. + */ + const long ReplyIgnoreQuote = 100; +}; + + +typedef long MSG_ComposeFormat; + +[scriptable, uuid(a28325e8-7531-11d3-8f1c-006008948010)] +interface nsIMsgCompFormat { + const long Default = 0; + const long HTML = 1; + const long PlainText = 2; + const long OppositeOfDefault = 3; +}; + + +[scriptable, uuid(930895f2-d610-43f4-9e3c-25e1d1fe4143)] +interface nsIMsgComposeParams : nsISupports { + attribute MSG_ComposeType type; + attribute MSG_ComposeFormat format; + attribute string originalMsgURI; + attribute nsIMsgIdentity identity; + + attribute nsIMsgCompFields composeFields; + attribute boolean bodyIsLink; + + attribute nsIMsgSendListener sendListener; + attribute string smtpPassword; + attribute nsIMsgDBHdr origMsgHdr; + + /** + * HTML-formatted content to quote in the body of the message. + * Set this to get different content than what would normally + * appear in the body, e.g. the original message body in a reply. + */ + attribute AUTF8String htmlToQuote; +}; diff --git a/mailnews/compose/public/nsIMsgComposeProgressParams.idl b/mailnews/compose/public/nsIMsgComposeProgressParams.idl new file mode 100644 index 000000000..f3bb301bd --- /dev/null +++ b/mailnews/compose/public/nsIMsgComposeProgressParams.idl @@ -0,0 +1,16 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "nsISupports.idl" +#include "nsIMsgCompose.idl" + +[scriptable, uuid(1e0e7c00-3e4c-11d5-9daa-f88d288130fc)] +interface nsIMsgComposeProgressParams: nsISupports { + + /* message subject */ + attribute wstring subject; + + /* delivery mode */ + attribute MSG_DeliverMode deliveryMode; +}; diff --git a/mailnews/compose/public/nsIMsgComposeSecure.idl b/mailnews/compose/public/nsIMsgComposeSecure.idl new file mode 100644 index 000000000..20981bea4 --- /dev/null +++ b/mailnews/compose/public/nsIMsgComposeSecure.idl @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIMsgSendReport.idl" +#include "nsISupports.idl" + +interface nsIMsgCompFields; +interface nsIMsgIdentity; +interface nsIOutputStream; + +/* Security interface */ +[scriptable, uuid(245f2adc-410e-4bdb-91e2-a7bb42d61787)] +interface nsIMsgComposeSecure : nsISupports +{ + // requiresCryptoEncapsulation --> returns true if the current message send requires us to go through + // some encryption work. In the case of false, you can disregard the compose secure object. + boolean requiresCryptoEncapsulation(in nsIMsgIdentity aIdentity, in nsIMsgCompFields aCompFields); + + void beginCryptoEncapsulation(in nsIOutputStream aStream, in string aRecipients, in nsIMsgCompFields aCompFields, in nsIMsgIdentity aIdentity, in nsIMsgSendReport sendReport, in boolean aIsDraft); + void finishCryptoEncapsulation(in boolean aAbort, in nsIMsgSendReport sendReport); + void mimeCryptoWriteBlock(in string aBuf, in long aLen); +}; diff --git a/mailnews/compose/public/nsIMsgComposeService.idl b/mailnews/compose/public/nsIMsgComposeService.idl new file mode 100644 index 000000000..ce8cf4a1b --- /dev/null +++ b/mailnews/compose/public/nsIMsgComposeService.idl @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "nsISupports.idl" +#include "nsIMsgCompose.idl" +#include "nsIMsgComposeParams.idl" + +interface nsIURI; +interface nsIDocShell; +interface nsIMsgWindow; +interface nsIMsgIdentity; +interface nsIMsgIncomingServer; +interface nsIMsgDBHdr; + +[scriptable, uuid(041782bf-e523-444b-a268-d90868fd2b50)] +interface nsIMsgComposeService : nsISupports { + + /* we need a msg window because when we forward inline we may need progress */ + void OpenComposeWindow(in string msgComposeWindowURL, + in nsIMsgDBHdr msgHdr, + in string originalMsgURI, + in MSG_ComposeType type, + in MSG_ComposeFormat format, + in nsIMsgIdentity identity, + in nsIMsgWindow aMsgWindow); + + /** + * Open a compose window given a mailto url and (optionally) an identity. + * + * @param aMsgComposeWindowURL Can be null in most cases. If you have your + * own chrome url you want to use in bringing up a + * compose window, pass it in here. + * @param aURI The mailto url you want to use as the + * foundation for the data inside the compose + * window. + * @param aIdentity An optional identity to send the message from. + */ + void OpenComposeWindowWithURI(in string msgComposeWindowURL, + in nsIURI aURI, + [optional] in nsIMsgIdentity aIdentity); + + /* ... */ + void OpenComposeWindowWithParams(in string msgComposeWindowURL, in nsIMsgComposeParams params); + + /** + * Creates an nsIMsgCompose instance and initalizes it. + * + * @param aParams An nsIMsgComposeParams object containing the initial + * details for the compose. + * @param aWindow The optional window associated with this compose object. + * @param aDocShell The optional docShell of the editor element that is used + * for composing. + */ + nsIMsgCompose initCompose(in nsIMsgComposeParams aParams, + [optional] in mozIDOMWindowProxy aWindow, + [optional] in nsIDocShell aDocShell); + + /** + * defaultIdentity + * + * @return the default identity, in case no identity has been setup yet, will return null + */ + readonly attribute nsIMsgIdentity defaultIdentity; + + /* This function is use for debugging purpose only and may go away at anytime without warning */ + void TimeStamp(in string label, in boolean resetTime); + + /* This attribute is use for debugging purposes for determining whether to PR_LOG or not */ + readonly attribute boolean logComposePerformance; + + [noscript] boolean determineComposeHTML(in nsIMsgIdentity aIdentity, in MSG_ComposeFormat aFormat); + + /** + * given a mailto url, parse the attributes and turn them into a nsIMsgComposeParams object + * @return nsIMsgComposeParams which corresponds to the passed in mailto url + */ + nsIMsgComposeParams getParamsForMailto(in nsIURI aURI); + + /** + * @{ + * These constants control how to forward messages in forwardMessage. + * kForwardAsDefault uses value of pref "mail.forward_message_mode". + */ + const unsigned long kForwardAsDefault = 0; + const unsigned long kForwardAsAttachment = 1; + const unsigned long kForwardInline = 2; + /** @} */ + + /** + * Allow filters to automatically forward a message to the given address(es). + * @param forwardTo the address(es) to forward to + * @param msgHdr the header of the message being replied to + * @param msgWindow message window to use + * @param server server to use for determining which account to send from + * @param aForwardType - How to forward the message one of 3 values: + * kForwardAsDefault, kForwardInline, or + * kForwardAsAttachment. + */ + void forwardMessage(in AString forwardTo, in nsIMsgDBHdr msgHdr, + in nsIMsgWindow msgWindow, in nsIMsgIncomingServer server, + in unsigned long aForwardType); + + /** + * Allow filters to automatically reply to a message. The reply message is + * based on the given template. + * @param msgHdr the header of the message being replied to + * @param templateUri uri of the template to base ther reply on + * @param msgWindow message window to use + * @param server server to use for determining which account to send from + */ + void replyWithTemplate(in nsIMsgDBHdr msgHdr, in string templateUri, + in nsIMsgWindow msgWindow, in nsIMsgIncomingServer server); + + /** + * The docShell of each editor element used for composing should be registered + * with this service. docShells passed to initCompose get registered + * automatically. The registrations are typically used to get the msgCompose + * window when determining what remote content to allow to be displayed. + * + * @param aDocShell The nsIDocShell of the editor element. + * @param aMsgCompose The compose object associated with the compose window + */ + void registerComposeDocShell(in nsIDocShell aDocShell, + in nsIMsgCompose aMsgCompose); + + /** + * When an editor docShell is being closed, you should + * unregister it from this service. nsIMsgCompose normally calls this + * automatically for items passed to initCompose. + * + * @param aDocShell The nsIDocShell of the editor element. + */ + void unregisterComposeDocShell(in nsIDocShell aDocShell); + + /** + * For a given docShell, returns the nsIMsgCompose object associated with it. + * + * @param aDocShell The nsIDocShell of the editor element. + * + * @return NS_ERROR_FAILURE if we could not find a nsIMsgCompose for + * the passed in docShell. + */ + nsIMsgCompose getMsgComposeForDocShell(in nsIDocShell aDocShell); +}; diff --git a/mailnews/compose/public/nsIMsgQuote.idl b/mailnews/compose/public/nsIMsgQuote.idl new file mode 100644 index 000000000..9ec330d8e --- /dev/null +++ b/mailnews/compose/public/nsIMsgQuote.idl @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "nsISupports.idl" +#include "nsIMsgQuotingOutputStreamListener.idl" +#include "nsIChannel.idl" +#include "nsIMimeStreamConverter.idl" + +interface nsIMsgDBHdr; + +[scriptable, uuid(f79b1d55-f546-4ed5-9f75-9428e35c4eff)] +interface nsIMsgQuote : nsISupports { + + /** + * Quote a particular message specified by its URI. + * + * @param charset optional parameter - if set, force the message to be + * quoted using this particular charset + */ + void quoteMessage(in string msgURI, in boolean quoteHeaders, + in nsIMsgQuotingOutputStreamListener streamListener, + in string charset, in boolean headersOnly, + in nsIMsgDBHdr aOrigHdr); + + readonly attribute nsIMimeStreamConverterListener quoteListener; + readonly attribute nsIChannel quoteChannel; + readonly attribute nsIMsgQuotingOutputStreamListener streamListener; +}; + +[scriptable, uuid(1EC75AD9-88DE-11d3-989D-001083010E9B)] +interface nsIMsgQuoteListener : nsIMimeStreamConverterListener +{ + attribute nsIMsgQuote msgQuote; +}; diff --git a/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl b/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl new file mode 100644 index 000000000..ac86361ab --- /dev/null +++ b/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl @@ -0,0 +1,16 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIStreamListener.idl" + +interface nsIMimeHeaders; + +[scriptable, uuid(1fe345e6-2428-4a43-a0c6-d2acea0d4da4)] +interface nsIMsgQuotingOutputStreamListener : nsIStreamListener { + + // The headers are used to fill in the reply's compose fields + void setMimeHeaders(in nsIMimeHeaders headers); + +}; diff --git a/mailnews/compose/public/nsIMsgSend.idl b/mailnews/compose/public/nsIMsgSend.idl new file mode 100644 index 000000000..d1bda4abf --- /dev/null +++ b/mailnews/compose/public/nsIMsgSend.idl @@ -0,0 +1,405 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * The nsIMsgSend method will create an RFC822 message and send it all in one operation + * as well as providing the ability to save disk files for later use. The mode of delivery + * can also be specified for the "Send Later", "Drafts" and "Templates" operations. (NOTE: + * This method could easily be broken in to a few different calls. Currently, this method + * does several functions depending on the arguments passed in, but this could easily lead + * to confusion. This is something that very well may change as time allows). + */ +#include "nsISupports.idl" +#include "nsrootidl.idl" +#include "nsIMsgIdentity.idl" +#include "nsIMsgCompFields.idl" +#include "nsIMsgSendListener.idl" +#include "nsIMsgSendReport.idl" +#include "domstubs.idl" +#include "nsIPrompt.idl" +#include "MailNewsTypes2.idl" +#include "nsIMsgComposeParams.idl" + +interface nsIMsgProgress; +interface nsIURI; +interface nsIRequest; +interface nsIMsgDBHdr; +interface nsIMsgHdr; +interface nsIFile; +interface nsIOutputStream; +interface nsIMsgComposeSecure; +interface nsIMsgStatusFeedback; +interface nsIEditor; +interface nsIArray; +interface nsIMsgAttachmentHandler; +interface mozIDOMWindowProxy; + +typedef long nsMsgDeliverMode; + +[scriptable, uuid(c658cd1f-dc4a-43c0-911c-c6d3e569ca7e)] +interface nsIMsgAttachmentData : nsISupports +{ + /// The URL to attach. + attribute nsIURI url; + + /** + * 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. + */ + attribute ACString desiredType; + + /** + * The type of the URL if known, otherwise empty. For example, if + * you were attaching a temp file which was known to contain HTML data, + * you would pass in TEXT_HTML as the realType, to override whatever type + * the name of the tmp file might otherwise indicate. + */ + attribute ACString realType; + + /// Goes along with real_type. + attribute ACString realEncoding; + + /** + * 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. + */ + attribute ACString realName; + /** + * 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. + */ + attribute ACString description; + + /// mac-specific info + attribute ACString xMacType; + + /// mac-specific info + attribute ACString xMacCreator; +}; + +/** + * 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. + */ +[scriptable, uuid(c552345d-c74b-40b0-a673-79bb461e920b)] +interface nsIMsgAttachedFile : nsISupports +{ + /// Where it came from on the network (or even elsewhere on the local disk.) + attribute nsIURI origUrl; + + /// The tmp file in which the (possibly converted) data now resides. + attribute nsIFile tmpFile; + + /// The type of the data in file_name (not necessarily the same as the type of orig_url.) + attribute ACString type; + + /** + * 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. + */ + attribute ACString encoding; + /// For Content-Description header. + attribute ACString description; + + /// X-Mozilla-Cloud-Part, if any. + attribute ACString cloudPartInfo; + + attribute ACString xMacType; // mac-specific info + attribute ACString xMacCreator; // mac-specific info + attribute ACString realName; // 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.) + */ + attribute unsigned long size; + attribute unsigned long unprintableCount; + attribute unsigned long highbitCount; + attribute unsigned long ctlCount; + attribute unsigned long nullCount; + attribute unsigned long maxLineLength; +}; + +/** + * This interface is used by Outlook import to shuttle embedded + * image information over to nsIMsgSend's createRFC822Message method via + * the aEmbbeddedObjects parameter. + */ +[scriptable, uuid(5d2c6554-b4c8-4d68-b864-50e0df929707)] +interface nsIMsgEmbeddedImageData : nsISupports +{ + attribute nsIURI uri; + attribute ACString cid; + attribute ACString name; +}; + +%{ C++ +// Forward declaration +class nsMsgAttachmentHandler; +#include "nsAutoPtr.h" +#include "nsTArray.h" +%} + +[ptr] native nsMsgAttachedFile(nsMsgAttachedFile); +[ptr] native nsMsgAttachmentHandlerArray(nsTArray>); + +[scriptable, uuid(747fdfa2-1754-4282-ab26-1e55fd8de13c)] +interface nsIMsgSend : nsISupports +{ + // + // This is the primary interface for creating and sending RFC822 messages + // in the new architecture. Currently, this method supports many arguments + // that change the behavior of the operation. This will change in time to + // be separate calls that will be more singluar in nature. + // + // NOTE: when aEditor is non-null, a multipart related MHTML message will + // be created + // + + /// Send the message straight away. + const nsMsgDeliverMode nsMsgDeliverNow = 0; + /** + * Queue the message for sending later, but then wait for the user to + * request to send it. + */ + const nsMsgDeliverMode nsMsgQueueForLater = 1; + const nsMsgDeliverMode nsMsgSave = 2; + const nsMsgDeliverMode nsMsgSaveAs = 3; + const nsMsgDeliverMode nsMsgSaveAsDraft = 4; + const nsMsgDeliverMode nsMsgSaveAsTemplate = 5; + const nsMsgDeliverMode nsMsgSendUnsent = 6; + + /// Queue the message in the unsent folder and send it in the background. + const nsMsgDeliverMode nsMsgDeliverBackground = 8; + + /** + * Create an rfc822 message and send it. + * @param aEditor nsIEditor instance that contains message. May be a dummy, + * especially in the case of import. + * @param aUserIdentity identity to send from. + * @param aAccountKey account we're sending message from. May be null. + * @param aFields composition fields from addressing widget + * @param aIsDigest is this a digest message? + * @param aDontDeliver Set to false by the import code - used when we're + * trying to create a message from parts. + * @param aMode delivery mode + * @param aMsgToReplace e.g., when saving a draft over an old draft. May be 0 + * @param aBodyType content type of message body + * @param aBody message body text (should have native line endings) + * @param aAttachments Array of nsIMsgAttachmentData + * @param aPreloadedAttachments Array of nsIMsgAttachedFile + * @param aParentWindow compose window; may be null. + * @param aProgress where to send progress info; may be null. + * @param aListener optional listener for send progress + * @param aPassword optional smtp server password + * @param aOriginalMsgURI may be null. + * @param aType see nsIMsgComposeParams.idl + */ + void createAndSendMessage(in nsIEditor aEditor, + in nsIMsgIdentity aUserIdentity, + in string aAccountKey, + in nsIMsgCompFields aFields, + in boolean aIsDigest, + in boolean aDontDeliver, + in nsMsgDeliverMode aMode, + in nsIMsgDBHdr aMsgToReplace, + in string aBodyType, + in ACString aBody, + in nsIArray aAttachments, + in nsIArray aPreloadedAttachments, + in mozIDOMWindowProxy aParentWindow, + in nsIMsgProgress aProgress, + in nsIMsgSendListener aListener, + in string aPassword, + in AUTF8String aOriginalMsgURI, + in MSG_ComposeType aType); + + /** + * Creates a file containing an rfc822 message, using the passed information. + * aListener's OnStopSending method will get called with the file the message + * was stored in. OnStopSending may be called sync or async, depending on + * content, so you need to handle both cases. + * + * @param aUserIdentity The user identity to use for sending this email. + * @param aFields An nsIMsgCompFields object containing information + * on who to send the message to. + * @param aBodyType content type of message body + * @param aBody message body text (should have native line endings) + * @param aCreateAsDraft If true, this message will be put in a drafts folder + * @param aAttachments Array of nsIMsgAttachmentData + * @param aEmbeddedObjects Array of nsIDomNode objects for MHTML messages. + * Primarily used for embedded images. + * Almost all methods can be noops, but + * GetNodeValue should return the + * cid of the embedded object. + * @param aListener listener for msg creation progress and resulting file. + */ + void createRFC822Message(in nsIMsgIdentity aUserIdentity, + in nsIMsgCompFields aFields, + in string aBodyType, + in ACString aBody, + in boolean aCreateAsDraft, + in nsIArray aAttachments, + in nsIArray aEmbeddedObjects, + in nsIMsgSendListener aListener); + + /** + * Sends a file to the specified composition fields, via the user identity + * provided. + * + * @param aUserIdentity The user identity to use for sending this email. + * @param aAccountKey The key of the account that this message relates + * to. + * @param aFields An nsIMsgCompFields object containing information + * on who to send the message to. + * @param aSendIFile A reference to the file to send. + * @param aDeleteSendFileOnCompletion + * Set to true if you want the send file deleted once + * the message has been sent. + * @param aDigest_p If this is a multipart message, this param + * specifies whether the message is in digest or mixed + * format. + * @param aMode The delivery mode for sending the message (see + * above for values). + * @param aMsgToReplace A message header representing a message to be + * replaced by the one sent, this param may be null. + * @param aListener An nsIMsgSendListener to receive feedback on the + * current send status. This parameter can also + * support the nsIMsgCopyServiceListener interface to + * receive notifications of copy finishing e.g. after + * saving a message to the sent mail folder. + * This param may be null. + * @param aStatusFeedback A feedback listener for slightly different feedback + * on the message send status. This param may be null. + * @param aPassword Pass this in to prevent a dialog if the password + * is needed for secure transmission. + */ + void sendMessageFile(in nsIMsgIdentity aUserIdentity, + in string aAccountKey, + in nsIMsgCompFields aFields, + in nsIFile aSendIFile, + in boolean aDeleteSendFileOnCompletion, + in boolean aDigest_p, + in nsMsgDeliverMode aMode, + in nsIMsgDBHdr aMsgToReplace, + in nsIMsgSendListener aListener, + in nsIMsgStatusFeedback aStatusFeedback, + in string aPassword + ); + + /* Abort current send/save operation */ + void abort(); + + /** + * Report a send failure. + * + * @param aFailureCode The failure code of the send operation. See + * nsComposeStrings.h for possible values. NS_OK is a possible + * value as well; if passed, the function won't prompt the user * but will still about the session. + * @param aErrorMsg The appropriate error string for the failure. + * @result A modified result value in the case a user action results in + * a different way to handle the failure. + */ + nsresult fail(in nsresult aFailureCode, in wstring aErrorMsg); + + /* Disable UI notification (alert message) */ + void setGUINotificationState(in boolean aEnableFlag); + + /* Crypto */ + void BeginCryptoEncapsulation(); + + /* retreive the last send process report*/ + readonly attribute nsIMsgSendReport sendReport; + + /* methods for send listener ... */ + void notifyListenerOnStartSending(in string aMsgID, in unsigned long aMsgSize); + void notifyListenerOnProgress(in string aMsgID, in unsigned long aProgress, in unsigned long aProgressMax); + void notifyListenerOnStatus(in string aMsgID, in wstring aMsg); + void notifyListenerOnStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFile returnFile); + void deliverAsMailExit(in nsIURI aUrl, in nsresult aExitCode); + void deliverAsNewsExit(in nsIURI aUrl, in nsresult aExitCode); + + void sendDeliveryCallback(in nsIURI aUrl, in boolean inIsNewsDelivery, in nsresult aExitCode); + + /* methods for copy listener ... */ + void notifyListenerOnStartCopy(); + void notifyListenerOnProgressCopy(in unsigned long aProgress, in unsigned long aProgressMax); + void notifyListenerOnStopCopy(in nsresult aStatus); + void getMessageId(out ACString messageID); + /// When saving as draft, the folder uri we saved to. + readonly attribute ACString folderUri; + + /** + * After a draft is saved, use this to get the mime part number for the dom + * node in the editor embedded object list with the passed in index. + * + * @param aDomIndex - index in the editor dom embedded object list of + * the part we're interested in. These are generally images. + * + * @return the mime part number for that object. + */ + ACString getPartForDomIndex(in long aDomIndex); + + attribute nsMsgKey messageKey; + + nsIPrompt getDefaultPrompt(); + + /* process attachment */ + void gatherMimeAttachments(); + readonly attribute boolean processAttachmentsSynchronously; + [noscript] nsMsgAttachmentHandlerArray getAttachmentHandlers(); + readonly attribute unsigned long attachmentCount; + attribute unsigned long pendingAttachmentCount; + readonly attribute nsMsgDeliverMode deliveryMode; + + nsIMsgProgress getProgress(); + + nsIOutputStream getOutputStream(); + + attribute nsIRequest runningRequest; + + attribute nsresult status; + + attribute nsIMsgComposeSecure cryptoclosure; + + /// Access the local copy of the composition fields. + readonly attribute nsIMsgCompFields sendCompFields; + + /// The message body. + readonly attribute AString sendBody; + + /// The type of the message body (typically text/plain or text/html). + readonly attribute ACString sendBodyType; + + /// The identity to use to send the message. + readonly attribute nsIMsgIdentity identity; + + /** + * Get a handler for an attachment by its index. + * The lifetime of the attachment is dependent on the existence + * of the underlying send object, so do not hold onto these + * attachment handlers. + * + * @param index Index used to specify a particular attachment. + * + * @return Attachment handler with information about the attachment. + */ + nsIMsgAttachmentHandler getAttachment(in unsigned long index); + + /// The folder name to which the message will be saved, + /// used by error reporting. + attribute AString savedToFolderName; + + /// Should we deliver this message (versus saving as a file)? + attribute boolean dontDeliver; + +}; diff --git a/mailnews/compose/public/nsIMsgSendLater.idl b/mailnews/compose/public/nsIMsgSendLater.idl new file mode 100644 index 000000000..524bb867f --- /dev/null +++ b/mailnews/compose/public/nsIMsgSendLater.idl @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIStreamListener.idl" + +interface nsIMsgStatusFeedback; +interface nsIMsgIdentity; +interface nsIMsgSendLaterListener; +interface nsIMsgFolder; + +/** + * nsIMsgSendLater is a service used for sending messages in the background. + * Messages should be saved to an identity's unsent messages folder, and then + * can be sent by calling sendUnsentMessages. + * + * Although the service supports passing identities as parameters, until bug + * 317803 is fixed, all identities use the same folder, and hence the option + * currently doesn't work. + */ +[scriptable, uuid(fa324a4b-4b87-4e9a-a3c0-af9071a358df)] +interface nsIMsgSendLater : nsIStreamListener +{ + /// Used to obtain status feedback for when messages are sent. + attribute nsIMsgStatusFeedback statusFeedback; + + /** + * Sends any unsent messages in the identity's unsent messages folder. + * + * @param aIdentity The identity to send messages for. + */ + void sendUnsentMessages(in nsIMsgIdentity aIdentity); + + /** + * Adds an listener to the service to receive notifications. + * + * @param aListener The listener to add. + */ + void addListener(in nsIMsgSendLaterListener aListener); + + /** + * Removes a listener from the service. + * + * @param aListener The listener to remove. + * @exception NS_ERROR_INVALID_ARG If the listener was not already added to + * the service. + */ + void removeListener(in nsIMsgSendLaterListener aListener); + + /** + * Returns the unsent messages folder for the identity. + */ + nsIMsgFolder getUnsentMessagesFolder(in nsIMsgIdentity userIdentity); + + /** + * Returns true if there are any unsent messages to send. + * + * @param aIdentity The identity whose folder to check for unsent messages. + * If not specified, all unsent message folders are checked. + */ + boolean hasUnsentMessages([optional] in nsIMsgIdentity aIdentity); + + /// Returns true if the service is currently sending messages. + readonly attribute boolean sendingMessages; +}; diff --git a/mailnews/compose/public/nsIMsgSendLaterListener.idl b/mailnews/compose/public/nsIMsgSendLaterListener.idl new file mode 100644 index 000000000..6e6e29a79 --- /dev/null +++ b/mailnews/compose/public/nsIMsgSendLaterListener.idl @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIMsgDBHdr; +interface nsIMsgIdentity; + +/** + * Implement this interface and add to nsIMsgSendLater to receive notifications + * of send later actions. + */ +[scriptable, uuid(a7bc603b-d0da-4959-a82f-4b99c138b9f4)] +interface nsIMsgSendLaterListener : nsISupports { + /** + * Notify the observer that the operation of sending messages later has + * started. + * + * @param aTotalMessageCount Number of messages to be sent. This will not + * change over the time we are doing this sequence. + */ + void onStartSending(in unsigned long aTotalMessageCount); + + /** + * Notify the observer that the next message send/copy is starting and + * provide details about the message. + * + * @param aCurrentMessage The current message number that is being sent. + * @param aTotalMessageCount The total number of messages that we are + * trying to send. + * @param aMessageHeader The header information for the message that is + * being sent. + * @param aMessageIdentity The identity being used to send the message. + */ + void onMessageStartSending(in unsigned long aCurrentMessage, + in unsigned long aTotalMessageCount, + in nsIMsgDBHdr aMessageHeader, + in nsIMsgIdentity aIdentity); + + /** + * Notify the observer of the current progress of sending a message. The one + * function covers sending the message over the network and copying to the + * appropriate sent folder. + * + * @param aCurrentMessage The current message number that is being sent. + * @param aTotalMessageCount The total number of messages that we are + * trying to send. + * @param aMessageSendPercent The percentage of the message sent (0 to 100) + * @param aMessageCopyPercent The percentage of the copy completed (0 to + * 100). If there is no copy for this message, + * this may be set to 100 at the same time as + * aMessageSendPercent. + */ + void onMessageSendProgress(in unsigned long aCurrentMessage, + in unsigned long aTotalMessageCount, + in unsigned long aMessageSendPercent, + in unsigned long aMessageCopyPercent); + + /** + * Notify the observer of an error in the send message later function. + * + * @param aCurrentMessage The current message number that is being sent. + * @param aMessageHeader The header information for the message that is + * being sent. + * @param aStatus The error status code. + * @param aMsg A text string describing the error. + */ + void onMessageSendError(in unsigned long aCurrentMessage, + in nsIMsgDBHdr aMessageHeader, + in nsresult aStatus, + in wstring aMsg); + + /** + * Notify the observer that the send unsent messages operation has finished. + * This is called regardless of the success/failure of the operation. + * + * @param aStatus Status code for the message send. + * @param aMsg A text string describing the error. + * @param aTotalTried Total number of messages that were attempted to be sent. + * @param aSuccessful How many messages were successfully sent. + */ + void onStopSending(in nsresult aStatus, in wstring aMsg, + in unsigned long aTotalTried, in unsigned long aSuccessful); +}; diff --git a/mailnews/compose/public/nsIMsgSendListener.idl b/mailnews/compose/public/nsIMsgSendListener.idl new file mode 100644 index 000000000..4facebc05 --- /dev/null +++ b/mailnews/compose/public/nsIMsgSendListener.idl @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIFile; + +[scriptable, uuid(D34DC178-5E78-45E8-8658-A8F52D9CCF5F)] +interface nsIMsgSendListener : nsISupports { + + /** + * Notify the observer that the message has started to be delivered. This method is + * called only once, at the beginning of a message send operation. + * + * @return The return value is currently ignored. In the future it may be + * used to cancel the URL load.. + */ + void onStartSending(in string aMsgID, in uint32_t aMsgSize); + + /** + * Notify the observer that progress as occurred for the message send + */ + void onProgress(in string aMsgID, in uint32_t aProgress, in uint32_t aProgressMax); + + /** + * Notify the observer with a status message for the message send + */ + void onStatus(in string aMsgID, in wstring aMsg); + + /** + * Notify the observer that the message has been sent. This method is + * called once when the networking library has finished processing the + * message. + * + * This method is called regardless of whether the the operation was successful. + * aMsgID The message id for the mail message + * status Status code for the message send. + * msg A text string describing the error. + * returnFileSpec The returned file spec for save to file operations. + */ + void onStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg, + in nsIFile aReturnFile); + + /** + * Notify the observer with the folder uri before the draft is copied. + */ + void onGetDraftFolderURI(in string aFolderURI); + + /** + * Notify the observer when the user aborts the send without actually doing the send + * eg : by closing the compose window without Send. + */ + void onSendNotPerformed(in string aMsgID, in nsresult aStatus); + +}; diff --git a/mailnews/compose/public/nsIMsgSendReport.idl b/mailnews/compose/public/nsIMsgSendReport.idl new file mode 100644 index 000000000..65507a511 --- /dev/null +++ b/mailnews/compose/public/nsIMsgSendReport.idl @@ -0,0 +1,47 @@ +/* -*- Mode: idl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIPrompt.idl" + + +[scriptable, uuid(2ec81175-bc65-44b9-ba87-462bc3f938db)] +interface nsIMsgProcessReport : nsISupports { + + attribute boolean proceeded; + attribute nsresult error; + attribute wstring message; + + void reset(); +}; + +[scriptable, uuid(428c5bde-29f5-4bfe-830a-ec795a1c2975)] +interface nsIMsgSendReport : nsISupports { + + const long process_Current = -1; + const long process_BuildMessage = 0; + const long process_NNTP = 1; + const long process_SMTP = 2; + const long process_Copy = 3; + const long process_Filter = 4; + const long process_FCC = 5; + + attribute long deliveryMode; /* see nsMsgDeliverMode in nsIMsgSend.idl for valid value */ + attribute long currentProcess; + + void reset(); + + void setProceeded(in long process, in boolean proceeded); + void setError(in long process, in nsresult error, in boolean overwriteError); + void setMessage(in long process, in wstring message, in boolean overwriteMessage); + + nsIMsgProcessReport getProcessReport(in long process); + + /* Display Report will ananlyze data collected during the send and will show the most appropriate error. + Also it will return the error code. In case of no error or if the error has been canceld, it will return + NS_OK. + */ + nsresult displayReport(in nsIPrompt prompt, in boolean showErrorOnly, in boolean dontShowReportTwice); +}; diff --git a/mailnews/compose/public/nsISmtpServer.idl b/mailnews/compose/public/nsISmtpServer.idl new file mode 100644 index 000000000..8ff3d1aa9 --- /dev/null +++ b/mailnews/compose/public/nsISmtpServer.idl @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "MailNewsTypes2.idl" + +interface nsIAuthPrompt; +interface nsIUrlListener; +interface nsIURI; +interface nsIMsgWindow; + +/** + * This interface represents a single SMTP Server. A SMTP server instance may be + * created/obtained from nsIMsgAccountManager. + * + * Most of the attributes will set/get preferences from the main preferences + * file. + */ +[scriptable, uuid(a53dce6c-cd81-495c-83bc-45a65df1f08e)] +interface nsISmtpServer : nsISupports { + + /// A unique identifier for the server. + attribute string key; + + /// A user supplied description for the server. + attribute AUTF8String description; + + /// The server's hostname. + attribute ACString hostname; + + /// The server's port. + attribute int32_t port; + + /// The username to access the server with (if required) + attribute ACString username; + + /** + * The password to access the server with (if required). + * + * @note this is stored within the server instance but not within preferences. + * It can be specified/saved here to avoid prompting the user constantly for + * the sending password. + */ + attribute ACString password; + + /// Returns a displayname of the format hostname:port or just hostname + readonly attribute string displayname; + + /** + * Authentication mechanism. + * + * @see nsMsgAuthMethod (in MailNewsTypes2.idl) + * Same as "mail.smtpserver...authMethod" pref + * + * Compatibility note: This attribute had a different meaning in TB < 3.1 + */ + attribute nsMsgAuthMethodValue authMethod; + + /** + * Whether to SSL or STARTTLS or not + * + * @see nsMsgSocketType (in MailNewsTypes2.idl) + * Same as "mail.smtpserver...try_ssl" pref + */ + attribute nsMsgSocketTypeValue socketType; + + /** + * May contain an alternative argument to EHLO or HELO to provide to the + * server. Reflects the value of the mail.smtpserver.*.hello_argument pref. + * This is mainly useful where ISPs don't bother providing PTR records for + * their servers and therefore users get an error on sending. See bug 244030 + * for more discussion. + */ + readonly attribute string helloArgument; + + /// Returns the URI of the server (smtp:///) + readonly attribute ACString serverURI; + + /** + * Gets a password for this server, using a UI prompt if necessary. + * + * @param promptString The string to prompt the user with when asking for + * the password. + * @param promptTitle The title of the prompt. + * @param netPrompt An nsIAuthPrompt instance to use for the password + * prompt. + * @return The password to use (may be null if no password was + * obtained). + */ + ACString getPasswordWithUI(in wstring promptString, in wstring promptTitle, + in nsIAuthPrompt netPrompt); + + /** + * Gets a username and password for this server, using a UI prompt if + * necessary. + * + * @param promptString The string to prompt the user with when asking for + * the password. + * @param promptTitle The title of the prompt. + * @param netPrompt An nsIAuthPrompt instance to use for the password + * prompt. + * @param userid The username to use (may be null if no password was + * obtained). + * @param password The password to use (may be empty if no password was + * obtained). + */ + void getUsernamePasswordWithUI(in wstring promptString, in wstring promptTitle, + in nsIAuthPrompt netPrompt, out ACString userid, + out ACString password); + + /** + * Calling this will *remove* the saved password for this server from the + * password manager and from the stored value. + */ + void forgetPassword(); + + /** + * Verify that we can logon + * + * @param aPassword - password to use + * @param aUrlListener - gets called back with success or failure. + * @return - the url that we run. + * + */ + nsIURI verifyLogon(in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + /// Call this to clear all preference values for this server. + void clearAllValues(); +}; diff --git a/mailnews/compose/public/nsISmtpService.idl b/mailnews/compose/public/nsISmtpService.idl new file mode 100644 index 000000000..fcd6602de --- /dev/null +++ b/mailnews/compose/public/nsISmtpService.idl @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsISmtpServer; +interface nsIURI; +interface nsIUrlListener; +interface nsIMsgIdentity; +interface nsIInterfaceRequestor; +interface nsIFile; +interface nsIMsgStatusFeedback; +interface nsIRequest; +interface nsISimpleEnumerator; +interface nsIMsgWindow; + +[scriptable, uuid(1b11b532-1527-4fc0-a00f-4ce7e6886419)] +interface nsISmtpService : nsISupports { + /** + * Sends a mail message via the given parameters. This function builds an + * SMTP URL and makes an SMTP connection, and then runs the url. + * The SMTP server defined + * in the aSenderIdentity object (see nsIMsgIdentity) will be used to send + * the message. If there is no SMTP server defined in aSenderIdentity, the + * default SMTP server will be used. + * + * @note The file to send must be in the format specified by RFC 2822 for + * sending data. This includes having the correct CRLF line endings + * throughout the file, and the . at the end of the file. + * sendMailMessage does no processing/additions on the file. + * + * @param aFilePath The file to send. + * @param aRecipients A comma delimited list of recipients. + * @param aSenderIdentity The identity of the sender. + * @param aPassword Pass this in to prevent a dialog if the + * password is needed for secure transmission. + * @param aUrlListener A listener to listen to the URL being run, + * this parameter may be null. + * @param aStatusListener A feedback listener for slightly different + * feedback on the message send status. This + * parameter may be null. + * @param aNotificationCallbacks More notification callbacks + * @param aRequestDSN Pass true to request Delivery Status + * Notification. + * @param aURL Provides a handle on the running url. You + * can later interrupt the action by asking the + * netlib service manager to interrupt the url + * you are given back. This parameter may be + * null. + * @param aRequest Provides a handle to the running request. + * This parameter may be null. + */ + void sendMailMessage(in nsIFile aFilePath, in string aRecipients, + in nsIMsgIdentity aSenderIdentity, + in string aPassword, + in nsIUrlListener aUrlListener, + in nsIMsgStatusFeedback aStatusListener, + in nsIInterfaceRequestor aNotificationCallbacks, + in boolean aRequestDSN, + out nsIURI aURL, + out nsIRequest aRequest); + + /** + * Verifies that we can logon to the server with given password + * + * @param aSmtpServer Server to try to logon to. + * @param aUrlListener Listener that will get notified whether logon + * was successful or not. + * @param aMsgWindow nsIMsgWindow to use for notification callbacks. + * @return - the url that we run. + */ + nsIURI verifyLogon(in nsISmtpServer aServer, in nsIUrlListener aListener, + in nsIMsgWindow aMsgWindow); + + /** + * Return the SMTP server that is associated with an identity. + * @param aSenderIdentity the identity + * @param aServer the SMTP server + */ + void getServerByIdentity(in nsIMsgIdentity aSenderIdentity, + out nsISmtpServer aServer); + + /** + * A copy of the array of SMTP servers, as stored in the preferences + */ + readonly attribute nsISimpleEnumerator servers; + + /** + * The default server, across sessions of the app + * (eventually there will be a session default which does not + * persist past shutdown) + */ + attribute nsISmtpServer defaultServer; + + /** + * The "session default" server - this is never saved, and only used + * for the current session. Always falls back to the default server + * unless explicitly set. + */ + attribute nsISmtpServer sessionDefaultServer; + + /** + * Create a new SMTP server. + * Use this instead of createInstance(), so that the SMTP Service can + * be aware of this server + */ + nsISmtpServer createServer(); + + /** + * Find the first server with the given hostname and/or username. + * Note: if either username or hostname is empty, then that parameter will + * not be used in the matching process. + * @param username the username for the server + * @param hostname the hostname of the server + * @returns null if no server is found + */ + nsISmtpServer findServer(in string username, in string hostname); + + /** + * Look up the server with the given key + * If the server does not exist, create it and add it to our list + */ + nsISmtpServer getServerByKey(in string key); + + /** + * Delete the given server from the server list - does nothing if the server + * does not exist + * @param server the server to delete. Use findServer() if you only know + * the hostname + */ + void deleteServer(in nsISmtpServer server); +}; diff --git a/mailnews/compose/public/nsISmtpUrl.idl b/mailnews/compose/public/nsISmtpUrl.idl new file mode 100644 index 000000000..be2af7cb7 --- /dev/null +++ b/mailnews/compose/public/nsISmtpUrl.idl @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIMsgComposeParams.idl" + +interface nsIMsgIdentity; +interface nsIPrompt; +interface nsIAuthPrompt; +interface nsISmtpServer; +interface nsIInterfaceRequestor; +interface nsIFile; + +[scriptable, uuid(da22b8ac-059d-4f82-bf99-f5f3d3c8202d)] +interface nsISmtpUrl : nsISupports { + /** + * SMTP Parse specific getters. + * These retrieve various parts from the url. + */ + + /** + * This list is a list of all recipients to send the email to. + * Each name is NULL terminated. + */ + attribute string recipients; + + attribute boolean PostMessage; + + /** + * The message can be stored in a file, to allow accessors for getting and + * setting the file name to post. + */ + attribute nsIFile postMessageFile; + + attribute boolean requestDSN; + + /** + * The envid which is used in the DSN. + */ + attribute ACString dsnEnvid; + + /** + * SMTP Url instance specific getters and setters + * Information the protocol needs to know in order to run the url. + * These are NOT event sinks which are things the caller needs to know. + */ + + /** + * By default the url is really a bring up the compose window mailto url. + * You need to call this function if you want to force the message to be + * posted to the mailserver. + */ + + /** + * The user's full name and user's email address are encapsulated in the + * senderIdentity. + * (the user's domain name can be glopped from the user's email address) + * + * NOTE: the SMTP username and SMTP server are in the smtp url + * smtp://sspitzer@tintin/... + */ + attribute nsIMsgIdentity senderIdentity; + attribute nsIPrompt prompt; + attribute nsIAuthPrompt authPrompt; + attribute nsIInterfaceRequestor notificationCallbacks; + attribute nsISmtpServer smtpServer; + + attribute boolean verifyLogon; // we're just verifying the ability to logon + + /// Constant for the default SMTP port number + const int32_t DEFAULT_SMTP_PORT = 25; + + /// Constant for the default SMTP over ssl port number + const int32_t DEFAULT_SMTPS_PORT = 465; +}; + +[scriptable, uuid(87c36c23-4bc2-4992-b338-69f88f6ed0a1)] +interface nsIMailtoUrl : nsISupports { + /** + * mailto: parse specific getters + * + * All of these fields are things we can effectively extract from a + * mailto url if it contains all of these values + * + * Note: Attachments aren't available because that would expose a potential + * security hole (see bug 99055). + * + * These items are in one function as we only ever get them from the one + * place and all at the same time. + */ + void getMessageContents(out AUTF8String aToPart, out AUTF8String aCcPart, + out AUTF8String aBccPart, out AUTF8String aSubjectPart, + out AUTF8String aBodyPart, out AUTF8String aHtmlPart, + out ACString aReferencePart, + out AUTF8String aNewsgroupPart, + out MSG_ComposeFormat aFormat); + + /** + * These attributes are available should mailnews or extensions want them + * but aren't used by standard in mailnews. + */ + readonly attribute AUTF8String fromPart; + readonly attribute AUTF8String followUpToPart; + readonly attribute AUTF8String organizationPart; + readonly attribute AUTF8String replyToPart; + readonly attribute AUTF8String priorityPart; + readonly attribute AUTF8String newsHostPart; +}; diff --git a/mailnews/compose/public/nsIURLFetcher.idl b/mailnews/compose/public/nsIURLFetcher.idl new file mode 100644 index 000000000..fadb3abbc --- /dev/null +++ b/mailnews/compose/public/nsIURLFetcher.idl @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIURI.idl" +#include "nsIFileStreams.idl" +#include "nsIFile.idl" + +%{ C++ + +// +// Callback declarations for URL completion +// +// For completion of send/message creation operations... +typedef nsresult (*nsAttachSaveCompletionCallback) (nsresult aStatus, + const nsACString &aContentType, + const nsACString &aCharset, + int32_t totalSize, const char16_t* aMsg, + void *tagData); + +class nsMsgAttachmentHandler; +%} + +native nsAttachSaveCompletionCallback(nsAttachSaveCompletionCallback); +[ptr] native nsMsgAttachmentHandler(nsMsgAttachmentHandler); + + +[noscript, uuid(7316af6b-050d-4697-9d39-b0b358514f5c)] +interface nsIURLFetcher : nsISupports +{ + boolean stillRunning(); + + void fireURLRequest(in nsIURI aURL, in nsIFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in nsMsgAttachmentHandler tagData); + + void initialize(in nsIFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in nsMsgAttachmentHandler tagData); +}; diff --git a/mailnews/compose/public/nsMsgAttachmentData.h b/mailnews/compose/public/nsMsgAttachmentData.h new file mode 100644 index 000000000..0f15d3764 --- /dev/null +++ b/mailnews/compose/public/nsMsgAttachmentData.h @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef __MSGATTACHMENTDATA_H__ +#define __MSGATTACHMENTDATA_H__ + +#include "nsIURL.h" +#include "nsStringGlue.h" +#include "nsIMsgSend.h" + +// Attachment file/URL structures - we're letting libmime use this directly +class nsMsgAttachmentData final : public nsIMsgAttachmentData +{ +public: + NS_DECL_NSIMSGATTACHMENTDATA + NS_DECL_ISUPPORTS + + nsMsgAttachmentData(); + virtual ~nsMsgAttachmentData(); + + nsCOMPtr m_url; // The URL to attach. + + nsCString m_desiredType; // 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. + + nsCString m_realType; // 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. + + nsCString m_realEncoding; // Goes along with real_type + + nsCString m_realName; // 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. + + nsCString m_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. + + nsCString m_disposition; // The Content-Disposition header (if any). a + // nsMsgAttachmentData can very well have + // Content-Disposition: inline value, instead of + // "attachment". + nsCString m_cloudPartInfo; // For X-Mozilla-Cloud-Part header, if any + + // Mac-specific data that should show up as optional parameters + // to the content-type header. + nsCString m_xMacType; + nsCString m_xMacCreator; + + int32_t m_size; // The size of the attachment. May be 0. + nsCString m_sizeExternalStr; // The reported size of an external attachment. Originally set at "-1" to mean an unknown value. + bool m_isExternalAttachment; // Flag for determining if the attachment is external + bool m_isExternalLinkAttachment; // Flag for determining if the attachment is external and an http link. + bool m_isDownloaded; // Flag for determining if the attachment has already been downloaded + bool m_hasFilename; // Tells whether the name is provided by us or if it's a Part 1.2-like attachment + bool m_displayableInline; // Tells whether the attachment could be displayed inline +}; + +class nsMsgAttachedFile final : public nsIMsgAttachedFile +{ +public: + NS_DECL_NSIMSGATTACHEDFILE + NS_DECL_ISUPPORTS + + nsMsgAttachedFile(); + virtual ~nsMsgAttachedFile(); + + nsCOMPtr m_origUrl; // Where it came from on the network (or even elsewhere on the local disk.) + + nsCOMPtr m_tmpFile; // The tmp file in which the (possibly converted) data now resides. + + nsCString m_type; // The type of the data in file_name (not necessarily the same as the type of orig_url.) + + nsCString m_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. + + + nsCString m_description; // For Content-Description header + nsCString m_cloudPartInfo; // For X-Mozilla-Cloud-Part header, if any + nsCString m_xMacType; // mac-specific info + nsCString m_xMacCreator; // mac-specific info + nsCString m_realName; // 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_t m_size; + uint32_t m_unprintableCount; + uint32_t m_highbitCount; + uint32_t m_ctlCount; + uint32_t m_nullCount; + uint32_t m_maxLineLength; +}; + +#undef MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING +#ifdef MOZ_IS_DESTRUCTIBLE +#define MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(X) \ + static_assert(!MOZ_IS_DESTRUCTIBLE(X) || \ + mozilla::IsSame::value || \ + mozilla::IsSame::value, \ + "Reference-counted class " #X " should not have a public destructor. " \ + "Try to make this class's destructor non-public. If that is really " \ + "not possible, you can whitelist this class by providing a " \ + "HasDangerousPublicDestructor specialization for it."); +#else +#define MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(X) +#endif +#endif diff --git a/mailnews/compose/public/nsMsgCompCID.h b/mailnews/compose/public/nsMsgCompCID.h new file mode 100644 index 000000000..9fad52638 --- /dev/null +++ b/mailnews/compose/public/nsMsgCompCID.h @@ -0,0 +1,247 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsMessageCompCID_h__ +#define nsMessageCompCID_h__ + +#include "nsISupports.h" +#include "nsIFactory.h" +#include "nsIComponentManager.h" + +// +// nsMsgComposeService +// +#define NS_MSGCOMPOSESERVICE_CID \ +{ /* 588595FE-1ADA-11d3-A715-0060B0EB39B5 */ \ + 0x588595fe, 0x1ada, 0x11d3, \ + {0xa7, 0x15, 0x0, 0x60, 0xb0, 0xeb, 0x39, 0xb5}} + +#define NS_MSGCOMPOSESERVICE_CONTRACTID \ + "@mozilla.org/messengercompose;1" +#define NS_MSGCOMPOSESTARTUPHANDLER_CONTRACTID \ + "@mozilla.org/commandlinehandler/general-startup;1?type=compose" + +// +// nsMsgComposeContentHandler +// +#define NS_MSGCOMPOSECONTENTHANDLER_CID \ +{ /* 0B63FB80-BBBA-11D4-9DAA-91B657EB313C */ \ +0x0b63fb80, 0xbbba, 0x11d4, \ + {0x9d, 0xaa, 0x91, 0xb6, 0x57, 0xeb, 0x31, 0x3c}} + +#define NS_MSGCOMPOSECONTENTHANDLER_CONTRACTID \ + NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-mailto" + +// +// nsMsgCompose +// +#define NS_MSGCOMPOSE_CONTRACTID \ + "@mozilla.org/messengercompose/compose;1" + +#define NS_MSGCOMPOSE_CID \ +{ /* EB5BDAF8-BBC6-11d2-A6EC-0060B0EB39B5 */ \ + 0xeb5bdaf8, 0xbbc6, 0x11d2, \ + {0xa6, 0xec, 0x0, 0x60, 0xb0, 0xeb, 0x39, 0xb5}} + +// +// nsMsgComposeSecure +// +#define NS_MSGCOMPOSESECURE_CONTRACTID \ + "@mozilla.org/messengercompose/composesecure;1" + +// +// nsMsgComposeParams +// +#define NS_MSGCOMPOSEPARAMS_CONTRACTID \ + "@mozilla.org/messengercompose/composeparams;1" + +#define NS_MSGCOMPOSEPARAMS_CID \ +{ /* CB998A00-C079-11D4-9DAA-8DF64BAB2EFC */ \ + 0xcb998a00, 0xc079, 0x11d4, \ + {0x9d, 0xaa, 0x8d, 0xf6, 0x4b, 0xab, 0x2e, 0xfc}} + +// +// nsMsgComposeSendListener +// +#define NS_MSGCOMPOSESENDLISTENER_CONTRACTID \ + "@mozilla.org/messengercompose/composesendlistener;1" + +#define NS_MSGCOMPOSESENDLISTENER_CID \ +{ /* acc72781-2cea-11d5-9daa-bacdeac1eefc */ \ + 0xacc72781, 0x2cea, 0x11d5, \ + {0x9d, 0xaa, 0xba, 0xcd, 0xea, 0xc1, 0xee, 0xfc}} + +// +// nsMsgComposeProgressParams +// +#define NS_MSGCOMPOSEPROGRESSPARAMS_CONTRACTID \ + "@mozilla.org/messengercompose/composeprogressparameters;1" + +#define NS_MSGCOMPOSEPROGRESSPARAMS_CID \ +{ /* 1e0e7c01-3e4c-11d5-9daa-f88d288130fc */ \ + 0x1e0e7c01, 0x3e4c, 0x11d5, \ + {0x9d, 0xaa, 0xf8, 0x8d, 0x28, 0x81, 0x30, 0xfc}} + +// +// nsMsgCompFields +// +#define NS_MSGCOMPFIELDS_CONTRACTID \ + "@mozilla.org/messengercompose/composefields;1" + +#define NS_MSGCOMPFIELDS_CID \ +{ /* 6D222BA0-BD46-11d2-8293-000000000000 */ \ + 0x6d222ba0, 0xbd46, 0x11d2, \ + {0x82, 0x93, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}} + +// +// nsMsgAttachment +// +#define NS_MSGATTACHMENT_CONTRACTID \ + "@mozilla.org/messengercompose/attachment;1" + +#define NS_MSGATTACHMENT_CID \ +{ /* 27B8D045-8D9F-4fa8-BFB6-8A0F8D09CE89 */ \ + 0x27b8d045, 0x8d9f, 0x4fa8, \ + {0xbf, 0xb6, 0x8a, 0xf, 0x8d, 0x9, 0xce, 0x89}} + +// +// nsMsgAttachmentData +// +#define NS_MSGATTACHMENTDATA_CONTRACTID \ + "@mozilla.org/messengercompose/attachmentdata;1" + +#define NS_MSGATTACHMENTDATA_CID \ +{ /* 9e16958d-d9e9-4cae-b723-a5bccf104998 */ \ + 0x9e16958d, 0xd9e9, 0x4cae, \ + {0xb7, 0x23, 0xa5, 0xbc, 0xcf, 0x10, 0x49, 0x98}} + +// +// nsMsgAttachedFile +// +#define NS_MSGATTACHEDFILE_CONTRACTID \ + "@mozilla.org/messengercompose/attachedfile;1" + +#define NS_MSGATTACHEDFILE_CID \ +{ /* ef173501-4e14-42b9-ae1f-7770de235c29 */ \ + 0xef173501, 0x4e14, 0x42b9, \ + {0xae, 0x1f, 0x77, 0x70, 0xde, 0x23, 0x5c, 0x29}} + +// +// nsMsgSend +// +#define NS_MSGSEND_CONTRACTID \ + "@mozilla.org/messengercompose/send;1" + +#define NS_MSGSEND_CID \ +{ /* 935284E0-C5D8-11d2-8297-000000000000 */ \ + 0x935284e0, 0xc5d8, 0x11d2, \ + {0x82, 0x97, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}} + +// +// nsMsgSendLater +// +#define NS_MSGSENDLATER_CONTRACTID \ + "@mozilla.org/messengercompose/sendlater;1" + +#define NS_MSGSENDLATER_CID \ +{ /* E15C83F1-1CF4-11d3-8EF0-00A024A7D144 */ \ + 0xe15c83f1, 0x1cf4, 0x11d3, \ + {0x8e, 0xf0, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 }} + +// +// nsSmtpUrl +// +#define NS_SMTPURL_CONTRACTID \ + "@mozilla.org/messengercompose/smtpurl;1" + +#define NS_SMTPURL_CID \ +{ /* BE59DBF0-2812-11d3-80A3-006008128C4E} */ \ + 0xbe59dbf0, 0x2812, 0x11d3, \ + {0x80, 0xa3, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e}} + +// +// nsMailtoUrl +// +#define NS_MAILTOURL_CONTRACTID \ + "@mozilla.org/messengercompose/mailtourl;1" + +#define NS_MAILTOURL_CID \ +{ /* 05BAB5E7-9C7D-11d3-98A3-001083010E9B} */ \ + 0x5bab5e7, 0x9c7d, 0x11d3, \ + {0x98, 0xa3, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b}} + +// +// nsSmtpServer +// +#define NS_SMTPSERVER_CONTRACTID \ + "@mozilla.org/messenger/smtp/server;1" + +#define NS_SMTPSERVER_CID \ +{ /* 60dc861a-56ce-11d3-9118-00a0c900d445 */ \ + 0x60dc861a,0x56ce,0x11d3, \ + {0x91,0x18, 0x0, 0xa0, 0xc9, 0x0, 0xd4, 0x45 }} + +// +// nsSmtpService +// +#define NS_SMTPSERVICE_CONTRACTID \ + "@mozilla.org/messengercompose/smtp;1" + +#define NS_MAILTOHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailto" + +#define NS_SMTPSERVICE_CID \ +{ /* 5B6419F1-CA9B-11d2-8063-006008128C4E */ \ + 0x5b6419f1, 0xca9b, 0x11d2, \ + {0x80, 0x63, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e}} + +// +// nsMsgQuote +// +#define NS_MSGQUOTE_CONTRACTID \ + "@mozilla.org/messengercompose/quoting;1" +#define NS_MSGQUOTE_CID \ + {0x1C7ABF0C, 0x21E5, 0x11d3, \ + { 0x8E, 0xF1, 0x00, 0xA0, 0x24, 0xA7, 0xD1, 0x44 }} + +#define NS_MSGQUOTELISTENER_CONTRACTID \ + "@mozilla.org/messengercompose/quotinglistener;1" +#define NS_MSGQUOTELISTENER_CID \ + {0x683728ac, 0x88df, 0x11d3, \ + { 0x98, 0x9d, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b }} + +// +// nsMsgDraft +// +#define NS_MSGDRAFT_CONTRACTID \ + "@mozilla.org/messengercompose/drafts;1" +#define NS_MSGDRAFT_CID \ + { 0xa623746c, 0x453b, 0x11d3, \ + { 0x8f, 0xf, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 } } + +// +// nsURLFetcher +// +#define NS_URLFETCHER_CONTRACTID \ + "@mozilla.org/messengercompose/urlfetcher;1" + +// {01B8A701-2F52-11D5-9DAA-F78DA781A1FC} +#define NS_URLFETCHER_CID \ +{ 0x01b8a701, 0x2f52, 0x11d5, \ + { 0x9d, 0xaa, 0xf7, 0x8d, 0xa7, 0x81, 0xa1, 0xfc } } + +// +// nsMsgCompUtils +// +#define NS_MSGCOMPUTILS_CONTRACTID \ + "@mozilla.org/messengercompose/computils;1" + +// {ceb0dca2-5e7d-4204-94d4-2ab925921fae} +#define NS_MSGCOMPUTILS_CID \ +{ 0xceb0dca2, 0x5e7d, 0x4204, \ + { 0x94, 0xd4, 0x2a, 0xb9, 0x25, 0x92, 0x1f, 0xae } } + + +#endif // nsMessageCompCID_h__ -- cgit v1.2.3