1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37 #include "nsISupports.idl"
38 #include "nsrootidl.idl"
39
40 interface nsIOutputStream;
41 interface nsIInputStream;
42 interface nsIURI;
43 interface nsIStreamListener;
44 interface nsIChannel;
45
46 [scriptable, uuid(39E329E2-357F-11d3-8EFD-00A024A7D144)]
47 interface nsMimeHeaderDisplayTypes
48 {
49 const long MicroHeaders = 0;
50 const long NormalHeaders = 1;
51 const long AllHeaders = 2;
52 };
53
54 %{C++
55 //#define NS_IMIME_MISC_STATUS_KEY "@mozilla.org/messenger/mimestatus;1?"
56 #define NS_IMIME_MISC_STATUS_KEY "@mozilla.org/MimeMiscStatus;1?type="
57 %}
58
59 [scriptable, uuid(D01D7B59-DCCD-11d2-A411-00805F613C79)]
60 interface nsIMimeEmitter : nsISupports{
61
62 // These will be called to start and stop the total operation
63 void Initialize(in nsIURI url, in nsIChannel aChannel, in long aFormat);
64 void Complete();
65
66 // Set the output stream/listener for processed data.
67 void SetPipe(in nsIInputStream inputStream, in nsIOutputStream outStream);
68 void SetOutputListener(in nsIStreamListener listener);
69
70 //Get the output listener to allow access to it from mime
71 nsIStreamListener GetOutputListener();
72
73 // Header handling routines.
74 void StartHeader(in PRBool rootMailHeader, in PRBool headerOnly,
75 [const] in string msgID, [const] in string outCharset);
76 void AddHeaderField([const] in string field, [const] in string value);
77 void addAllHeaders([const] in string allheaders, [const] in long allheadersize);
78 void WriteHTMLHeaders(); // book case this with a EndHeader call.
79 void EndHeader();
80 void UpdateCharacterSet([const] in string aCharset);
81
82 // Attachment handling routines
83 void StartAttachment([const] in string name, [const] in string contentType,
84 [const] in string url, in PRBool aNotDownloaded);
85 void AddAttachmentField([const] in string field, [const] in string value);
86 void EndAttachment();
87
88 void EndAllAttachments();
89
90 // Body handling routines
91 void StartBody(in PRBool bodyOnly, [const] in string msgID, [const] in string outCharset);
92 void WriteBody([const] in string buf, in PRUint32 size, out PRUint32 amountWritten);
93 void EndBody();
94
95 // Generic write routine. This is necessary for output that
96 // libmime needs to pass through without any particular parsing
97 // involved (i.e. decoded images, HTML Body Text, etc...
98 void Write([const] in string buf, in PRUint32 size, out PRUint32 amountWritten);
99 void UtilityWrite([const] in string buf);
100 };