1 /* -*- Mode: IDL; tab-width: 4; 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 *
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
38 #include "nsISupports.idl"
39
40 interface nsIURI;
41 interface nsIUrlListener;
42 interface nsIStreamListener;
43 interface nsIMsgWindow;
44 interface nsIFile;
45 interface nsIMsgFolder;
46 interface nsIMsgSearchSession;
47 interface nsIMsgDBHdr;
48 interface nsIStreamConverter;
49
50 %{C++
51 #include "MailNewsTypes.h"
52 #include "nsTArray.h"
53 %}
54
55 [ref] native nsMsgKeyArrayRef(nsTArray<nsMsgKey>);
56
57
58 [scriptable, uuid(e0b51637-c16e-4f23-b5e3-934df0d71515)]
59 interface nsIMsgMessageService : nsISupports {
60
61 /////////////////////////////////////////////////////////////////
62 // If you want a handle on the running task, pass in a valid nsIURI
63 // ptr. You can later interrupt this action by asking the netlib
64 // service manager to interrupt the url you are given back.
65 // Remember to release aURL when you are done with it. Pass nsnull
66 // in for aURL if you don't care about the returned URL.
67 /////////////////////////////////////////////////////////////////
68
69
70 /////////////////////////////////////////////////////////////////
71 // CopyMessage: Pass in the URI for the message you want to have
72 // copied.
73 // aCopyListener already knows about the destination folder.
74 // Set aMoveMessage to PR_TRUE if you want the message to be moved.
75 // PR_FALSE leaves it as just a copy.
76 ///////////////////////////////////////////////////////////////
77
78 void CopyMessage(in string aSrcURI, in nsIStreamListener aCopyListener, in boolean aMoveMessage,
79 in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL);
80
81 /* copy multiple messages at a time */
82 [noscript] void CopyMessages(in nsMsgKeyArrayRef keys, in nsIMsgFolder srcFolder, in nsIStreamListener aCopyListener, in boolean aMoveMessage,
83 in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL);
84
85 /////////////////////////////////////////////////////////////////////
86 // DisplayMessage: When you want a message displayed....
87 // aMessageURI is a uri representing the message to display.
88 // aDisplayConsumer is (for now) an nsIDocShell which we'll use to load
89 // the message into.
90 // XXXbz Should it be an nsIWebNavigation or something?
91 // aCharsetOverride (optional) character set over ride to force the message to
92 // use.
93 //
94 ///////////////////////////////////////////////////////////////////
95
96 void DisplayMessage(in string aMessageURI,
97 in nsISupports aDisplayConsumer,
98 in nsIMsgWindow aMsgWindow,
99 in nsIUrlListener aUrlListener,
100 in string aCharsetOverride,
101 out nsIURI aURL);
102
103 /////////////////////////////////////////////////////////////////////
104 // OpenAttachment: When you want an attachment downloaded
105 // aContentType --> we need to know the content type of the attachment
106 // aFileName --> the name of the attachment.
107 // aUrl --> string representation of the original url associated with the msg.
108 // aMessageUri --> RDF resource that describes the message
109 // aMsgWindow --> message window
110 ///////////////////////////////////////////////////////////////////
111
112 void openAttachment(in string aContentType,
113 in string aFileName,
114 in string aUrl,
115 in string aMessageUri,
116 in nsISupports aDisplayConsumer,
117 in nsIMsgWindow aMsgWindow,
118 in nsIUrlListener aUrlListener);
119
120 /////////////////////////////////////////////////////////////////////
121 // SaveMessageToDisk: When you want to spool a message out to a file
122 // on disk. This is an asynch operation of course. You must pass in a
123 // url listener in order to figure out when the operation is done.
124 // aMessageURI--> uri representing the message to spool out to disk.
125 // aFile - the file you want the message saved to
126 // aGenerateDummyEnvelope --> usually FALSE. Set to TRUE if you want the msg
127 // appended at the end of the file.
128 ///////////////////////////////////////////////////////////////////
129
130 void SaveMessageToDisk(in string aMessageURI, in nsIFile aFile,
131 in boolean aGenerateDummyEnvelope,
132 in nsIUrlListener aUrlListener, out nsIURI aURL,
133 in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow);
134
135 /////////////////////////////////////////////////////////////////////
136 // GetUrlForUri: when you have a uri and you would like to convert that
137 // to a url which can be run through necko, you can use this method.
138 // the Uri MUST refer to a message and not a folder!
139 /////////////////////////////////////////////////////////////////////
140
141 void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow);
142
143 /////////////////////////////////////////////////////////////////////
144 // DisplayMessageForPrinting: When you want a message displayed in a
145 // format that is suitable for printing....
146 // aMessageURI is a uri representing the message to display.
147 // aDisplayConsumer is (for now) a nsIDocShell which we'll use to load
148 // the message into.
149 // XXXbz should it be an nsIWebNavigation?
150 ///////////////////////////////////////////////////////////////////
151
152 void DisplayMessageForPrinting(in string aMessageURI, in nsISupports aDisplayConsumer,
153 in nsIMsgWindow aMsgWindow,
154 in nsIUrlListener aUrlListener,
155 out nsIURI aURL);
156
157 void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aMsgFolder, in string aSearchUri);
158
159 // this method streams a message to the passed in consumer. If aConvertData is true, it
160 // will create a stream converter from message rfc822 to star/star. It will also tack
161 // aAdditionalHeader onto the url (e.g., "header=filter").
162 // @param aMessageURI uri of message to stream
163 // @param aConsumer generally, a stream listener listening to the message
164 // @param aMsgWindow msgWindow for give progress and status feedback
165 // @param aUrlListener gets notified when url starts and stops
166 // @param aConvertData should we create a stream converter?
167 // @param aAdditionalHeader added to URI, e.g., "header=filter"
168 // @return the URL that gets run
169 nsIURI streamMessage(in string aMessageURI, in nsISupports aConsumer,
170 in nsIMsgWindow aMsgWindow,
171 in nsIUrlListener aUrlListener,
172 in boolean aConvertData,
173 in ACString aAdditionalHeader);
174 /**
175 * now the the message datasource is going away
176 * we need away to go from message uri to go nsIMsgDBHdr
177 */
178 nsIMsgDBHdr messageURIToMsgHdr(in string uri);
179 };
180
181 // Some mail protocols (like imap) allow you to fetch individual mime parts. We use this interface
182 // to represent message services whose protocols support this. To use this interface, you should get
183 // the message service then QI for this interface. If it's present, then can fetch a mime part.
184 [scriptable, uuid(3728C255-480C-11d4-98D0-001083010E9B)]
185 interface nsIMsgMessageFetchPartService : nsISupports
186 {
187 // FetchMimePart --> used to fetch an individual mime part
188 // aURI --> url representing the message
189 // aMessageURI --> RDF URI including the part to fetch
190 nsIURI fetchMimePart(in nsIURI aURI, in string aMessageUri, in nsISupports aDisplayConsumer,
191 in nsIMsgWindow aMsgWindow,
192 in nsIUrlListener aUrlListener);
193 };