summaryrefslogtreecommitdiffstats
path: root/mailnews/imap/public/nsIImapUrl.idl
blob: 03d0e03e0b6ef320ca0065e07d723b95aa3cf0f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIImapMailFolderSink;
interface nsIImapMessageSink;
interface nsIImapServerSink;
interface nsIImapMockChannel;
interface nsIFile;

typedef long nsImapAction;
typedef long nsImapState;

typedef unsigned short imapMessageFlagsType;

typedef long nsImapContentModifiedType;

[scriptable, uuid(2e91901e-ff6c-11d3-b9fa-00108335942a)]
interface nsImapContentModifiedTypes
{
  const long IMAP_CONTENT_NOT_MODIFIED = 0;
  const long IMAP_CONTENT_MODIFIED_VIEW_INLINE = 1;
  const long IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS = 2;
  const long IMAP_CONTENT_FORCE_CONTENT_NOT_MODIFIED = 3;
} ;

[scriptable, uuid(fe2a8f9e-2886-4146-9896-27fff660c69f)]
interface nsIImapUrl : nsISupports
{
  ///////////////////////////////////////////////////////////////////////////////
  // Getters and Setters for the imap specific event sinks to bind to to the url
  ///////////////////////////////////////////////////////////////////////////////
  attribute nsIImapMailFolderSink imapMailFolderSink;
  attribute nsIImapMessageSink imapMessageSink;
  attribute nsIImapServerSink imapServerSink;

  ///////////////////////////////////////////////////////////////////////////////
  // Getters and Setters for the imap url state
  ///////////////////////////////////////////////////////////////////////////////
  attribute nsImapAction imapAction;
  readonly attribute nsImapState requiredImapState;
  readonly attribute string imapPartToFetch;
  readonly attribute ACString customAttributeToFetch;
  attribute ACString customAttributeResult;
  readonly attribute ACString command;
  attribute ACString customCommandResult;
  readonly attribute ACString customAddFlags;
  readonly attribute ACString customSubtractFlags;
  void allocateCanonicalPath(in string aServerPath, in char aOnlineDelimiter, out string aAllocatedPath);
  void allocateServerPath(in string aCanonicalPath, in char aOnlineDelimiter, out string aAllocatedPath);
  string createServerSourceFolderPathString();
  string createCanonicalSourceFolderPathString();
  string createServerDestinationFolderPathString();

  string addOnlineDirectoryIfNecessary(in string onlineMailboxName);
  void createSearchCriteriaString (out string aResult);
  readonly attribute ACString listOfMessageIds;

  boolean messageIdsAreUids();
  readonly attribute imapMessageFlagsType msgFlags; // kAddMsgFlags or kSubtractMsgFlags only

  readonly attribute long numBytesToFetch;
  attribute char onlineSubDirSeparator;
  attribute boolean allowContentChange;
  attribute boolean mimePartSelectorDetected;
  attribute nsImapContentModifiedType contentModified;
  attribute boolean fetchPartsOnDemand;  // set to true if we're fetching a msg for display and want to not download parts
  attribute boolean msgLoadingFromCache; // true if this msg load is coming from a cache, so we can know to mark it read
  attribute boolean externalLinkUrl; // true if we ran this url because the user clicked on a link.
  attribute boolean validUrl; // false if we couldn't parse url for whatever reason.
  attribute nsISupports copyState;
  attribute nsIFile msgFile;
  attribute nsIImapMockChannel mockChannel;
  /**
   * Set to true if we should store the msg(s) for offline use if we can,
   * e.g., we're fetching a message and the folder is configured for offline
   * use and we're not doing mime parts on demand.
   */
  attribute boolean storeResultsOffline;
  /**
   * If we fallback from fetching by parts to fetching the whole message,
   *  because all the parts were inline, this tells us we should store
   * the message offline.
   */
  attribute boolean storeOfflineOnFallback;

  /**
   * This attribute defaults to false, but if we only want to use the offline
   * cache (disk, memory, or offline store) to fetch the message, then we set
   * this to true. Currently, nsIMsgMessageService.streamMessage does this.
   */
  attribute boolean localFetchOnly;

  /// Server disconnected first time so we're retrying.
  attribute boolean rerunningUrl;

  /**
   * Do we have more headers to download? This is set when we decide to
   * download newest headers first, followed by older headers in a subsequent
   * run of the url, which allows other urls to run against the folder in the
   * meantime.
   */
  attribute boolean moreHeadersToDownload;

  /**
   * @{
   * This is used to tell the runner of the url more about the status of
   * the command, beyond whether it was successful or not. For example,
   * subtracting flags from a UID that doesn't exist isn't an error
   * (the server returns OK), but the backend code may want to know about it.
   */
  attribute long extraStatus;

