1 /* -*- Mode: IDL; 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
38 #include "nsISupports.idl"
39 #include "nsrootidl.idl"
40 #include "nsIRDFCompositeDataSource.idl"
41 #include "nsIMsgWindow.idl"
42 #include "nsIMsgIdentity.idl"
43 #include "nsIMsgThread.idl"
44 #include "nsIMsgFolder.idl"
45
46 interface nsIMsgDBHdr;
47 interface nsIDOMWindowInternal;
48 interface nsITransactionManager;
49 interface nsIMsgMessageService;
50 interface nsIFile;
51 interface nsIUrlListener;
52
53 [scriptable, uuid(1B44C6EB-2C14-470F-AA5C-BDDCE89A4ECC)]
54 interface nsIMessenger : nsISupports {
55
56 const long eUnknown = 0;
57 const long eDeleteMsg = 1;
58 const long eMoveMsg = 2;
59 const long eCopyMsg = 3;
60
61 void setDisplayCharset(in ACString aCharset);
62
63 readonly attribute nsITransactionManager transactionManager;
64
65 void setWindow(in nsIDOMWindowInternal ptr, in nsIMsgWindow msgWindow);
66
67 void deleteFolders(in nsIRDFCompositeDataSource db,
68 in nsIRDFResource parentFolder,
69 in nsIRDFResource folder);
70 void copyMessages(in nsIRDFCompositeDataSource database,
71 in nsIRDFResource srcResource,
72 in nsIRDFResource dstResource,
73 in nsISupportsArray messages,
74 in boolean isMove);
75
76 void copyFolders(in nsIRDFCompositeDataSource database,
77 in nsIRDFResource dstResource,
78 in nsISupportsArray folders,
79 in boolean isMoveFolder);
80
81
82 void openURL(in ACString aURL);
83
84 /** load a custom message by url, e.g load a attachment as a email
85 */
86 void loadURL(in nsIDOMWindowInternal ptr, in ACString aURL);
87
88 void launchExternalURL(in ACString aURL);
89
90 void renameFolder(in nsIRDFCompositeDataSource db,
91 in nsIRDFResource folder, in AString name);
92 void compactFolder(in nsIRDFCompositeDataSource db,
93 in nsIRDFResource folder,
94 in boolean forAll);
95 void emptyTrash(in nsIRDFCompositeDataSource db,
96 in nsIRDFResource folder);
97
98 boolean canUndo();
99 boolean canRedo();
100 unsigned long getUndoTransactionType();
101 unsigned long getRedoTransactionType();
102 void undo(in nsIMsgWindow msgWindow);
103 void redo(in nsIMsgWindow msgWindow);
104 void sendUnsentMessages(in nsIMsgIdentity aIdentity, in nsIMsgWindow aMsgWindow);
105 void setDocumentCharset(in ACString characterSet);
106 void saveAs(in ACString aURI, in boolean aAsFile, in nsIMsgIdentity aIdentity, in AString aMsgFilename);
107 void openAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment);
108 void saveAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment);
109 void saveAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray,
110 [array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray,
111 [array, size_is(count)] in string messageUriArray);
112
113 void saveAttachmentToFile(in nsIFile aFile, in ACString aUrl, in ACString aMessageUri,
114 in ACString aContentType, in nsIUrlListener aListener);
115
116 void detachAttachment(in string contentTpe, in string url, in string displayName, in string messageUri, in boolean saveFirst, [optional] in boolean withoutWarning);
117 void detachAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray,
118 [array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray,
119 [array, size_is(count)] in string messageUriArray, in boolean saveFirst, [optional] in boolean withoutWarning);
120 // saveAttachmentToFolder is used by the drag and drop code to drop an attachment to a destination folder
121 // we need to return the actual file path (including the filename).
122 nsILocalFile saveAttachmentToFolder(in ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsILocalFile aDestFolder);
123
124 attribute boolean sendingUnsentMsgs;
125
126 readonly attribute ACString lastDisplayedMessageUri;
127
128 nsIMsgMessageService messageServiceFromURI(in ACString aUri);
129 nsIMsgDBHdr msgHdrFromURI(in ACString aUri);
130 // for back forward history, we need a list of visited messages,
131 // and where we are in the list.
132
133 // aPos is relative to the current history cursor - 1 is forward, -1 is back.
134 // Unfortunately, you must call this before navigating to this position,
135 // because calling this has the side effect of making us adjust our current
136 // history pos, and *not* adding the loaded message to the history queue.
137 ACString getMsgUriAtNavigatePos(in long aPos);
138 ACString getFolderUriAtNavigatePos(in long aPos);
139 attribute long navigatePos;
140 // if caller just wants the count and cur pos, they can pass in a null history pointer, which will be more efficent
141 // if they want a list suitable for display in a back/forward menu drop down, they should pass in a aHistory pointer,
142 // and they'll get returned an array with strings containing something like subject and sender of the message -
143 // other possible info is the folder containing the message, and the preview text, if available.
144 void getNavigateHistory(out unsigned long aCurPos, out unsigned long aCount, [array, size_is(aCount)] out string aHistory);
145 };