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) 2000
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 nsIImapMailFolderSink;
41 interface nsIImapMessageSink;
42 interface nsIImapServerSink;
43 interface nsIImapMockChannel;
44 interface nsIFile;
45 interface nsIMsgFolder;
46
47 typedef long nsImapAction;
48 typedef long nsImapState;
49
50 typedef unsigned short imapMessageFlagsType;
51
52 typedef long nsImapContentModifiedType;
53
54 [scriptable, uuid(2e91901e-ff6c-11d3-b9fa-00108335942a)]
55 interface nsImapContentModifiedTypes
56 {
57 const long IMAP_CONTENT_NOT_MODIFIED = 0;
58 const long IMAP_CONTENT_MODIFIED_VIEW_INLINE = 1;
59 const long IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS = 2;
60 const long IMAP_CONTENT_FORCE_CONTENT_NOT_MODIFIED = 3;
61 } ;
62
63 [scriptable, uuid(2065D454-2459-4204-B76F-0650C6FB8683)]
64 interface nsIImapUrl : nsISupports
65 {
66 ///////////////////////////////////////////////////////////////////////////////
67 // Getters and Setters for the imap specific event sinks to bind to to the url
68 ///////////////////////////////////////////////////////////////////////////////
69 attribute nsIImapMailFolderSink imapMailFolderSink;
70 attribute nsIImapMessageSink imapMessageSink;
71 attribute nsIImapServerSink imapServerSink;
72
73 ///////////////////////////////////////////////////////////////////////////////
74 // Getters and Setters for the imap url state
75 ///////////////////////////////////////////////////////////////////////////////
76 attribute nsImapAction imapAction;
77 readonly attribute nsImapState requiredImapState;
78 readonly attribute string imapPartToFetch;
79 readonly attribute string customAttributeToFetch;
80 attribute string customAttributeResult;
81 readonly attribute string command;
82 attribute string customCommandResult;
83 readonly attribute string customAddFlags;
84 readonly attribute string customSubtractFlags;
85 void allocateCanonicalPath(in string aServerPath, in char aOnlineDelimiter, out string aAllocatedPath);
86 void allocateServerPath(in string aCanonicalPath, in char aOnlineDelimiter, out string aAllocatedPath);
87 string createServerSourceFolderPathString();
88 string createCanonicalSourceFolderPathString();
89 string createServerDestinationFolderPathString();
90
91 string addOnlineDirectoryIfNecessary(in string onlineMailboxName);
92 void createSearchCriteriaString (out string aResult);
93 void createListOfMessageIdsString (out string aResult);
94
95 boolean messageIdsAreUids();
96 readonly attribute imapMessageFlagsType msgFlags; // kAddMsgFlags or kSubtractMsgFlags only
97
98 readonly attribute long numBytesToFetch;
99 attribute char onlineSubDirSeparator;
100 attribute boolean allowContentChange;
101 attribute boolean mimePartSelectorDetected;
102 attribute nsImapContentModifiedType contentModified;
103 attribute boolean fetchPartsOnDemand; // set to true if we're fetching a msg for display and want to not download parts
104 attribute boolean msgLoadingFromCache; // true if this msg load is coming from a cache, so we can know to mark it read
105 attribute boolean externalLinkUrl; // true if we ran this url because the user clicked on a link.
106 attribute boolean validUrl; // false if we couldn't parse url for whatever reason.
107 attribute nsISupports copyState;
108 attribute nsIFile msgFile;
109 attribute nsIImapMockChannel mockChannel;
110 attribute boolean shouldStoreMsgOffline; // set to true if we should store the msg for offline use if we can,
111 // i.e., we're not doing mime parts on demand.
112 attribute boolean rerunningUrl; // server disconnected first time so we're retrying
113
114 ///////////////////////////////////////////////////////////////////////////////
115 // Enumerated types specific to imap urls...
116 ///////////////////////////////////////////////////////////////////////////////
117
118 // the following are nsImapState enums.
119 // we have a basic set of imap url actions. These actions are nsImapActions.
120 // Certain actions require us to be in the authenticated state and others require us to
121 // be in the selected state. nsImapState is used to store the state the url needs to
122 // be in. You'll later see us refer to the imap url state in the imap protocol when we
123 // are processing the current url. Don't confuse nsImapState with the generic url state
124 // used to keep track of whether the url is running or not...
125 const long nsImapAuthenticatedState = 0;
126 const long nsImapSelectedState = 1;
127
128 const long nsImapActionSendText = 0; // a state used for testing purposes to send raw url text straight to the server....
129 // nsImapAuthenticatedStateUrl urls
130 // since the following url actions require us to be in the authenticated
131 // state, the high bit is left blank....
132 const long nsImapTest = 0x00000001;
133 const long nsImapCreateFolder = 0x00000005;
134 const long nsImapDeleteFolder = 0x00000006;
135 const long nsImapRenameFolder = 0x00000007;
136 const long nsImapMoveFolderHierarchy = 0x00000008;
137 const long nsImapLsubFolders = 0x00000009;
138 const long nsImapGetMailAccountUrl = 0x0000000A;
139 const long nsImapDiscoverChildrenUrl = 0x0000000B;
140 const long nsImapDiscoverAllBoxesUrl = 0x0000000D;
141 const long nsImapDiscoverAllAndSubscribedBoxesUrl = 0x0000000E;
142 const long nsImapAppendMsgFromFile = 0x0000000F;
143 const long nsImapSubscribe = 0x00000010;
144 const long nsImapUnsubscribe = 0x00000011;
145 const long nsImapRefreshACL = 0x00000012;
146 const long nsImapRefreshAllACLs = 0x00000013;
147 const long nsImapListFolder = 0x00000014;
148 const long nsImapUpgradeToSubscription = 0x00000015;
149 const long nsImapFolderStatus = 0x00000016;
150 const long nsImapRefreshFolderUrls = 0x00000017;
151 const long nsImapEnsureExistsFolder = 0x00000018;
152 const long nsImapOfflineToOnlineCopy = 0x00000019;
153 const long nsImapOfflineToOnlineMove = 0x0000001A;
154 // it's okay to add more imap actions that require us to
155 // be in the authenticated state here without renumbering
156 // the imap selected state url actions. just make sure you don't
157 // set the high bit...
158
159 // nsImapSelectedState urls. Note, the high bit is always set for
160 // imap actions which require us to be in the selected state
161 const long nsImapSelectFolder = 0x10000002;
162 const long nsImapLiteSelectFolder = 0x10000003;
163 const long nsImapExpungeFolder = 0x10000004;
164 const long nsImapMsgFetch = 0x10000018;
165 const long nsImapMsgHeader = 0x10000019;
166 const long nsImapSearch = 0x1000001A;
167 const long nsImapDeleteMsg = 0x1000001B;
168 const long nsImapDeleteAllMsgs = 0x1000001C;
169 const long nsImapAddMsgFlags = 0x1000001D;
170 const long nsImapSubtractMsgFlags = 0x1000001E;
171 const long nsImapSetMsgFlags = 0x1000001F;
172 const long nsImapOnlineCopy = 0x10000020;
173 const long nsImapOnlineMove = 0x10000021;
174 const long nsImapOnlineToOfflineCopy = 0x10000022;
175 const long nsImapOnlineToOfflineMove = 0x10000023;
176 const long nsImapMsgPreview = 0x10000024;
177 const long nsImapBiff = 0x10000026;
178 const long nsImapSelectNoopFolder = 0x10000027;
179 const long nsImapAppendDraftFromFile = 0x10000028;
180 const long nsImapUidExpunge = 0x10000029;
181 const long nsImapSaveMessageToDisk = 0x10000030;
182 const long nsImapOpenMimePart = 0x10000031;
183 const long nsImapMsgDownloadForOffline = 0x10000032;
184 const long nsImapDeleteFolderAndMsgs = 0x10000033;
185 const long nsImapUserDefinedMsgCommand = 0x10000034;
186 const long nsImapUserDefinedFetchAttribute = 0x10000035;
187 const long nsImapMsgFetchPeek = 0x10000036;
188 const long nsImapMsgStoreCustomKeywords = 0x10000037;
189 };
190
191 %{C++
192 #define IMAP_PORT 143
193 #define SECURE_IMAP_PORT 993
194 %}