  /**
   * Current possible extra status values
   */
  const long ImapStatusNone = 0;
  const long ImapStatusFlagChangeFailed = 1;
  const long ImapStatusFlagsNotSettable = 2;
  /** @} */

  ///////////////////////////////////////////////////////////////////////////////
  // Enumerated types specific to imap urls...
  ///////////////////////////////////////////////////////////////////////////////

  // the following are nsImapState enums.
  // we have a basic set of imap url actions. These actions are nsImapActions.
  // Certain actions require us to be in the authenticated state and others require us to
  // be in the selected state. nsImapState is used to store the state the url needs to
  // be in. You'll later see us refer to the imap url state in the imap protocol when we
  // are processing the current url. Don't confuse nsImapState with the generic url state
  // used to keep track of whether the url is running or not...
  const long nsImapAuthenticatedState = 0;
  const long nsImapSelectedState = 1;

  const long nsImapActionSendText = 0;      // a state used for testing purposes to send raw url text straight to the server....
  // nsImapAuthenticatedStateUrl urls
  // since the following url actions require us to be in the authenticated
  // state, the high bit is left blank....
  const long nsImapTest  = 0x00000001;
  const long nsImapCreateFolder  = 0x00000005;
  const long nsImapDeleteFolder  = 0x00000006;
  const long nsImapRenameFolder  = 0x00000007;
  const long nsImapMoveFolderHierarchy = 0x00000008;
  const long nsImapLsubFolders  = 0x00000009;
  const long nsImapGetMailAccountUrl = 0x0000000A;
  const long nsImapDiscoverChildrenUrl = 0x0000000B;
  const long nsImapDiscoverAllBoxesUrl = 0x0000000D;
  const long nsImapDiscoverAllAndSubscribedBoxesUrl  = 0x0000000E;
  const long nsImapAppendMsgFromFile = 0x0000000F;
  const long nsImapSubscribe = 0x00000010;
  const long nsImapUnsubscribe = 0x00000011;
  const long nsImapRefreshACL  = 0x00000012;
  const long nsImapRefreshAllACLs  = 0x00000013;
  const long nsImapListFolder  = 0x00000014;
  const long nsImapUpgradeToSubscription = 0x00000015;
  const long nsImapFolderStatus  = 0x00000016;
  const long nsImapRefreshFolderUrls = 0x00000017;
  const long nsImapEnsureExistsFolder = 0x00000018;
  const long nsImapOfflineToOnlineCopy = 0x00000019;
  const long nsImapOfflineToOnlineMove = 0x0000001A;
  const long nsImapVerifylogon = 0x0000001B;
  // it's okay to add more imap actions that require us to
  // be in the authenticated state here without renumbering
  // the imap selected state url actions. just make sure you don't
  // set the high bit...

  // nsImapSelectedState urls. Note, the high bit is always set for
  // imap actions which require us to be in the selected state
  const long nsImapSelectFolder  = 0x10000002;
  const long nsImapLiteSelectFolder = 0x10000003;
  const long nsImapExpungeFolder = 0x10000004;
  const long nsImapMsgFetch  = 0x10000018;
  const long nsImapMsgHeader = 0x10000019;
  const long nsImapSearch  = 0x1000001A;
  const long nsImapDeleteMsg = 0x1000001B;
  const long nsImapDeleteAllMsgs = 0x1000001C;
  const long nsImapAddMsgFlags = 0x1000001D;
  const long nsImapSubtractMsgFlags  = 0x1000001E;
  const long nsImapSetMsgFlags = 0x1000001F;
  const long nsImapOnlineCopy  = 0x10000020;
  const long nsImapOnlineMove  = 0x10000021;
  const long nsImapOnlineToOfflineCopy = 0x10000022;
  const long nsImapOnlineToOfflineMove = 0x10000023;
  const long nsImapMsgPreview = 0x10000024;
  const long nsImapBiff  = 0x10000026;
  const long nsImapSelectNoopFolder  = 0x10000027;
  const long nsImapAppendDraftFromFile = 0x10000028;
  const long nsImapUidExpunge = 0x10000029;
  const long nsImapSaveMessageToDisk = 0x10000030;
  const long nsImapOpenMimePart = 0x10000031;
  const long nsImapMsgDownloadForOffline  = 0x10000032;
  const long nsImapDeleteFolderAndMsgs = 0x10000033;
  const long nsImapUserDefinedMsgCommand = 0x10000034;
  const long nsImapUserDefinedFetchAttribute = 0x10000035;
  const long nsImapMsgFetchPeek = 0x10000036;
  const long nsImapMsgStoreCustomKeywords = 0x10000037;

  /// Constant for the default IMAP port number
  const int32_t DEFAULT_IMAP_PORT = 143;

  /// Constant for the default IMAP over ssl port number
  const int32_t DEFAULT_IMAPS_PORT = 993;
};