pjs/mailnews/compose/public/nsIMsgSend.idl

200 строки
8.6 KiB
Plaintext

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* 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 "nsISupportsArray.idl"
#include "nsrootidl.idl"
#include "nsIFileSpec.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgCompFields.idl"
#include "nsIMsgSendListener.idl"
#include "nsIEditorShell.idl"
%{C++
#include "nsIURL.h"
#include "rosetta_mailnews.h"
%}
interface nsIURI;
interface nsIMessage;
interface nsIMsgHdr;
interface nsIDocShell;
typedef long nsMsgDeliverMode;
%{ C++
//
// Callback declarations for message delivery
//
// For completion of send/message creation operations...
typedef nsresult (*nsMsgSendCompletionCallback) (nsresult aExitCode, void *tagData, nsFileSpec *returnFileSpec);
// For completion of sending unsent messages operations...
typedef nsresult (*nsMsgSendUnsentMessagesCallback) (nsresult aExitCode, PRUint32 totalSentCount,
PRUint32 totalSentSuccessfully, void *tagData);
%}
%{ C++
// Attachment file/URL structures
struct nsMsgAttachmentData
{
nsIURI *url; // The URL to attach. This should be 0 to signify "end of list".
char *desired_type; // The type to which this document should be
// converted. Legal values are NULL, TEXT_PLAIN
// and APPLICATION_POSTSCRIPT (which are macros
// defined in net.h); other values are ignored.
char *real_type; // The type of the URL if known, otherwise NULL. For example, if
// you were attaching a temp file which was known to contain HTML data,
// you would pass in TEXT_HTML as the real_type, to override whatever type
// the name of the tmp file might otherwise indicate.
char *real_encoding; // Goes along with real_type
char *real_name; // The original name of this document, which will eventually show up in the
// Content-Disposition header. For example, if you had copied a document to a
// tmp file, this would be the original, human-readable name of the document.
char *description; // If you put a string here, it will show up as the Content-Description header.
// This can be any explanatory text; it's not a file name.
char *x_mac_type, *x_mac_creator; // Mac-specific data that should show up as optional parameters
// to the content-type header.
PRBool notDownloaded; // Flag for IMAP parts on demand status
};
//
// When we have downloaded a URL to a tmp file for attaching, this
// represents everything we learned about it (and did to it) in the
// process.
//
typedef struct nsMsgAttachedFile
{
nsIURI *orig_url; // Where it came from on the network (or even elsewhere on the local disk.)
nsFileSpec *file_spec; // The tmp file in which the (possibly converted) data now resides.
char *type; // The type of the data in file_name (not necessarily the same as the type of orig_url.)
char *encoding; // Likewise, the encoding of the tmp file. This will be set only if the original
// document had an encoding already; we don't do base64 encoding and so forth until
// it's time to assemble a full MIME message of all parts.
char *description; // For Content-Description header
char *x_mac_type; // mac-specific info
char *x_mac_creator; // mac-specific info
char *real_name; // The real name of the file.
// Some statistics about the data that was written to the file, so that when
// it comes time to compose a MIME message, we can make an informed decision
// about what Content-Transfer-Encoding would be best for this attachment.
// (If it's encoded already, we ignore this information and ship it as-is.)
PRUint32 size;
PRUint32 unprintable_count;
PRUint32 highbit_count;
PRUint32 ctl_count;
PRUint32 null_count;
PRUint32 max_line_length;
} nsMsgAttachedFile;
%}
[ptr] native nsMsgAttachmentData(nsMsgAttachmentData);
[ptr] native nsMsgAttachedFile(nsMsgAttachedFile);
[scriptable, uuid(9E9BD970-C5D6-11d2-8297-000000000000)]
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
//
const nsMsgDeliverMode nsMsgDeliverNow = 0;
const nsMsgDeliverMode nsMsgQueueForLater = 1;
const nsMsgDeliverMode nsMsgSave = 2;
const nsMsgDeliverMode nsMsgSaveAs = 3;
const nsMsgDeliverMode nsMsgSaveAsDraft = 4;
const nsMsgDeliverMode nsMsgSaveAsTemplate = 5;
[noscript]
void CreateAndSendMessage(in nsIEditorShell aEditor,
in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
in PRBool digest_p,
in PRBool dont_deliver_p,
in nsMsgDeliverMode mode,
in nsIMessage msgToReplace,
in string attachment1_type,
in string attachment1_body,
in PRUint32 attachment1_body_length,
[const] in nsMsgAttachmentData attachments,
[const] in nsMsgAttachedFile preloaded_attachments,
in voidStar relatedPart,
[array, size_is(listeners)]
in nsIMsgSendListener aListenerArray,
in unsigned long listeners);
void SendMessageFile(in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
in nsIFileSpec sendIFileSpec,
in PRBool deleteSendFileOnCompletion,
in PRBool digest_p,
in nsMsgDeliverMode mode,
in nsIMessage msgToReplace,
[array, size_is(listeners)]
in nsIMsgSendListener aListenerArray,
in unsigned long listeners);
void SendWebPage(in nsIMsgIdentity aUserIdentity,
in nsIMsgCompFields fields,
in nsIURI url,
in nsMsgDeliverMode mode,
[array, size_is(listeners)]
in nsIMsgSendListener aListenerArray,
in unsigned long listeners);
void AddListener(in nsIMsgSendListener aListener);
void RemoveListener(in nsIMsgSendListener aListener);
void SetGUINotificationState(in PRBool aEnableFlag);
void SetDocShell(in nsIDocShell aDocShell);
};