1 /* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 * David Bienvenu - bienvenu@nventure.com
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsISupports.idl"
40 #include "nsIMsgCompFields.idl"
41 #include "nsIMsgComposeParams.idl"
42 #include "nsIMsgSendListener.idl"
43
44 %{C++
45 #include "nsStringGlue.h"
46 %}
47
48 interface nsIMsgSend;
49 interface nsIMsgIdentity;
50 interface nsIMsgProgress;
51 interface nsIDOMWindowInternal;
52 interface nsIDOMWindow;
53 interface nsIDOMNode;
54 interface nsIEditor;
55 interface nsIMsgWindow;
56
57 typedef long MSG_ComposeSaveType;
58
59 [scriptable, uuid(6953e50a-7531-11d3-85fe-006008948010)]
60 interface nsIMsgCompSaveType {
61 const long File = 0;
62 const long Template = 1;
63 const long Draft = 2;
64 };
65
66 typedef long MSG_DeliverMode;
67
68 [scriptable, uuid(a9f27dd7-8f89-4de3-8fbf-41b789c16ee5)]
69 interface nsIMsgCompDeliverMode {
70 const long Now = 0;
71 const long Later = 1;
72 const long Save = 2;
73 const long SaveAs = 3;
74 const long SaveAsDraft = 4;
75 const long SaveAsTemplate = 5;
76 const long SendUnsent = 6;
77 const long AutoSaveAsDraft = 7;
78 };
79
80 [scriptable, uuid(f38ea280-e090-11d3-a449-e3153319347c)]
81 interface nsIMsgCompSendFormat {
82 const long AskUser = 4; /* Hack: Bug 44512. If this is 0 and passed
83 as results.action to the askSendFormat
84 dialog, the args object gets destroyed.*/
85 const long PlainText = 1;
86 const long HTML = 2;
87 const long Both = 3;
88 };
89
90 [scriptable, uuid(9638af92-1dd1-11b2-bef1-ca5fee0abc62)]
91 interface nsIMsgCompConvertible/*ToTXT*/ {
92 const long Plain = 1; // Like 4.x: Only <html>, <p>, <br>, ...
93 const long Yes = 2; // *Minor* alterations of the look: <ol>, <dd>, ...
94 const long Altering = 3; /* Look altered: <strong>, <i>, <h1>, ...
95 Can be expressed in plaintext, but not in
96 the way it looked in the HTML composer. */
97 const long No = 4; /* Will lose data: <font>, ...
98 Really *requires* visual formatting or
99 is not supported by our HTML->TXT converter. */
100 /* The values here have meaning, they are "levels":
101 convertible({a; b}) == max(convertible({a}), convertible({b}))
102 must be true, i.e. the higher value counts. */
103 };
104
105 [scriptable, uuid(6ce49b2a-07dc-4783-b307-9a355423163f)]
106 interface nsIMsgComposeStateListener : nsISupports
107 {
108 /* ... */
109 void NotifyComposeFieldsReady();
110 void ComposeProcessDone(in nsresult aResult);
111 void SaveInFolderDone(in string folderName);
112 void NotifyComposeBodyReady();
113 };
114
115 [scriptable, uuid(061aae23-7e0a-4818-9a15-1b5db3ceb7f4)]
116 interface nsIMsgComposeNotificationType
117 {
118 const long ComposeFieldsReady = 0;
119 const long ComposeProcessDone = 1;
120 const long SaveInFolderDone = 2;
121 const long ComposeBodyReady = 3;
122 };
123
124 native nsString(nsString);
125 [ref] native nsStringRef(nsString);
126
127 /* recycling listener interface */
128 [scriptable, uuid(0b28cc56-1dd2-11b2-bbe4-99e6a314f8ba)]
129 interface nsIMsgComposeRecyclingListener : nsISupports {
130 void onClose();
131 void onReopen(in nsIMsgComposeParams params);
132 };
133
134 [scriptable, uuid(4e0bbbb8-4c9d-499e-ad8a-5e4c1866c0bb)]
135 interface nsIMsgCompose : nsIMsgSendListener {
136
137 /* ... */
138 void Initialize(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams aParams);
139
140 /* ... */
141 void SetDocumentCharset(in string charset);
142
143 /* ... */
144 void RegisterStateListener(in nsIMsgComposeStateListener stateListener);
145
146 /* ... */
147 void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
148
149 /* ... */
150 void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in string accountKey, in nsIMsgWindow aMsgWindow, in nsIMsgProgress progress);
151
152 /* ... */
153 void CloseWindow(in boolean reclycleIt);
154
155 /* ... */
156 void abort();
157
158 /* ... */
159 void quoteMessage(in string msgURI);
160
161 /*
162 AttachmentPrettyName will return only the leafName if the it's a file URL.
163 It will also convert the filename to Unicode assuming it's in the file system
164 charset. In case of URL, |charset| parameter will be used in the conversion.
165 This UI utility function should probably go into it's own class
166 */
167 AUTF8String AttachmentPrettyName(in string url, in string charset);
168
169 /**
170 * checkAndPopulateRecipients can perform several tasks (see params), the
171 * main task is to determine the lowest common format preferred by recipients.
172 *
173 * @param aPopulateMailList If true, this function will populate
174 * mailing lists present in the compose field.
175 * @param aReturnNonHTMLRecipients If true, will build a list of the non
176 * HTML receipients.
177 * @param aNonHTMLRecipients This will contain any non-HTML recipients,
178 * if aReturnNonHTMLRecipients is true
179 * (comma-separated).
180 * @return The lowest common format preferred by
181 * recipients (unknown, plaintext or html).
182 * See nsIAbPreferMailFormat.
183 */
184 unsigned long checkAndPopulateRecipients(in boolean aPopulateMailList,
185 in boolean aReturnNonHTMLRecipients,
186 out AString aNonHTMLRecipients);
187
188 /* bodyConvertible: The level of "convertibility" to plaintext
189 * @return a value from nsIMsgCompConvertible.
190 */
191 long bodyConvertible();
192
193 /* SetSignature: will replace the curr.
194 */
195 void SetSignature(in nsIMsgIdentity identity);
196
197 /* Check if the composing mail headers (and identity) can be converted to a mail charset.
198 */
199 boolean checkCharsetConversion(in nsIMsgIdentity identity, out string fallbackCharset);
200
201 /* Retreive the message send object */
202 readonly attribute nsIMsgSend messageSend;
203
204 /* ... */
205 readonly attribute nsIEditor editor;
206
207 /* ... */
208 readonly attribute nsIDOMWindowInternal domWindow;
209
210 /* ... */
211 readonly attribute nsIMsgCompFields compFields;
212
213 /* ... */
214 readonly attribute boolean composeHTML;
215
216 /* ... */
217 attribute MSG_ComposeType type;
218
219 /* ... */
220 readonly attribute long wrapLength;
221
222 /* by reading this value, you can determine if yes or not the message has been mofified
223 by the user. When you set this value to false, you reset the modification count
224 of the body to 0 (clean).
225 */
226 attribute boolean bodyModified;
227
228
229 /**
230 * Init the editor THIS USED TO BE [noscript]
231 * Now, this is called after editor is created,
232 * which is triggered by loading startup url from JS.
233 * The completion of document loading is detected by observing
234 * the "obs_documentCreated" command
235 */
236 void initEditor(in nsIEditor editor, in nsIDOMWindow contentWindow);
237
238 /* The following functions are for internal use, essentially for the listener */
239
240 /* Clear the editor */
241 [noscript] void clearEditor();
242
243 /* ... */
244 [noscript] void setCiteReference(in nsString citeReference);
245
246 /* Set the URI of the folder where the message has been saved */
247 attribute string savedFolderURI;
248
249 /* Append the signature defined in the identity to the msgBody */
250 [noscript] void processSignature(in nsIMsgIdentity identity,
251 in boolean aQuoted,
252 inout nsString aMsgBody);
253
254 /* set any reply flags on the original message's folder */
255 [noscript] void processReplyFlags();
256 [noscript] void rememberQueuedDisposition();
257
258 /* ... */
259 [noscript] void convertAndLoadComposeWindow(in nsStringRef aPrefix,
260 in nsStringRef aBuf,
261 in nsStringRef aSignature,
262 in boolean aQuoted,
263 in boolean aHTMLEditor);
264
265 /* Tell the doc state listeners that the doc state has changed
266 * aNotificationType is from nsIMsgComposeNotificationType
267 */
268 [noscript] void notifyStateListeners(in long aNotificationType, in nsresult aResult);
269
270 /* Retreive the progress object */
271 readonly attribute nsIMsgProgress progress;
272
273 /* ... */
274 [noscript] void buildBodyMessageAndSignature();
275
276 /* ... */
277 [noscript] void buildQuotedMessageAndSignature();
278
279 /* ... */
280 [noscript] void getQuotingToFollow(out boolean quotingToFollow);
281
282 /* ... */
283 attribute nsIMsgComposeRecyclingListener recyclingListener;
284
285 /* ... */
286 attribute boolean recycledWindow;
287
288 readonly attribute string originalMsgURI;
289
290 attribute boolean deleteDraft;
291
292 /* true when the compose window is in the process of inserting quoted content
293 (i.e. via reply, forward inline or a quoting operation) into the document
294 */
295 attribute boolean insertingQuotedContent;
296
297 /* for easier use of nsIMsgSendListener */
298 void addMsgSendListener(in nsIMsgSendListener sendListener);
299
300 /* for easier use of nsIMsgSendListener */
301 void removeMsgSendListener(in nsIMsgSendListener sendListener);
302
303 };
304
305 /* send listener interface */
306 [noscript, uuid(ACC72780-2CEA-11D5-9DAA-BACDEAC1EEFC)]
307 interface nsIMsgComposeSendListener : nsISupports {
308
309 void setMsgCompose(in nsIMsgCompose msgCompose);
310 void setDeliverMode(in MSG_DeliverMode deliverMode);
311
312 };