summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/compose/public
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mailnews/compose/public')
-rw-r--r--comm/mailnews/compose/public/moz.build30
-rw-r--r--comm/mailnews/compose/public/nsIMsgAttachment.idl144
-rw-r--r--comm/mailnews/compose/public/nsIMsgCompFields.idl104
-rw-r--r--comm/mailnews/compose/public/nsIMsgCompUtils.idl43
-rw-r--r--comm/mailnews/compose/public/nsIMsgCompose.idl305
-rw-r--r--comm/mailnews/compose/public/nsIMsgComposeParams.idl87
-rw-r--r--comm/mailnews/compose/public/nsIMsgComposeProgressParams.idl16
-rw-r--r--comm/mailnews/compose/public/nsIMsgComposeSecure.idl145
-rw-r--r--comm/mailnews/compose/public/nsIMsgComposeService.idl169
-rw-r--r--comm/mailnews/compose/public/nsIMsgCopy.idl38
-rw-r--r--comm/mailnews/compose/public/nsIMsgQuote.idl35
-rw-r--r--comm/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl16
-rw-r--r--comm/mailnews/compose/public/nsIMsgSend.idl374
-rw-r--r--comm/mailnews/compose/public/nsIMsgSendLater.idl66
-rw-r--r--comm/mailnews/compose/public/nsIMsgSendLaterListener.idl86
-rw-r--r--comm/mailnews/compose/public/nsIMsgSendListener.idl79
-rw-r--r--comm/mailnews/compose/public/nsIMsgSendReport.idl47
-rw-r--r--comm/mailnews/compose/public/nsISmtpServer.idl151
-rw-r--r--comm/mailnews/compose/public/nsISmtpService.idl134
-rw-r--r--comm/mailnews/compose/public/nsISmtpUrl.idl115
20 files changed, 2184 insertions, 0 deletions
diff --git a/comm/mailnews/compose/public/moz.build b/comm/mailnews/compose/public/moz.build
new file mode 100644
index 0000000000..b4e027ef05
--- /dev/null
+++ b/comm/mailnews/compose/public/moz.build
@@ -0,0 +1,30 @@
+# 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",
+ "nsIMsgCompFields.idl",
+ "nsIMsgCompose.idl",
+ "nsIMsgComposeParams.idl",
+ "nsIMsgComposeProgressParams.idl",
+ "nsIMsgComposeSecure.idl",
+ "nsIMsgComposeService.idl",
+ "nsIMsgCompUtils.idl",
+ "nsIMsgCopy.idl",
+ "nsIMsgQuote.idl",
+ "nsIMsgQuotingOutputStreamListener.idl",
+ "nsIMsgSend.idl",
+ "nsIMsgSendLater.idl",
+ "nsIMsgSendLaterListener.idl",
+ "nsIMsgSendListener.idl",
+ "nsIMsgSendReport.idl",
+ "nsISmtpServer.idl",
+ "nsISmtpService.idl",
+ "nsISmtpUrl.idl",
+]
+
+XPIDL_MODULE = "msgcompose"
+
+EXPORTS += []
diff --git a/comm/mailnews/compose/public/nsIMsgAttachment.idl b/comm/mailnews/compose/public/nsIMsgAttachment.idl
new file mode 100644
index 0000000000..71356d6686
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgAttachment.idl
@@ -0,0 +1,144 @@
+/* -*- 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 (locally or remotely)
+ */
+ attribute AUTF8String url;
+
+ /**
+ * msgUri attribute
+ *
+ * @specify the uri of the message this attachment belongs to
+ */
+ attribute AUTF8String msgUri;
+
+ /**
+ * 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 cloudFileAccountKey;
+
+ /**
+ * A data string stored in the x-mozilla-cloud-part header of draft messages,
+ * to be able to restore cloudFile information of re-opened drafts.
+ */
+ attribute AUTF8String cloudPartHeaderData;
+
+ /**
+ * 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 AUTF8String 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 and to store
+ * the original mailbox:// url of attachments, after they have been saves as
+ * temporary 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 omitted, 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;
+
+ /**
+ * Content-ID for embedded attachments inside a multipart/related container.
+ */
+ attribute AUTF8String contentId;
+
+ /**
+ * 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/comm/mailnews/compose/public/nsIMsgCompFields.idl b/comm/mailnews/compose/public/nsIMsgCompFields.idl
new file mode 100644
index 0000000000..7ed51f4737
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgCompFields.idl
@@ -0,0 +1,104 @@
+/* -*- 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 nsIMsgComposeSecure;
+
+/**
+ * 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 AString templateName;
+ // The so-called draft/template ID is a URI in reality.
+ attribute AUTF8String draftId;
+ attribute AUTF8String templateId;
+
+ 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 Array<nsIMsgAttachment> attachments;
+ void addAttachment(in nsIMsgAttachment attachment);
+ void removeAttachment(in nsIMsgAttachment attachment);
+ void removeAttachments();
+
+ /**
+ * Values for other headers. Headers in order, from the
+ * mail.compose.other.header pref.
+ */
+ attribute Array<AString> otherHeaders;
+
+ /**
+ * 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.
+ *
+ * @return An array of the recipients.
+ */
+ Array<AString> splitRecipients(in AString aRecipients,
+ in boolean aEmailAddressOnly);
+
+ 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;
+
+ /**
+ * Object implementing encryption/signing functionality (e.g. S/MIME, PGP/MIME)
+ */
+ attribute nsIMsgComposeSecure composeSecure;
+};
diff --git a/comm/mailnews/compose/public/nsIMsgCompUtils.idl b/comm/mailnews/compose/public/nsIMsgCompUtils.idl
new file mode 100644
index 0000000000..18749e1f9d
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgCompUtils.idl
@@ -0,0 +1,43 @@
+/* -*- 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);
+
+ /**
+ * Try to use the provided identity and/or host name to generate a message ID.
+ *
+ * To identify the host name to use in the message ID, this will:
+ * - if the attribute "FQDN" of the identity is set to a valid host name, use it
+ * - otherwise, if the provided host name is valid, use it
+ * - otherwise, if the identity's email address includes a valid host name after
+ * an '@' symbol, use it
+ * - otherwise, bail without generating a message ID (returns with an empty value)
+ *
+ * @param nsIMsgIdentity The identity to use to generate the message ID.
+ * @param string The host to use to generate the message ID. Ignored if empty.
+ *
+ * @returns A message ID usable in a Message-ID header, or an empty string
+ * if no message ID could be generated.
+ */
+ AUTF8String msgGenerateMessageId(in nsIMsgIdentity identity, in AUTF8String host);
+
+ readonly attribute boolean msgMimeConformToStandard;
+
+ /**
+ * Detect the text encoding of an input string. This is a wrapper of
+ * mozilla::EncodingDetector to be used by JavaScript code. For C++, use
+ * MsgDetectCharsetFromFile from nsMsgUtils.cpp instead.
+ *
+ * @param aContent The string to detect charset.
+ *
+ * @returns Detected charset.
+ */
+ ACString detectCharset(in ACString aContent);
+};
diff --git a/comm/mailnews/compose/public/nsIMsgCompose.idl b/comm/mailnews/compose/public/nsIMsgCompose.idl
new file mode 100644
index 0000000000..7af2405e84
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgCompose.idl
@@ -0,0 +1,305 @@
+/* -*- 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 "nsString.h"
+%}
+
+interface nsIMsgSend;
+interface nsIMsgIdentity;
+interface nsIMsgProgress;
+interface nsIDocShell;
+interface mozIDOMWindowProxy;
+interface nsIEditor;
+interface nsIMsgWindow;
+
+webidl Element;
+
+typedef long MSG_ComposeSaveType;
+
+[scriptable, uuid(6953e50a-7531-11d3-85fe-006008948010)]
+interface nsIMsgCompSaveType : nsISupports {
+ 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 : nsISupports {
+ 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 : nsISupports {
+ /* Send only plain text if the message is free of any rich formatting or
+ * inserted elements. Otherwise send both a HTML part and plain text
+ * alternative part. */
+ const long Auto = 0;
+ /* Only send a plain text part, losing any rich formatting or inserted
+ * elements. */
+ const long PlainText = 1;
+ /* Only send a HTML part. */
+ const long HTML = 2;
+ /* Send both the HTML part and the plain text alternative part. */
+ const long Both = 3;
+ /* An unset value, to be set with mail.default_send_format on loading the
+ * message in the compose window. */
+ const long Unset = 4;
+};
+
+[scriptable, uuid(9638af92-1dd1-11b2-bef1-ca5fee0abc62)]
+interface nsIMsgCompConvertible : nsISupports /*ToTXT*/ {
+ const long Plain = 1; // Like 4.x: Only <html>, <p>, <br>, ...
+ const long Yes = 2; // *Minor* alterations of the look: <ol>, <dd>, ...
+ const long Altering = 3; /* Look altered: <strong>, <i>, <h1>, ...
+ Can be expressed in plaintext, but not in
+ the way it looked in the HTML composer. */
+ const long No = 4; /* Will lose data: <font>, ...
+ 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 : nsISupports
+{
+ 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 RegisterStateListener(in nsIMsgComposeStateListener stateListener);
+
+ /* ... */
+ void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
+
+ /* ... */
+ Promise 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.
+ */
+ Promise sendMsgToServer(in MSG_DeliverMode deliverMode,
+ in nsIMsgIdentity identity,
+ in string accountKey);
+
+ /* ... */
+ void CloseWindow();
+
+ /* ... */
+ void abort();
+
+ /* ... */
+ void quoteMessage(in AUTF8String 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();
+
+ /**
+ * The level of "convertibility" of the message body (whole HTML document)
+ * to plaintext.
+ *
+ * @return a value from nsIMsgCompConvertible.
+ */
+ long bodyConvertible();
+
+ /**
+ * The level of "convertibility" of the provided node to plaintext.
+ *
+ * @return a value from nsIMsgCompConvertible.
+ */
+ long nodeTreeConvertible(in Element aNode);
+
+ /**
+ * 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 modified
+ by the user. When you set this value to false, you reset the modification count
+ of the body to 0 (clean).
+ */
+ attribute boolean bodyModified;
+
+ /**
+ * 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 AUTF8String 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);
+
+ /* Retrieve the progress object */
+ readonly attribute nsIMsgProgress progress;
+
+ /* ... */
+ [noscript]
+ void buildBodyMessageAndSignature();
+
+ /* ... */
+ [noscript] void buildQuotedMessageAndSignature();
+
+ /* ... */
+ [noscript] void getQuotingToFollow(out boolean quotingToFollow);
+
+ readonly attribute AUTF8String originalMsgURI;
+
+ attribute boolean deleteDraft;
+
+ /** Set to true when remote content can load in the editor. E.g for pasting. */
+ attribute boolean allowRemoteContent;
+
+ /* 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/comm/mailnews/compose/public/nsIMsgComposeParams.idl b/comm/mailnews/compose/public/nsIMsgComposeParams.idl
new file mode 100644
index 0000000000..bafe7ef4e0
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgComposeParams.idl
@@ -0,0 +1,87 @@
+/* -*- 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 : nsISupports {
+ 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; // New message from template.
+ 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;
+
+ /**
+ * Used to compose a new message from an existing message. Links
+ * are sanitized since the message could be from external sources.
+ */
+ const long EditAsNew = 15;
+
+ /**
+ * Used to edit an existing template.
+ */
+ const long EditTemplate = 16;
+};
+
+
+typedef long MSG_ComposeFormat;
+
+[scriptable, uuid(a28325e8-7531-11d3-8f1c-006008948010)]
+interface nsIMsgCompFormat : nsISupports{
+ 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 AUTF8String originalMsgURI;
+ attribute nsIMsgIdentity identity;
+
+ attribute nsIMsgCompFields composeFields;
+ attribute boolean bodyIsLink;
+
+ attribute nsIMsgSendListener sendListener;
+ attribute AString smtpPassword;
+ attribute nsIMsgDBHdr origMsgHdr;
+ attribute boolean autodetectCharset;
+
+ /**
+ * 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/comm/mailnews/compose/public/nsIMsgComposeProgressParams.idl b/comm/mailnews/compose/public/nsIMsgComposeProgressParams.idl
new file mode 100644
index 0000000000..9a77012c5c
--- /dev/null
+++ b/comm/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/comm/mailnews/compose/public/nsIMsgComposeSecure.idl b/comm/mailnews/compose/public/nsIMsgComposeSecure.idl
new file mode 100644
index 0000000000..cbebdb9495
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgComposeSecure.idl
@@ -0,0 +1,145 @@
+/* -*- 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;
+interface nsIX509Cert;
+
+/**
+ * Callback type for use with asyncFindCertByEmailAddr.
+ */
+[scriptable, function, uuid(6149d7d3-14bf-4280-8451-60fb48263894)]
+interface nsIDoneFindCertForEmailCallback : nsISupports {
+ /**
+ * Called after a searching for a certificate is done.
+ *
+ * @param emailAddress - The email address that was used as the key
+ * to find this certificate.
+ * @param cert - The valid certificate that was found,
+ * or null, if no valid cert was found.
+ */
+ void findCertDone(in AUTF8String emailAddress,
+ in nsIX509Cert cert);
+};
+
+/**
+ * An instance of this type is related to exactly one email message
+ * while the user is composing it.
+ * Besides remembering flags and providing helper code, it is used to
+ * cache information about valid S/MIME encryption certificates that
+ * were found and which may be used at send time.
+ */
+[scriptable, uuid(245f2adc-410e-4bdb-91e2-a7bb42d61787)]
+interface nsIMsgComposeSecure : nsISupports
+{
+ /**
+ * Set to true if the outgoing message shall be signed.
+ */
+ attribute boolean signMessage;
+
+ /**
+ * Set to true if the outgoing message shall be encrypted.
+ */
+ attribute boolean requireEncryptMessage;
+
+ /***************************************************************************
+ * The following functions are called during message creation by nsMsgSend,
+ * after the message source is completely prepared.
+ ***************************************************************************/
+
+ /**
+ * Determine if encryption and/or signing is required.
+ *
+ * @param aIdentity - The sender's identity
+ * @param compFields - Attributes of the composed message
+ *
+ * @return - Returns true if the creation of the message requires us to go through
+ * some encryption work, and false otherwise.
+ */
+ boolean requiresCryptoEncapsulation(in nsIMsgIdentity aIdentity, in nsIMsgCompFields aCompFields);
+
+ /**
+ * Start encryption work. Called before the encrypted data is processed.
+ *
+ * @param aStream - Output stream that takes the resulting data
+ * @param aRecipients - RFC 2047-encoded list of all recipients (To:, Cc:, Bcc:, ... fields), separated by "," or ", "
+ * Recipients contain name and email addresses, just like they will be put into the message headers
+ * @param compFields - Attributes of the composed message
+ * @param aIdentity - The sender's identity
+ * @param sendReport - Report feedback to the user
+ * @param aIsDraft - True if send operation saves draft/template/etc., false if message is really sent (or sent later)
+ */
+ void beginCryptoEncapsulation(in nsIOutputStream aStream, in string aRecipients, in nsIMsgCompFields aCompFields, in nsIMsgIdentity aIdentity, in nsIMsgSendReport sendReport, in boolean aIsDraft);
+
+ /**
+ * Process a part of the message data. Called multiple times, usually for every
+ * line of the data to be encrypted
+ *
+ * @param aBuf - Buffer holding the data to be processed
+ * @param aLen - Length of the buffer (number of characters)
+ */
+ void mimeCryptoWriteBlock(in string aBuf, in long aLen);
+
+ /**
+ * End encryption work. Called after the encrypted data is processed.
+ *
+ * @param aAbort - True if the send operation was aborted
+ * @param sendReport - Report feedback to the user
+ */
+ void finishCryptoEncapsulation(in boolean aAbort, in nsIMsgSendReport sendReport);
+
+ /**
+ * Is information about a valid encryption certificate for the given
+ * email address already available in the cache?
+ *
+ * @param emailAddress - The email address to check.
+ *
+ * @return - True if a valid cert is known by the cache.
+ */
+ boolean haveValidCertForEmail(in AUTF8String emailAddress);
+
+ /**
+ * If a valid encryption certificate for the given email address
+ * is already known by the cache, then return the NSS database
+ * key of that certificate.
+ *
+ * @param emailAddress - The email address to check.
+ *
+ * @return - NSS db key of the valid cert.
+ */
+ ACString getCertDBKeyForEmail(in AUTF8String emailAddress);
+
+ /**
+ * Remember the given certificate database key in our cache. The
+ * given certDBey (as used with nsIX509CertDB) must reference a
+ * valid encryption certificate for the given email address.
+ *
+ * @param emailAddress - The email address that is related to
+ * the given certDBKey.
+ * @param certDBKey - The certificate database key.
+ */
+ void cacheValidCertForEmail(in AUTF8String emailAddress,
+ in ACString certDBKey);
+
+ /*
+ * Asynchronously find an encryption certificate by email address. Calls
+ * `findCertDone` function on the provided `nsIDoneFindCertForEmailCallback`
+ * with the results of the operation.
+ *
+ * @param emailAddress - The email address to be used as the key
+ * to find the certificate.
+ * @param callback - A callback of type nsIDoneFindCertForEmailCallback,
+ * function findCertDone will be called with
+ * the result of the operation.
+ */
+ [must_use]
+ void asyncFindCertByEmailAddr(in AUTF8String emailAddress,
+ in nsIDoneFindCertForEmailCallback callback);
+};
diff --git a/comm/mailnews/compose/public/nsIMsgComposeService.idl b/comm/mailnews/compose/public/nsIMsgComposeService.idl
new file mode 100644
index 0000000000..068bb7bd46
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgComposeService.idl
@@ -0,0 +1,169 @@
+/* -*- 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;
+
+webidl Selection;
+
+[scriptable, uuid(041782bf-e523-444b-a268-d90868fd2b50)]
+interface nsIMsgComposeService : nsISupports {
+
+ /**
+ * Open a compose window given a mailto url and other options.
+ *
+ * @param msgComposeWindowURL 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 msgHdr The header of the original message.
+ * @param originalMsgURI The URI of the original message.
+ * @param type The message compose type: new/reply/forward/..
+ * @param format The message compose format: text/html/..
+ * @param identity The identity to send the message from.
+ * @param from The email address of the sender.
+ * @param aMsgWindow The message window to use.
+ * @param suppressReplyQuote An optional boolean flag to ignore or include
+ selected content in aMsgWindow as quote in the
+ new compose window.
+ */
+ [can_run_script]
+ void OpenComposeWindow(in AUTF8String msgComposeWindowURL,
+ in nsIMsgDBHdr msgHdr,
+ in AUTF8String originalMsgURI,
+ in MSG_ComposeType type,
+ in MSG_ComposeFormat format,
+ in nsIMsgIdentity identity,
+ in AUTF8String from,
+ in nsIMsgWindow aMsgWindow,
+ [optional] in Selection aSelection,
+ [optional] in boolean autodetectCharset);
+
+ /**
+ * 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 initializes 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 AUTF8String 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/comm/mailnews/compose/public/nsIMsgCopy.idl b/comm/mailnews/compose/public/nsIMsgCopy.idl
new file mode 100644
index 0000000000..338e7234de
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgCopy.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: IDL; 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 "nsIMsgFolder.idl"
+#include "nsIMsgIdentity.idl"
+#include "nsIMsgSend.idl"
+
+/**
+ * The contract ID for this component is @mozilla.org/messengercompose/msgcopy;1.
+ */
+[scriptable, uuid(de03b16f-3a41-40d0-a487-ca21abcf2bee)]
+interface nsIMsgCopy : nsISupports {
+ /**
+ * Start the process of copying a message file to a message folder. The
+ * destinationfolder depends on pref and deliver mode.
+ *
+ * @param aUserIdentity The identity of the sender
+ * @param aFile The message file
+ * @param aMode The deliver mode
+ * @param aMsgSendObj The nsIMsgSend instance that listens to copy events
+ * @param aSavePref The folder uri on server
+ * @param aMsgToReplace The message to replace when copying
+ */
+ void startCopyOperation(in nsIMsgIdentity aUserIdentity,
+ in nsIFile aFile,
+ in nsMsgDeliverMode aMode,
+ in nsIMsgSend aMsgSendObj,
+ in AUTF8String aSavePref,
+ in nsIMsgDBHdr aMsgToReplace);
+
+ /**
+ * Destination folder of the copy operation. Used when aborting copy operation.
+ */
+ readonly attribute nsIMsgFolder dstFolder;
+};
diff --git a/comm/mailnews/compose/public/nsIMsgQuote.idl b/comm/mailnews/compose/public/nsIMsgQuote.idl
new file mode 100644
index 0000000000..ae8fef2ab9
--- /dev/null
+++ b/comm/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 AUTF8String msgURI, in boolean quoteHeaders,
+ in nsIMsgQuotingOutputStreamListener streamListener,
+ in bool autodetectCharset, 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/comm/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl b/comm/mailnews/compose/public/nsIMsgQuotingOutputStreamListener.idl
new file mode 100644
index 0000000000..ac86361ab5
--- /dev/null
+++ b/comm/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/comm/mailnews/compose/public/nsIMsgSend.idl b/comm/mailnews/compose/public/nsIMsgSend.idl
new file mode 100644
index 0000000000..9d4639925d
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgSend.idl
@@ -0,0 +1,374 @@
+/* -*- 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 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;
+};
+
+[ptr] native nsMsgAttachedFile(nsMsgAttachedFile);
+
+[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 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
+ */
+ Promise 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 AString aBody,
+ in mozIDOMWindowProxy aParentWindow,
+ in nsIMsgProgress aProgress,
+ in nsIMsgSendListener aListener,
+ in AString 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 nsIMsgAttachedFile objects
+ * @param aEmbeddedObjects Array of nsIMsgEmbeddedImageData objects for
+ * MHTML messages.
+ * @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 Array<nsIMsgAttachedFile> aAttachments,
+ in Array<nsIMsgEmbeddedImageData> 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 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.
+ */
+ Promise sendMessageFile(in nsIMsgIdentity aUserIdentity,
+ in string aAccountKey,
+ in nsIMsgCompFields aFields,
+ in nsIFile aSendIFile,
+ in boolean aDeleteSendFileOnCompletion,
+ in boolean aDigest,
+ in nsMsgDeliverMode aMode,
+ in nsIMsgDBHdr aMsgToReplace,
+ in nsIMsgSendListener aListener,
+ in nsIMsgStatusFeedback aStatusFeedback,
+ in wstring 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();
+
+ /* retrieve 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 notifyListenerOnTransportSecurityError(in string msgID, in nsresult status, in nsITransportSecurityInfo secInfo, in ACString location);
+ 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 AUTF8String 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;
+
+ /* process attachment */
+ void gatherMimeAttachments();
+ readonly attribute boolean processAttachmentsSynchronously;
+ 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;
+
+ /// 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/comm/mailnews/compose/public/nsIMsgSendLater.idl b/comm/mailnews/compose/public/nsIMsgSendLater.idl
new file mode 100644
index 0000000000..65fecebced
--- /dev/null
+++ b/comm/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/comm/mailnews/compose/public/nsIMsgSendLaterListener.idl b/comm/mailnews/compose/public/nsIMsgSendLaterListener.idl
new file mode 100644
index 0000000000..6e6e29a794
--- /dev/null
+++ b/comm/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/comm/mailnews/compose/public/nsIMsgSendListener.idl b/comm/mailnews/compose/public/nsIMsgSendListener.idl
new file mode 100644
index 0000000000..0bca8cceb0
--- /dev/null
+++ b/comm/mailnews/compose/public/nsIMsgSendListener.idl
@@ -0,0 +1,79 @@
+/* -*- 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;
+interface nsITransportSecurityInfo;
+
+[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 message id and the folder uri before the draft
+ * is copied.
+ */
+ void onGetDraftFolderURI(in string aMsgID, in AUTF8String 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);
+
+ /**
+ * Notify that an NSS security error has occurred during the send
+ * (e.g. Bad Certificate or SSL version failure).
+ * This callback is invoked before onStopSending(), in case a listener
+ * needs the securityInfo - most likely to get at a failed certificate,
+ * allowing the user to add an exception.
+ * onStopSending() will still be called after this, so a listener
+ * which doesn't need special NSS handling can just leave this callback as
+ * an empty function and leave the handling to onStopSending().
+ *
+ * @param {string} msgID - The message ID.
+ * @param {nsresult} status - The error code (it will be in the NSS error
+ * code range).
+ * @param {nsITransportSecurityInfo} secInfo
+ * - Security info for the failed operation.
+ * @param {ACString} location - The location of the failed operation
+ * ("<host>:<port>")
+ */
+ void onTransportSecurityError(in string msgID, in nsresult status, in nsITransportSecurityInfo secInfo, in ACString location);
+
+};
diff --git a/comm/mailnews/compose/public/nsIMsgSendReport.idl b/comm/mailnews/compose/public/nsIMsgSendReport.idl
new file mode 100644
index 0000000000..bcdf8e7265
--- /dev/null
+++ b/comm/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"
+
+interface mozIDOMWindowProxy;
+
+[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 mozIDOMWindowProxy prompt, in boolean showErrorOnly, in boolean dontShowReportTwice);
+};
diff --git a/comm/mailnews/compose/public/nsISmtpServer.idl b/comm/mailnews/compose/public/nsISmtpServer.idl
new file mode 100644
index 0000000000..6180e9289d
--- /dev/null
+++ b/comm/mailnews/compose/public/nsISmtpServer.idl
@@ -0,0 +1,151 @@
+/* -*- 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 unique identifier for this server that can be used for the same
+ * server synced across multiple profiles. Auto-generated on first use.
+ */
+ attribute AUTF8String UID;
+
+ /// A user supplied description for the server.
+ attribute AUTF8String description;
+
+ /// The server's hostname.
+ attribute AUTF8String hostname;
+
+ /// The server's port.
+ attribute int32_t port;
+
+ /// The username to access the server with (if required)
+ attribute ACString username;
+
+ /**
+ * The CLIENTID to use for this server (if required).
+ * @see https://tools.ietf.org/html/draft-storey-smtp-client-id-05
+ */
+ attribute ACString clientid;
+
+ /**
+ * Whether the CLIENTID feature above is enabled.
+ */
+ attribute boolean clientidEnabled;
+
+ /**
+ * 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 AString 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 ACString helloArgument;
+
+ /// Returns the URI of the server (smtp:///)
+ readonly attribute AUTF8String serverURI;
+
+ /** Limit of concurrent connections to a server. */
+ attribute long maximumConnectionsNumber;
+
+ /** Close cached server connections. */
+ void closeCachedConnections();
+
+ /**
+ * 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.
+ * @return The password to use (may be null if no password was
+ * obtained).
+ */
+ AString getPasswordWithUI(in wstring promptString, in wstring promptTitle);
+
+ /**
+ * 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 AString 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/comm/mailnews/compose/public/nsISmtpService.idl b/comm/mailnews/compose/public/nsISmtpService.idl
new file mode 100644
index 0000000000..0fc306fe11
--- /dev/null
+++ b/comm/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 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 <CRLF>.<CRLF> 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 aSender The senders email address.
+ * @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 aMessageId The message id can be used as ENVID for DSN.
+ * @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 aSender,
+ in AString aPassword,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgStatusFeedback aStatusListener,
+ in nsIInterfaceRequestor aNotificationCallbacks,
+ in boolean aRequestDSN,
+ in ACString aMessageId,
+ 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
+ */
+ nsISmtpServer getServerByIdentity(in nsIMsgIdentity aSenderIdentity);
+
+ /**
+ * A copy of the array of SMTP servers, as stored in the preferences
+ */
+ readonly attribute Array<nsISmtpServer> 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.
+ */
+ 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/comm/mailnews/compose/public/nsISmtpUrl.idl b/comm/mailnews/compose/public/nsISmtpUrl.idl
new file mode 100644
index 0000000000..c03bc7f4e6
--- /dev/null
+++ b/comm/mailnews/compose/public/nsISmtpUrl.idl
@@ -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/. */
+
+#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;
+
+ /**
+ * The sender of this mail (can be different from identity).
+ */
+ attribute string sender;
+
+ /**
+ * 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;
+};