Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgSend.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /*
00039  * The nsIMsgSend method will create an RFC822 message and send it all in one operation 
00040  * as well as providing the ability to save disk files for later use. The mode of delivery 
00041  * can also be specified for the "Send Later", "Drafts" and "Templates" operations. (NOTE: 
00042  * This method could easily be broken in to a few different calls. Currently, this method 
00043  * does several functions depending on the arguments passed in, but this could easily lead 
00044  * to confusion. This is something that very well may change as time allows). 
00045  */
00046 #include "nsISupports.idl"
00047 #include "nsISupportsArray.idl"
00048 #include "nsrootidl.idl"
00049 #include "nsIMsgIdentity.idl"
00050 #include "nsIMsgCompFields.idl"
00051 #include "nsIMsgSendListener.idl"
00052 #include "nsIMsgSendReport.idl"
00053 #include "domstubs.idl"
00054 #include "nsIPrompt.idl"
00055 #include "MailNewsTypes2.idl"
00056 #include "nsIMsgComposeParams.idl"
00057 
00058 %{C++
00059 #include "nsIURL.h"
00060 #include "nsString.h"
00061 class nsFileSpec;
00062 class nsOutputFileStream;
00063 %}
00064 
00065 interface nsIMsgProgress;
00066 interface nsIURI;
00067 interface nsIRequest;
00068 interface nsIMsgDBHdr;
00069 interface nsIMsgHdr;
00070 interface nsIDocShell;
00071 interface nsIFileSpec;
00072 interface nsIMsgComposeSecure;
00073 interface nsIMsgStatusFeedback;
00074 interface nsIEditor;
00075 
00076 typedef long nsMsgDeliverMode;
00077 
00078 %{ C++
00079 //
00080 // Callback declarations for message delivery
00081 //
00082 // For completion of send/message creation operations...
00083 typedef nsresult (*nsMsgSendCompletionCallback) (nsresult aExitCode, void *tagData, nsFileSpec *returnFileSpec);
00084 
00085 // For completion of sending unsent messages operations...
00086 typedef nsresult (*nsMsgSendUnsentMessagesCallback) (nsresult aExitCode, PRUint32 totalSentCount,
00087                                                      PRUint32 totalSentSuccessfully, void *tagData);
00088 %}
00089 
00090 %{ C++
00091 // Forward declaration
00092 class nsMsgAttachmentHandler;
00093 
00094 // Attachment file/URL structures
00095 struct nsMsgAttachmentData
00096 {
00097   nsIURI* url;                           // The URL to attach. This should be 0 to signify "end of list".
00098 
00099   char *desired_type;           // The type to which this document should be
00100                                                         // converted.  Legal values are NULL, TEXT_PLAIN
00101                                                         // and APPLICATION_POSTSCRIPT (which are macros
00102                           // defined in net.h); other values are ignored.
00103 
00104   char *real_type;              // The type of the URL if known, otherwise NULL. For example, if 
00105                           // you were attaching a temp file which was known to contain HTML data, 
00106                           // you would pass in TEXT_HTML as the real_type, to override whatever type 
00107                           // the name of the tmp file might otherwise indicate.
00108 
00109   char *real_encoding;        // Goes along with real_type 
00110 
00111   char *real_name;              // The original name of this document, which will eventually show up in the 
00112                           // Content-Disposition header. For example, if you had copied a document to a 
00113                           // tmp file, this would be the original, human-readable name of the document.
00114 
00115   char *description;     // If you put a string here, it will show up as the Content-Description header.  
00116                           // This can be any explanatory text; it's not a file name.                                           
00117 
00118   char *x_mac_type, *x_mac_creator; // Mac-specific data that should show up as optional parameters
00119                                                                   // to the content-type header.
00120   PRBool  isExternalAttachment;  // Flag for determining if the attachment is external
00121 };
00122 
00123 
00124 //
00125 // When we have downloaded a URL to a tmp file for attaching, this
00126 // represents everything we learned about it (and did to it) in the
00127 // process. 
00128 //
00129 typedef struct nsMsgAttachedFile
00130 {
00131   nsCOMPtr<nsIURI> orig_url;       // Where it came from on the network (or even elsewhere on the local disk.)
00132 
00133   nsFileSpec  *file_spec;          // The tmp file in which the (possibly converted) data now resides.
00134   
00135   char        *type;                 // The type of the data in file_name (not necessarily the same as the type of orig_url.)
00136 
00137   char        *encoding;           // Likewise, the encoding of the tmp file. This will be set only if the original 
00138                             // document had an encoding already; we don't do base64 encoding and so forth until 
00139                             // it's time to assemble a full MIME message of all parts.
00140 
00141 
00142   char        *description;   // For Content-Description header 
00143   char        *x_mac_type;    // mac-specific info 
00144   char        *x_mac_creator; // mac-specific info 
00145   char        *real_name;            // The real name of the file. 
00146 
00147   // Some statistics about the data that was written to the file, so that when
00148        // it comes time to compose a MIME message, we can make an informed decision
00149        // about what Content-Transfer-Encoding would be best for this attachment.
00150   // (If it's encoded already, we ignore this information and ship it as-is.)
00151   PRUint32    size;
00152   PRUint32    unprintable_count;
00153   PRUint32    highbit_count;
00154   PRUint32    ctl_count;
00155   PRUint32    null_count;
00156   PRUint32    max_line_length;
00157   
00158 } nsMsgAttachedFile;
00159 %}
00160 
00161 
00162 [ptr] native nsMsgAttachmentData(nsMsgAttachmentData);
00163 [ptr] native nsMsgAttachedFile(nsMsgAttachedFile);
00164 [ptr] native nsMsgAttachmentHandler(nsMsgAttachmentHandler);
00165 [ptr] native nsOutputFileStream(nsOutputFileStream);
00166 [ptr] native nsCString(nsCString);
00167 
00168 [scriptable, uuid(39876de6-207f-43f4-99a7-d60f1c49ea48)]
00169 interface nsIMsgSend : nsISupports 
00170 {
00171   //
00172   // This is the primary interface for creating and sending RFC822 messages
00173   // in the new architecture. Currently, this method supports many arguments
00174   // that change the behavior of the operation. This will change in time to 
00175   // be separate calls that will be more singluar in nature.
00176   //
00177   // NOTE: when aEditor is non-null, a multipart related MHTML message will 
00178   // be created
00179   //
00180     
00181     const nsMsgDeliverMode nsMsgDeliverNow = 0;
00182     const nsMsgDeliverMode nsMsgQueueForLater = 1;
00183     const nsMsgDeliverMode nsMsgSave = 2;
00184     const nsMsgDeliverMode nsMsgSaveAs = 3;
00185     const nsMsgDeliverMode nsMsgSaveAsDraft = 4;
00186     const nsMsgDeliverMode nsMsgSaveAsTemplate = 5;
00187     const nsMsgDeliverMode nsMsgSendUnsent = 6;
00188 
00189     [noscript]
00190     void createAndSendMessage(in nsIEditor                    aEditor,
00191                               in nsIMsgIdentity               aUserIdentity,
00192                               in string                       aAccountKey,
00193                               in nsIMsgCompFields             fields,
00194                               in PRBool                       digest_p,
00195                               in PRBool                       dont_deliver_p,
00196                               in nsMsgDeliverMode             mode, 
00197                               in nsIMsgDBHdr                  msgToReplace,
00198                               in string               attachment1_type,
00199                               in string               attachment1_body,
00200                               in PRUint32                     attachment1_body_length,
00201                               [const] in nsMsgAttachmentData  attachments,
00202                               [const] in nsMsgAttachedFile    preloaded_attachments,
00203                               in voidPtr                      relatedPart,
00204                               in nsIDOMWindowInternal         parentWindow,
00205                               in nsIMsgProgress               progress,
00206                               in nsIMsgSendListener           aListener,
00207                               in string                       password,
00208                               in AUTF8String                  aOriginalMsgURI,
00209                               in MSG_ComposeType              aType
00210                              );
00211                               
00212     
00213     void sendMessageFile(in nsIMsgIdentity       aUserIdentity,
00214                          in string               aAccountKey,
00215                          in nsIMsgCompFields     fields,
00216                          in nsIFileSpec          sendIFileSpec,
00217                          in PRBool               deleteSendFileOnCompletion,
00218                          in PRBool               digest_p,
00219                          in nsMsgDeliverMode     mode,
00220                          in nsIMsgDBHdr          msgToReplace,
00221                          in nsIMsgSendListener   aListener,
00222                          in nsIMsgStatusFeedback aStatusFeedback,
00223                          in string               password
00224                        ); 
00225 
00226     /* Abort current send/save operation */
00227     void abort();
00228     
00229     /* Report a send failure */
00230     nsresult fail(in nsresult failure_code, in wstring error_msg);
00231 
00232     /* Disable UI notification (alert message) */
00233     void setGUINotificationState(in PRBool aEnableFlag);
00234     
00235     /* Crypto */
00236     void BeginCryptoEncapsulation();
00237 
00238     /* retreive the last send process report*/
00239     readonly attribute nsIMsgSendReport sendReport; 
00240     
00241     /* methods for send listener ... */
00242     [noscript] void notifyListenerOnStartSending(in string aMsgID, in unsigned long aMsgSize);
00243     [noscript] void notifyListenerOnProgress(in string aMsgID, in unsigned long aProgress, in unsigned long aProgressMax);
00244     [noscript] void notifyListenerOnStatus(in string aMsgID, in wstring aMsg);
00245     [noscript] void notifyListenerOnStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec);
00246     [noscript] void deliverAsMailExit(in nsIURI aUrl, in nsresult aExitCode);
00247     [noscript] void deliverAsNewsExit(in nsIURI aUrl, in nsresult aExitCode);
00248 
00249     /* methods for copy listener ... */
00250     [noscript] void notifyListenerOnStartCopy(); 
00251     [noscript] void notifyListenerOnProgressCopy(in unsigned long aProgress, in unsigned long aProgressMax);
00252     [noscript] void notifyListenerOnStopCopy(in nsresult aStatus);
00253     [noscript] void getMessageId(in nsCString messageID);
00254     [noscript] attribute nsMsgKey messageKey;
00255 
00256     [noscript] nsIPrompt getDefaultPrompt();
00257     
00258     /* process attachment */
00259     [noscript] void gatherMimeAttachments();
00260     [noscript] boolean getProcessAttachmentsSynchronously();
00261     [noscript] nsMsgAttachmentHandler getAttachmentHandlers();
00262     [noscript] readonly attribute unsigned long attachmentCount;
00263     [noscript] attribute unsigned long pendingAttachmentCount;
00264     [noscript] readonly attribute nsMsgDeliverMode deliveryMode;
00265 
00266     [noscript] nsIMsgProgress getProgress();
00267     
00268     [noscript] nsOutputFileStream getOutputStream();
00269 
00270        [noscript] attribute nsIRequest runningRequest;
00271 
00272     [noscript] attribute nsresult status;
00273 
00274     [noscript] attribute nsIMsgComposeSecure cryptoclosure;
00275 };