summaryrefslogtreecommitdiffstats
path: root/mailnews/imap/public/nsIMsgImapMailFolder.idl
blob: f86f622b4581fadc3b6708b59c44e4ebadd98723 (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
208
209
210
211
212
213
214
215
/* -*- Mode: C++; 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"
#include "nsIMsgFolder.idl"
#include "nsIStringEnumerator.idl"

interface nsIMsgWindow;
interface nsIImapIncomingServer;
interface nsIMsgParseMailMsgState;
interface nsIAutoSyncState;

/**
 * This is a simple interface which allows the IMAP folder to update some
 * values that the folder props js code will use to update the sharing and
 * quota tabs in the folder properties.
 */
[scriptable, uuid(09D99F2C-3E23-4f8c-A536-5C277BAA9585)] 
interface nsIMsgImapFolderProps : nsISupports {

    void setFolderType(in AString folderType);
    void setFolderTypeDescription(in AString folderTypeDescription);
    void setFolderPermissions(in AString permissions);
    void serverDoesntSupportACL();

    /**
     * Toggles the display of quota information in the Quota tab of the folder properties.
     * If on, the quota root, usage, and percentage used are displayed.
     * If off, a status message is displayed. The status message can be set with setQuotaStatus().
     * @param showData If true, display the quota root, usage information and usage percentage bar.
     *                 If false, display the status message.
     */
    void showQuotaData(in boolean showData);

    /**
     * Sets the status string displayed in the Quota tab of the folder properties if quota
     * information is not visible.
     */
    void setQuotaStatus(in AString folderQuotaStatus);

    /**
     * Updates the quota data displayed in the Quota tab.
     */
    void setQuotaData(in ACString quotaroot, in unsigned long usedKB, in unsigned long maxKB);
};

[scriptable, uuid(fea0f455-7adf-4683-bf2f-c95c3fff03df)]
interface nsIMsgImapMailFolder : nsISupports {
  void removeSubFolder(in nsIMsgFolder folder);
  void createClientSubfolderInfo(in ACString folderName, in char hierarchyDelimiter,
                                 in long flags, in boolean suppressNotification);
  void list();
  void renameLocal(in ACString newname, in nsIMsgFolder parent);
  void prepareToRename();
  void performExpand(in nsIMsgWindow aMsgWindow);
  void recursiveCloseActiveConnections(in nsIImapIncomingServer aImapServer);
  void renameClient(in nsIMsgWindow msgWindow, in nsIMsgFolder msgFolder, in ACString oldName, in ACString newName);

  // these are used for offline synchronization
  void storeImapFlags(in long aFlags, in boolean aAddFlags, [array, size_is (aNumKeys)] 
      in nsMsgKey aKeysToFlag, in unsigned long aNumKeys, in nsIUrlListener aUrlListener);
  nsIURI setImapFlags(in string uids, in long flags);
  void replayOfflineMoveCopy([array, size_is (numKeys)] in nsMsgKey keys, in unsigned long numKeys, in boolean isMove, in nsIMsgFolder aDstFolder,
                         in nsIUrlListener aUrlListener, in nsIMsgWindow aWindow);
  nsIURI playbackOfflineFolderCreate(in AString folderName, in nsIMsgWindow aWindow);
  /**
   * This is called by the offline sync code to tell the imap folder to
   * remember info about the header with this key (messageId and key) because
   * it's an offline move result header, and we need to generate an
   * nsIMsgFolderListener.msgKeyChanged notification when we download the
   * real header from the imap server.
   *
   * @param aMsgKey msg key of move result pseudo hdr.
   */
  void addMoveResultPseudoKey(in nsMsgKey aMsgKey);
  /**
   * Select this folder on the imap server without doing a sync of flags or
   * headers. This is used for offline playback, where we don't want to
   * download hdrs we don't have, because they may have been offline deleted.
   *
   * @param aUrlListener        url listener, can be null
   * @param aWindow          msg window url is running in, can be null
   */
  void liteSelect(in nsIUrlListener aUrlListener, in nsIMsgWindow aWindow);

  void fillInFolderProps(in nsIMsgImapFolderProps aFolderProps);
  void resetNamespaceReferences();
  void folderPrivileges(in nsIMsgWindow aWindow);
  nsIMsgImapMailFolder findOnlineSubFolder(in ACString onlineName);
  void addFolderRights(in ACString userName, in ACString rights);
  void refreshFolderRights();

  /**
   * Mark/unmark the header as pending removal from the offline store. If mark,
   * this also increases the expungedBytes count on the folder so we know
   * there's more local disk space to be reclaimed.
   *
   * @param aHdr     msg hdr to mark pending removal from offline store.
   * @param aMark    whether to set or clear the pending removal status.
   *
   */
  void markPendingRemoval(in nsIMsgDBHdr aHdr, in boolean aMark);

  /**
   * Issue an expunge of this folder to the imap server.
   *
   * @param aUrlListener     url listener, can be null
   * @param aWindow          msg window url is running in, can be null
   *
   * @returns                status of attempt to run url.
   */
  void expunge(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);

  void updateStatus(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);
  void updateFolderWithListener(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener);
  // this is used to issue an arbitrary imap command on the passed in msgs.
  // It assumes the command needs to be run in the selected state.
  nsIURI issueCommandOnMsgs(in ACString command, in string uids, in nsIMsgWindow aWindow);
  nsIURI fetchCustomMsgAttribute(in ACString msgAttribute, in string uids, in nsIMsgWindow aWindow);
  nsIURI storeCustomKeywords(in nsIMsgWindow aMsgWindow,
                      in ACString aFlagsToAdd,
                      in ACString aFlagsToSubtract,
                      [array, size_is (aNumKeys)] in nsMsgKey aKeysToStore,
                      in unsigned long aNumKeys);

  void notifyIfNewMail();

  void initiateAutoSync(in nsIUrlListener aUrlListener);

  attribute boolean verifiedAsOnlineFolder;
  attribute boolean explicitlyVerify;
  attribute char hierarchyDelimiter;
  attribute long boxFlags;
  attribute ACString onlineName;
  attribute boolean isNamespace;
  readonly attribute boolean canOpenFolder;
  attribute ACString adminUrl;
  readonly attribute boolean hasAdminUrl;
  attribute boolean performingBiff;
  readonly attribute nsIMsgParseMailMsgState hdrParser;
  readonly attribute nsIImapIncomingServer imapIncomingServer;
  readonly attribute nsIAutoSyncState autoSyncStateObj;
  /**
   * @{
   * These are used to access the response to the STATUS or SELECT command.
   * The counts include deleted messages, or headers we haven't downloaded yet.
   */
  readonly attribute long serverTotal;
  readonly attribute long serverUnseen;
  readonly attribute long serverRecent;
  readonly attribute long serverNextUID;
  /** @} */

  /**
   * Quota
   * |valid| indicates whether the server has provided quota information on
   * this folder. This can be false
   * - if the server does not supports quotas,
   * - if there are no storage quotas on this folder, or
   * - if the folder has never been opened.
   * If it is true and maxKB > 0, the folder has a storage quota and
   * the usedKB and maxKB attributes are set to the values provided by
   * the server (in kilobytes), for this quota root.
   * Lotus Notes sends us maxKB = 0, usedKB > 0 for unlimited quota.
   */
  void getQuota(out boolean valid, out unsigned long usedKB, out unsigned long maxKB);

  /**
   * List all (human) users apart from the current user who have access to
   * this folder.
   *
   * You can find out which rights they have with getRightsForUser().
   */
  nsIUTF8StringEnumerator getOtherUsersWithAccess();

  /**
   * Which access rights a certain user has for this folder.
   *
   * @return list of flags
   * e.g. "lrswipcd" for write access and "lrs" for read only access.
   *
   * See RFC 2086 (e.g. Cyrus) and RFC 4314 (e.g. dovecot)
   *
   * l = locate = visible in folder list
   * r = read = list mails, get/read mail contents
   * s = set seen flag = mark read. Does not affect other users.
   * d (or t) = delete mails
   * w = write = change (other) flags of existing mails
   * i = insert = add mails to this folder
   * p = post = send mail directly to the submission address for folder
   * c (or k) = create subfolders
   * (e = expunge = compress)
   * (x = delete folder)
   * a = admin = change permissions
   */
  ACString getPermissionsForUser(in ACString username);

  /**
   * Change the number of "pending" messages in a folder,
   *  messages we know about, but don't have the headers for yet
   *
   * @param aDelta amount to change total by.
   */
  void changePendingTotal(in long aDelta);

  /**
   * Change the number of "pending" unread messages in a folder,
   * unread messages we know about, but don't have the headers for yet
   *
   * @param aDelta amount to change the unread count by.
   */
  void changePendingUnread(in long aDelta);
};