summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/imap/public
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--comm/mailnews/imap/public/moz.build29
-rw-r--r--comm/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl23
-rw-r--r--comm/mailnews/imap/public/nsIAutoSyncManager.idl192
-rw-r--r--comm/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl35
-rw-r--r--comm/mailnews/imap/public/nsIAutoSyncState.idl157
-rw-r--r--comm/mailnews/imap/public/nsIImapFlagAndUidState.idl86
-rw-r--r--comm/mailnews/imap/public/nsIImapHeaderXferInfo.idl22
-rw-r--r--comm/mailnews/imap/public/nsIImapHostSessionList.h129
-rw-r--r--comm/mailnews/imap/public/nsIImapIncomingServer.idl114
-rw-r--r--comm/mailnews/imap/public/nsIImapMailFolderSink.idl119
-rw-r--r--comm/mailnews/imap/public/nsIImapMessageSink.idl89
-rw-r--r--comm/mailnews/imap/public/nsIImapMockChannel.idl49
-rw-r--r--comm/mailnews/imap/public/nsIImapOfflineSync.idl19
-rw-r--r--comm/mailnews/imap/public/nsIImapProtocol.idl90
-rw-r--r--comm/mailnews/imap/public/nsIImapProtocolSink.idl33
-rw-r--r--comm/mailnews/imap/public/nsIImapServerSink.idl178
-rw-r--r--comm/mailnews/imap/public/nsIImapService.idl253
-rw-r--r--comm/mailnews/imap/public/nsIImapUrl.idl210
-rw-r--r--comm/mailnews/imap/public/nsIMailboxSpec.idl47
-rw-r--r--comm/mailnews/imap/public/nsIMsgImapMailFolder.idl253
20 files changed, 2127 insertions, 0 deletions
diff --git a/comm/mailnews/imap/public/moz.build b/comm/mailnews/imap/public/moz.build
new file mode 100644
index 0000000000..d6e40a3e80
--- /dev/null
+++ b/comm/mailnews/imap/public/moz.build
@@ -0,0 +1,29 @@
+# vim: set filetype=python:
+# 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/.
+
+XPIDL_SOURCES += [
+ "nsIAutoSyncFolderStrategy.idl",
+ "nsIAutoSyncManager.idl",
+ "nsIAutoSyncMsgStrategy.idl",
+ "nsIAutoSyncState.idl",
+ "nsIImapFlagAndUidState.idl",
+ "nsIImapHeaderXferInfo.idl",
+ "nsIImapIncomingServer.idl",
+ "nsIImapMailFolderSink.idl",
+ "nsIImapMessageSink.idl",
+ "nsIImapMockChannel.idl",
+ "nsIImapOfflineSync.idl",
+ "nsIImapProtocol.idl",
+ "nsIImapProtocolSink.idl",
+ "nsIImapServerSink.idl",
+ "nsIImapService.idl",
+ "nsIImapUrl.idl",
+ "nsIMailboxSpec.idl",
+ "nsIMsgImapMailFolder.idl",
+]
+
+XPIDL_MODULE = "msgimap"
+
+EXPORTS += []
diff --git a/comm/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl b/comm/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl
new file mode 100644
index 0000000000..23ada6d468
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl
@@ -0,0 +1,23 @@
+/* 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 "nsIAutoSyncMsgStrategy.idl"
+
+interface nsIMsgFolder;
+
+[scriptable, uuid(d3bf91cc-37bb-4752-9994-1a8473e46a90)]
+interface nsIAutoSyncFolderStrategy : nsISupports {
+
+ /**
+ * Returns a relative-priority for the second folder by comparing with the first one.
+ */
+ nsAutoSyncStrategyDecisionType sort(in nsIMsgFolder aFolder1, in nsIMsgFolder aFolder2);
+
+ /**
+ * Tests whether the given folder should be excluded or not.
+ */
+ boolean isExcluded(in nsIMsgFolder aFolder);
+
+};
diff --git a/comm/mailnews/imap/public/nsIAutoSyncManager.idl b/comm/mailnews/imap/public/nsIAutoSyncManager.idl
new file mode 100644
index 0000000000..531b9e702b
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIAutoSyncManager.idl
@@ -0,0 +1,192 @@
+/* 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 nsIAutoSyncMsgStrategy;
+interface nsIAutoSyncFolderStrategy;
+interface nsIMsgDBHdr;
+interface nsIAutoSyncState;
+interface nsIAutoSyncMgrListener;
+interface nsIMsgFolder;
+
+[scriptable, uuid(41ec36a7-1a53-4ca3-b698-dca6452a8761)]
+interface nsIAutoSyncMgrListener : nsISupports {
+
+ /**
+ * Queue types
+ */
+ const long PriorityQueue = 1;
+ const long UpdateQueue = 2;
+ const long DiscoveryQueue = 3;
+
+ /**
+ * It is called on the listener when a new folder is added into
+ * the queue
+ *
+ * @param aQType type of the queue
+ * @param aFolder folder that is added into the queue
+ */
+ void onFolderAddedIntoQ(in long aQType, in nsIMsgFolder aFolder);
+
+ /**
+ * It is called on the listener when a folder is removed from
+ * the queue
+ *
+ * @param aQType type of the queue
+ * @param aFolder folder that is removed from the queue
+ */
+ void onFolderRemovedFromQ(in long aQType, in nsIMsgFolder aFolder);
+
+ /**
+ * It is called on the listener when a message download is successfully started
+ *
+ * @param aFolder folder in which the download is started
+ * @param aNumberOfMessages number of the messages that will be downloaded
+ * @param aTotalPending total number of messages waiting to be downloaded
+ */
+ void onDownloadStarted(in nsIMsgFolder aFolder, in unsigned long aNumberOfMessages,
+ in unsigned long aTotalPending);
+ /**
+ * It is called on the listener when a message download on the given folder
+ * is completed
+ */
+ void onDownloadCompleted(in nsIMsgFolder aFolder);
+
+ /**
+ * It is called on the listener when an error occurs during the message download
+ */
+ void onDownloadError(in nsIMsgFolder aFolder);
+
+ /*
+ * Auto-Sync manager is running or waiting for idle
+ */
+ void onStateChanged(in boolean aRunning);
+
+ /**
+ * It is called on the listener after the auto-sync manager starts to process
+ * existing headers of the given folder to find missing message bodies
+ * (mostly for debugging purposes)
+ */
+ void onDiscoveryQProcessed(in nsIMsgFolder aFolder, in unsigned long aNumberOfHdrsProcessed,
+ in unsigned long aLeftToProcess);
+
+ /**
+ * It is called on the listener after the auto-sync manager updates the given folder
+ * (mostly for debugging purposes)
+ */
+ void onAutoSyncInitiated(in nsIMsgFolder aFolder);
+};
+
+
+[scriptable, uuid(7fe0b48e-f5d8-4747-beb7-888c9cced3a5)]
+interface nsIAutoSyncManager : nsISupports {
+
+ /**
+ * Download models
+ */
+ const long dmParallel = 0;
+ const long dmChained = 1;
+
+ /**
+ * Suggested minimum grouping size in bytes for message downloads.
+ * Setting this attribute to 0 resets its value to the
+ * hardcoded default.
+ */
+ attribute unsigned long groupSize;
+
+ /**
+ * Active strategy function to prioritize
+ * messages in the download queue
+ */
+ attribute nsIAutoSyncMsgStrategy msgStrategy;
+
+ /**
+ * Active strategy function to prioritize
+ * folders in the download queue
+ */
+ attribute nsIAutoSyncFolderStrategy folderStrategy;
+
+ /**
+ * Adds a listener to notify about auto-sync events
+ */
+ void addListener(in nsIAutoSyncMgrListener aListener);
+
+ /**
+ * Removes the listener from notification list
+ */
+ void removeListener(in nsIAutoSyncMgrListener aListener);
+
+ /**
+ * Tests the given message to make sure that whether
+ * it fits the download criteria or not
+ */
+ boolean doesMsgFitDownloadCriteria(in nsIMsgDBHdr aMsgHdr);
+
+ /**
+ * Called by the nsAutoSyncState object when the download
+ * queue is changed. Given interface is already addref'd.
+ */
+ void onDownloadQChanged(in nsIAutoSyncState aAutoSyncStateObj);
+
+ /**
+ * Called by the nsAutoSyncState object when the download
+ * is started. Given interface is already addref'd.
+ */
+ void onDownloadStarted(in nsIAutoSyncState aAutoSyncStateObj, in nsresult aStartCode);
+
+ /**
+ * Called by the nsAutoSyncState object when the download
+ * completed. Given interface is already addref'd.
+ */
+ void onDownloadCompleted(in nsIAutoSyncState aAutoSyncStateObj, in nsresult aExitCode);
+
+ /**
+ * Number of elements in the discovery queue.
+ * @see nsAutoSyncManager.h for details
+ */
+ readonly attribute unsigned long discoveryQLength;
+
+ /**
+ * Number of elements in the update queue.
+ * @see nsAutoSyncManager.h for details
+ */
+ readonly attribute unsigned long updateQLength;
+
+ /**
+ * Number of elements in the download queue (a.k.a priority queue).
+ * @see nsAutoSyncManager.h for details
+ */
+ readonly attribute unsigned long downloadQLength;
+
+ /**
+ * Active download model; Chained (serial), or Parallel
+ */
+ attribute long downloadModel;
+
+ /**
+ * The imap folder corresponding to aAutoSyncState has had a message
+ * added to it. Autosync may want to add this folder to the update q.
+ *
+ * @param aAutoSyncState state obj for folder needing updating
+ */
+ void onFolderHasPendingMsgs(in nsIAutoSyncState aAutoSyncState);
+
+ /// Pause autosync (e.g., we're downloading for offline).
+ void pause();
+
+ /// Resume normal autosync activities (e.g., we've come back online).
+ void resume();
+};
+
+%{C++
+#define NS_AUTOSYNCMANAGER_CID \
+{ /* C358C568-47B2-42b2-8146-3C0F8D1FAD6E */ \
+ 0xc358c568, 0x47b2, 0x42b2, \
+ { 0x81, 0x46, 0x3c, 0xf, 0x8d, 0x1f, 0xad, 0x6e }}
+#define NS_AUTOSYNCMANAGER_CLASSNAME \
+ "Auto-Sync Manager"
+#define NS_AUTOSYNCMANAGER_CONTRACTID \
+ "@mozilla.org/imap/autosyncmgr;1"
+%}
diff --git a/comm/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl b/comm/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl
new file mode 100644
index 0000000000..773c62426d
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl
@@ -0,0 +1,35 @@
+/* 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 nsIMsgFolder;
+interface nsIMsgDBHdr;
+
+typedef long nsAutoSyncStrategyDecisionType;
+
+[scriptable,uuid(0365bec5-3753-43c2-b13e-441747815f37)]
+interface nsAutoSyncStrategyDecisions : nsISupports
+{
+ /// same priority
+ const nsAutoSyncStrategyDecisionType Same = 0x00000001;
+ /// higher priority
+ const nsAutoSyncStrategyDecisionType Higher = 0x00000002;
+ /// lower priority
+ const nsAutoSyncStrategyDecisionType Lower = 0x00000004;
+};
+
+[scriptable, uuid(9cb4baff-3112-4cf8-8463-f81b0aa78f93)]
+interface nsIAutoSyncMsgStrategy : nsISupports {
+
+ /**
+ * Returns a relative-priority for the second message by comparing with the first message.
+ */
+ nsAutoSyncStrategyDecisionType sort(in nsIMsgFolder aFolder, in nsIMsgDBHdr aMsgHdr1, in nsIMsgDBHdr aMsgHdr2);
+
+ /**
+ * Tests whether the given message should be excluded or not.
+ */
+ boolean isExcluded(in nsIMsgFolder aFolder, in nsIMsgDBHdr aMsgHdr);
+};
diff --git a/comm/mailnews/imap/public/nsIAutoSyncState.idl b/comm/mailnews/imap/public/nsIAutoSyncState.idl
new file mode 100644
index 0000000000..7d2c155435
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIAutoSyncState.idl
@@ -0,0 +1,157 @@
+/* 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 nsIMsgFolder;
+interface nsIMsgDBHdr;
+
+[scriptable, uuid(7512f927-b8f0-48c4-b101-03e859e61281)]
+interface nsIAutoSyncState : nsISupports {
+
+ /**
+ * Auto-Sync states.
+ *
+ * ***WARNING***: If you change these, be sure to update stateStrings in
+ * nsAutoSyncState.cpp. If you do not, out-of-bounds memory accesses may
+ * happen.
+ */
+
+ /**
+ * Initial state. Returned to after new message bodies downloaded or if
+ * it is determined that no body fetches are actually needed. The next state
+ * is typically stStatusIssued but a transition directly to stUpdateNeeded
+ * may also occur.
+ */
+ const long stCompletedIdle = 0;
+
+ /**
+ * STATUS issued (URL "folderstatus"). Will check to see if new messages
+ * are present. If new messages are detected, the next state is
+ * stUpdateIssued; otherwise, a return to stCompleteIdle occurs. The previous
+ * state is always stCompleteIdle.
+ */
+ const long stStatusIssued = 1;
+
+ /**
+ * Occurs when imap APPEND and sometimes COPY or MOVE imap commands add
+ * messages that may not be detected in autosync stStatusIssued state. These
+ * are the "pending" messages referred to in the autosync code.
+ * stUpdateIssued state (URL "select") will occur next.
+ * The previous state is always stCompleteIdle, skipping stStatusIssued.
+ */
+ const long stUpdateNeeded = 2;
+
+ /**
+ * Update issued (URL "select"). Will figure out if there are any bodies to
+ * download after new headers are fetched and, if so, move to state
+ * stReadyToDownload. Otherwise, returns to stCompleteIdle.
+ */
+ const long stUpdateIssued = 3;
+
+ /**
+ * Preparing to download the next group of message bodies then move to
+ * stDownloadInProgress
+ */
+ const long stReadyToDownload = 4;
+
+ /**
+ * Fetch bodies issued (URL "fetch"). Group of message bodies download in
+ * progress. If more are needed, next state is stReadyToDownload; otherwise,
+ * when all are received, the next state is stCompleteIdle.
+ */
+ const long stDownloadInProgress = 5;
+
+ /**
+ * Puts the download queue offset to its previous position.
+ */
+ void rollback();
+
+ /**
+ * Clears the download queue. Resets the offsets.
+ */
+ void resetDownloadQ();
+
+ /**
+ * Rollbacks the offset to the previous position and
+ * changes the state to ready-to-download.
+ */
+ void tryCurrentGroupAgain(in unsigned long aRetryCount);
+
+ /**
+ * Resets the retry counter.
+ */
+ void resetRetryCounter();
+
+ /**
+ * Tests whether the given folder has the same imap server.
+ */
+ boolean isSibling(in nsIAutoSyncState aAnotherStateObj);
+
+ /**
+ * Update the folder to find new message headers to download
+ */
+ void updateFolder();
+
+ /**
+ * Downloads the bodies of the given messages from the server.
+ */
+ void downloadMessagesForOffline(in Array<nsIMsgDBHdr> aMessageList);
+
+ /**
+ * Returns an array containing the nsIMsgDBHdrs of the messages that will
+ * be downloaded next.
+ *
+ * @param aSuggestedGroupSizeLimit suggested size per group in bytes
+ * @param aActualGroupSize total size of the messages in bytes in the group
+ */
+ Array<nsIMsgDBHdr> getNextGroupOfMessages(in unsigned long aSuggestedGroupSizeLimit,
+ out unsigned long aActualGroupSize);
+
+ /**
+ * Iterates through the existing headers of the folder to find
+ * the messages not downloaded yet.
+ *
+ * @param aNumberOfHeadersToProcess number of headers to be processed
+ * at this pass
+ *
+ * @return the number of headers left to process
+ */
+ unsigned long processExistingHeaders(in unsigned long aNumberOfHeadersToProcess);
+
+ /**
+ * Tests whether the download queue is empty.
+ */
+ boolean isDownloadQEmpty();
+
+ /**
+ * Last time the existing headers are completely processed.
+ */
+ [noscript]readonly attribute PRTime lastSyncTime;
+
+ /**
+ * Last time the owner folder is updated.
+ */
+ [noscript]attribute PRTime lastUpdateTime;
+
+ /**
+ * Download operation state.
+ */
+ attribute long state;
+
+ /**
+ * Number of messages waiting to be downloaded.
+ */
+ readonly attribute long pendingMessageCount;
+
+ /**
+ * Total number of messages in the download queue.
+ */
+ readonly attribute long totalMessageCount;
+
+ /**
+ * The folder this auto-sync object is related to.
+ */
+ readonly attribute nsIMsgFolder ownerFolder;
+};
diff --git a/comm/mailnews/imap/public/nsIImapFlagAndUidState.idl b/comm/mailnews/imap/public/nsIImapFlagAndUidState.idl
new file mode 100644
index 0000000000..a65d1a81c2
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapFlagAndUidState.idl
@@ -0,0 +1,86 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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"
+
+[scriptable, uuid(360848be-f694-40db-80ef-793a2c43ddcb)]
+interface nsIImapFlagAndUidState : nsISupports
+{
+ readonly attribute long numberOfMessages;
+ readonly attribute long numberOfRecentMessages;
+
+ /**
+ * If a full update, the total number of deleted messages
+ * in the folder; if a partial update, the number of deleted
+ * messages in the partial update
+ **/
+ readonly attribute long numberOfDeletedMessages;
+
+ /**
+ * If this is true, instead of fetching 1:* (FLAGS), and putting all
+ * UIDs and flags in the array, we only fetched the uids and flags
+ * that changed since the last time we were selected on this folder.
+ * This means we have a sparse array, and should not assume missing
+ * UIDs have been deleted.
+ **/
+ readonly attribute boolean partialUIDFetch;
+
+ /**
+ * Set of flags the server supports storing per message. See nsImapCore.h
+ * for the set of flags.
+ */
+ readonly attribute unsigned short supportedUserFlags;
+
+ /**
+ * Check if a UID is in the state.
+ * @param uid - The message UID.
+ * @returns True if UID is in the state.
+ */
+ boolean hasMessage(in unsigned long uid);
+
+ /**
+ * OR's the passed in flags with the previous flags because we want to
+ * accumulate the FLAGS and PERMANENTFLAGS response.
+ *
+ * @param aFlags - flags to OR with current flags.
+ */
+ void orSupportedUserFlags(in unsigned short aFlags);
+
+ unsigned long getUidOfMessage(in long zeroBasedIndex);
+ unsigned short getMessageFlags(in long zeroBasedIndex);
+ void setMessageFlags(in long zeroBasedIndex, in unsigned short flags);
+ void expungeByIndex(in unsigned long zeroBasedIndex);
+ void addUidFlagPair(in unsigned long uid, in unsigned short flags, in unsigned long zeroBasedIndex);
+ void addUidCustomFlagPair(in unsigned long uid, in string customFlag);
+ /**
+ * Get the message flags by the message UID.
+ * @param uid - The message UID.
+ * @returns The message flags.
+ */
+ unsigned short getMessageFlagsByUid(in unsigned long uid);
+ string getCustomFlags(in unsigned long uid); // returns space-separated keywords
+ void reset();
+ void clearCustomFlags(in unsigned long uid);
+ /**
+ * Adds custom attributes to a hash table for the purpose of storing them
+ * them.
+ * @param aUid UID of the associated msg
+ * @param aCustomAttributeName Name of the custom attribute value
+ * @param aCustomAttributeValue Value of the attribute,
+ */
+ void setCustomAttribute(in unsigned long aUid,
+ in ACString aCustomAttributeName,
+ in ACString aCustomAttributeValue);
+
+ /**
+ * Gets the custom attributes from the hash table where they were stored earlier
+ * them.
+ * @param aUid UID of the associated msg
+ * @param aCustomAttributeName Name of the custom attribute value
+ * @param aCustomAttributeValue Value of the attribute,
+ */
+ ACString getCustomAttribute(in unsigned long aUid,
+ in ACString aCustomAttributeName);
+};
diff --git a/comm/mailnews/imap/public/nsIImapHeaderXferInfo.idl b/comm/mailnews/imap/public/nsIImapHeaderXferInfo.idl
new file mode 100644
index 0000000000..74718e056e
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapHeaderXferInfo.idl
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "MailNewsTypes2.idl"
+
+[scriptable, uuid(38f8f784-b092-11d6-ba4b-00108335942a)]
+interface nsIImapHeaderInfo : nsISupports {
+ attribute nsMsgKey msgUid;
+ attribute long msgSize;
+ readonly attribute ACString msgHdrs;
+ void cacheLine(in string line, in unsigned long uid);
+ void resetCache();
+};
+
+[scriptable, uuid(f0842eda-af29-4ecd-82e1-fba91bd65d66)]
+interface nsIImapHeaderXferInfo : nsISupports {
+ readonly attribute long numHeaders;
+ nsIImapHeaderInfo getHeader(in long hdrIndex);
+};
diff --git a/comm/mailnews/imap/public/nsIImapHostSessionList.h b/comm/mailnews/imap/public/nsIImapHostSessionList.h
new file mode 100644
index 0000000000..456bbdf7dc
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapHostSessionList.h
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; 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/. */
+
+#ifndef _nsIImapHostSessionList_H_
+#define _nsIImapHostSessionList_H_
+
+#include "nsISupports.h"
+#include "nsImapCore.h"
+#include "../src/nsImapNamespace.h"
+
+class nsIImapIncomingServer;
+
+// f4d89e3e-77da-492c-962b-7835f0742c22
+#define NS_IIMAPHOSTSESSIONLIST_IID \
+ { \
+ 0xf4d89e3e, 0x77da, 0x492c, { \
+ 0x96, 0x2b, 0x78, 0x35, 0xf0, 0x74, 0x2c, 0x22 \
+ } \
+ }
+
+// this is an interface to a linked list of host info's
+class nsIImapHostSessionList : public nsISupports {
+ public:
+ NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIMAPHOSTSESSIONLIST_IID)
+
+ // Host List
+ NS_IMETHOD AddHostToList(const char* serverKey,
+ nsIImapIncomingServer* server) = 0;
+ NS_IMETHOD ResetAll() = 0;
+
+ // Capabilities
+ NS_IMETHOD GetHostHasAdminURL(const char* serverKey, bool& result) = 0;
+ NS_IMETHOD SetHostHasAdminURL(const char* serverKey, bool hasAdminUrl) = 0;
+ // Subscription
+ NS_IMETHOD GetHostIsUsingSubscription(const char* serverKey,
+ bool& result) = 0;
+ NS_IMETHOD SetHostIsUsingSubscription(const char* serverKey,
+ bool usingSubscription) = 0;
+
+ // Passwords
+ NS_IMETHOD GetPasswordForHost(const char* serverKey, nsString& result) = 0;
+ NS_IMETHOD SetPasswordForHost(const char* serverKey,
+ const nsAString& password) = 0;
+ NS_IMETHOD GetPasswordVerifiedOnline(const char* serverKey, bool& result) = 0;
+ NS_IMETHOD SetPasswordVerifiedOnline(const char* serverKey) = 0;
+
+ // OnlineDir
+ NS_IMETHOD GetOnlineDirForHost(const char* serverKey, nsString& result) = 0;
+ NS_IMETHOD SetOnlineDirForHost(const char* serverKey,
+ const char* onlineDir) = 0;
+
+ // Delete is move to trash folder
+ NS_IMETHOD GetDeleteIsMoveToTrashForHost(const char* serverKey,
+ bool& result) = 0;
+ NS_IMETHOD SetDeleteIsMoveToTrashForHost(const char* serverKey,
+ bool isMoveToTrash) = 0;
+ NS_IMETHOD GetShowDeletedMessagesForHost(const char* serverKey,
+ bool& result) = 0;
+
+ NS_IMETHOD SetShowDeletedMessagesForHost(const char* serverKey,
+ bool showDeletedMessages) = 0;
+
+ // Get namespaces
+ NS_IMETHOD GetGotNamespacesForHost(const char* serverKey, bool& result) = 0;
+ NS_IMETHOD SetGotNamespacesForHost(const char* serverKey,
+ bool gotNamespaces) = 0;
+
+ // Folders
+ NS_IMETHOD SetHaveWeEverDiscoveredFoldersForHost(const char* serverKey,
+ bool discovered) = 0;
+ NS_IMETHOD GetHaveWeEverDiscoveredFoldersForHost(const char* serverKey,
+ bool& result) = 0;
+ NS_IMETHOD SetDiscoveryForHostInProgress(const char* serverKey,
+ bool inProgress) = 0;
+ NS_IMETHOD GetDiscoveryForHostInProgress(const char* serverKey,
+ bool& result) = 0;
+
+ // Trash Folder
+ NS_IMETHOD SetOnlineTrashFolderExistsForHost(const char* serverKey,
+ bool exists) = 0;
+ NS_IMETHOD GetOnlineTrashFolderExistsForHost(const char* serverKey,
+ bool& result) = 0;
+
+ // INBOX
+ NS_IMETHOD GetOnlineInboxPathForHost(const char* serverKey,
+ nsString& result) = 0;
+ NS_IMETHOD GetShouldAlwaysListInboxForHost(const char* serverKey,
+ bool& result) = 0;
+ NS_IMETHOD SetShouldAlwaysListInboxForHost(const char* serverKey,
+ bool shouldList) = 0;
+
+ // Namespaces
+ NS_IMETHOD GetNamespaceForMailboxForHost(const char* serverKey,
+ const char* mailbox_name,
+ nsImapNamespace*& result) = 0;
+ NS_IMETHOD SetNamespaceFromPrefForHost(const char* serverKey,
+ const char* namespacePref,
+ EIMAPNamespaceType type) = 0;
+ NS_IMETHOD AddNewNamespaceForHost(const char* serverKey,
+ nsImapNamespace* ns) = 0;
+ NS_IMETHOD ClearServerAdvertisedNamespacesForHost(const char* serverKey) = 0;
+ NS_IMETHOD ClearPrefsNamespacesForHost(const char* serverKey) = 0;
+ NS_IMETHOD GetDefaultNamespaceOfTypeForHost(const char* serverKey,
+ EIMAPNamespaceType type,
+ nsImapNamespace*& result) = 0;
+ NS_IMETHOD SetNamespacesOverridableForHost(const char* serverKey,
+ bool overridable) = 0;
+ NS_IMETHOD GetNamespacesOverridableForHost(const char* serverKey,
+ bool& result) = 0;
+ NS_IMETHOD GetNumberOfNamespacesForHost(const char* serverKey,
+ uint32_t& result) = 0;
+ NS_IMETHOD GetNamespaceNumberForHost(const char* serverKey, int32_t n,
+ nsImapNamespace*& result) = 0;
+ // ### dmb hoo boy, how are we going to do this?
+ NS_IMETHOD CommitNamespacesForHost(nsIImapIncomingServer* server) = 0;
+ NS_IMETHOD FlushUncommittedNamespacesForHost(const char* serverKey,
+ bool& result) = 0;
+
+ // Hierarchy Delimiters
+ NS_IMETHOD SetNamespaceHierarchyDelimiterFromMailboxForHost(
+ const char* serverKey, const char* boxName, char delimiter) = 0;
+};
+
+NS_DEFINE_STATIC_IID_ACCESSOR(nsIImapHostSessionList,
+ NS_IIMAPHOSTSESSIONLIST_IID)
+
+#endif
diff --git a/comm/mailnews/imap/public/nsIImapIncomingServer.idl b/comm/mailnews/imap/public/nsIImapIncomingServer.idl
new file mode 100644
index 0000000000..25ff1c59c0
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapIncomingServer.idl
@@ -0,0 +1,114 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 nsIURI;
+interface nsIImapUrl;
+interface nsIImapProtocol;
+interface nsIMsgFolder;
+interface nsIMsgWindow;
+
+typedef long nsMsgImapDeleteModel;
+
+[scriptable, uuid(bbfc33de-fe89-11d3-a564-0060b0fc04b7)]
+interface nsMsgImapDeleteModels : nsISupports
+{
+ const long IMAPDelete = 0; /* delete with a big red x */
+ const long MoveToTrash = 1; /* delete moves message to the trash */
+ const long DeleteNoTrash = 2; /* delete is shift delete - don't create or use trash */
+};
+
+[scriptable, uuid(ea6a0765-07b8-40df-924c-9004ed707251)]
+interface nsIImapIncomingServer : nsISupports {
+
+ attribute long maximumConnectionsNumber;
+ attribute boolean forceSelect;
+ attribute long timeOutLimits;
+ attribute AUTF8String adminUrl;
+ attribute ACString serverDirectory;
+ /// RFC 2971 ID response stored as a pref
+ attribute AUTF8String serverIDPref;
+ attribute boolean cleanupInboxOnExit;
+ attribute nsMsgImapDeleteModel deleteModel;
+ attribute boolean dualUseFolders;
+ attribute ACString personalNamespace;
+ attribute ACString publicNamespace;
+ attribute ACString otherUsersNamespace;
+ attribute boolean offlineDownload;
+ attribute boolean overrideNamespaces;
+ attribute boolean usingSubscription;
+ attribute AUTF8String manageMailAccountUrl;
+ attribute boolean fetchByChunks;
+ attribute boolean sendID;
+ attribute boolean isAOLServer;
+ attribute boolean useIdle;
+ attribute boolean checkAllFoldersForNew;
+
+ /// Is this a GMail Server?
+ attribute boolean isGMailServer;
+
+ /**
+ * See IMAP RFC 4551
+ **/
+ attribute boolean useCondStore;
+
+ /**
+ * See IMAP RFC 4978
+ */
+ attribute boolean useCompressDeflate;
+
+ /**
+ * This contains a folder path, for example INBOX/Trash. Note that the
+ * account manager sets this attribute to the path of the trash folder the
+ * user has chosen.
+ */
+ attribute AString trashFolderName;
+
+ attribute boolean downloadBodiesOnGetNewMail;
+ attribute boolean autoSyncOfflineStores;
+
+ /// Max age of messages we will autosync to, or keep in offline store.
+ attribute long autoSyncMaxAgeDays;
+
+ /**
+ * See IMAP RFC 6855
+ */
+ attribute boolean allowUTF8Accept;
+
+ void GetImapConnectionAndLoadUrl(in nsIImapUrl aImapUrl,
+ in nsISupports aConsumer);
+
+ void RemoveConnection(in nsIImapProtocol aImapConnection);
+ void ResetNamespaceReferences();
+ void pseudoInterruptMsgLoad(in nsIMsgFolder aImapFolder, in nsIMsgWindow aMsgWindow, out boolean interrupted);
+ void ResetConnection(in AUTF8String folderName);
+ void CloseConnectionForFolder(in nsIMsgFolder aMsgFolder);
+ void reDiscoverAllFolders();
+ nsIURI subscribeToFolder(in AString name, in boolean subscribe);
+ void GetNewMessagesForNonInboxFolders(in nsIMsgFolder aRootFolder,
+ in nsIMsgWindow aWindow,
+ in boolean forceAllFolders,
+ in boolean performingBiff);
+ unsigned long long getCapability();
+
+ /**
+ * Get the password from the nsIMsgIncomingServer. May prompt the user
+ * if there's no password in the password manager or cached in the
+ * server object.
+ * @param aWindow msgWindow to associate the password prompt with
+ * @return Password string.
+ * @exception NS_ERROR_FAILURE The password could not be obtained.
+ * @note NS_MSG_PASSWORD_PROMPT_CANCELLED is a success code that is returned
+ * if the prompt was presented to the user but the user cancelled the
+ * prompt.
+ */
+ AString PromptPassword(in nsIMsgWindow aWindow);
+ attribute boolean doingLsub;
+
+ ACString getUriWithNamespacePrefixIfNecessary(in long namespaceType, in AUTF8String originalUri);
+ attribute boolean shuttingDown;
+ attribute boolean utf8AcceptEnabled;
+};
diff --git a/comm/mailnews/imap/public/nsIImapMailFolderSink.idl b/comm/mailnews/imap/public/nsIImapMailFolderSink.idl
new file mode 100644
index 0000000000..6868682640
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapMailFolderSink.idl
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "MailNewsTypes2.idl"
+
+#include "nsIImapProtocol.idl"
+#include "nsIMailboxSpec.idl"
+
+interface nsIMsgMailNewsUrl;
+interface nsIImapMockChannel;
+interface nsIImapHeaderXferInfo;
+
+typedef long ImapOnlineCopyState;
+
+[scriptable, uuid(5f7484b0-68b4-11d3-a53e-0060b0fc04b7)]
+interface ImapOnlineCopyStateType : nsISupports
+{
+ const long kInProgress = 0;
+ const long kSuccessfulCopy = 1;
+ const long kSuccessfulMove = 2;
+ const long kSuccessfulDelete = 3;
+ const long kFailedDelete = 4;
+ const long kReadyForAppendData = 5;
+ const long kFailedAppend = 6;
+ const long kInterruptedState = 7;
+ const long kFailedCopy = 8;
+ const long kFailedMove = 9;
+};
+
+/**
+ * nsIImapMailFolderSink provides a way for the IMAP system to communicate
+ * with the local folder representation.
+ *
+ * The IMAP system could poke folders directly, but going through this
+ * interface has a couple of benefits:
+ *
+ * 1. It better defines the public coupling between the two systems.
+ * 2. It's easier to wrap with a proxy class so the IMAP system can safely
+ * call the methods across thread boundaries (see ImapMailFolderSinkProxy).
+ */
+[scriptable, uuid(525e1278-a39d-46d6-9dbc-b48c7e1d4faa)]
+interface nsIImapMailFolderSink : nsISupports {
+ attribute boolean folderNeedsACLListed;
+ attribute boolean folderNeedsSubscribing;
+ attribute boolean folderNeedsAdded;
+ attribute unsigned long aclFlags;
+ attribute long uidValidity;
+ /**
+ * Whether we have asked the server for this folder's quota information.
+ * If the server supports quotas, this occurs when the folder is opened.
+ */
+ attribute boolean folderQuotaCommandIssued;
+
+ /**
+ * Set FolderQuotaData information
+ * @param aAction Invalidate, store or validate the quota data.
+ * Remaining params are relevant only for store.
+ * @param aFolderQuotaRoot The IMAP quotaroot and resource names for this
+ * folder separated by a slash as obtained from the
+ * GETQUOTAROOT IMAP command response.
+ * @param aFolderQuotaUsage Amount of resourse in use, in KB for STORAGE
+ * resource.
+ * @param aFolderQuotaLimit Maximum usage allowed for this resource.
+ **/
+ void setFolderQuotaData(
+ in unsigned long aAction, in ACString aFolderQuotaRoot,
+ in unsigned long long aFolderQuotaUsed, in unsigned long long aFolderQuotaLimit);
+
+ /// Should we download all the rfc822 headers of messages, instead of subset.
+ readonly attribute boolean shouldDownloadAllHeaders;
+ readonly attribute char onlineDelimiter;
+ void OnNewIdleMessages();
+ // Tell mail master about the newly selected mailbox
+ void UpdateImapMailboxInfo(in nsIImapProtocol aProtocol,
+ in nsIMailboxSpec aSpec);
+ void UpdateImapMailboxStatus(in nsIImapProtocol aProtocol,
+ in nsIMailboxSpec aSpec);
+ /**
+ * Used when downloading headers in chunks.
+ * @param aSpec Mailbox spec of folder we're downloading headers for.
+ * @returns true if more to download, false otherwise.
+ * @returns total count of headers to download (across all chunks)
+ * @returns an array of msg keys to download, array size is this chunk's size
+ */
+ void getMsgHdrsToDownload(out boolean aMore, out long aTotalCount,
+ out Array<nsMsgKey> aKeys);
+ void parseMsgHdrs(in nsIImapProtocol aProtocol, in nsIImapHeaderXferInfo aHdrXferInfo);
+ void AbortHeaderParseStream(in nsIImapProtocol aProtocol) ;
+
+ void OnlineCopyCompleted(in nsIImapProtocol aProtocol, in ImapOnlineCopyState aCopyState);
+ void StartMessage(in nsIMsgMailNewsUrl aUrl);
+ void EndMessage(in nsIMsgMailNewsUrl aUrl, in nsMsgKey uidOfMessage);
+
+ void NotifySearchHit(in nsIMsgMailNewsUrl aUrl, in string hitLine);
+
+ void copyNextStreamMessage(in boolean copySucceeded, in nsISupports copyState);
+ void closeMockChannel(in nsIImapMockChannel aChannel);
+ void setUrlState(in nsIImapProtocol aProtocol, in nsIMsgMailNewsUrl aUrl,
+ in boolean isRunning, in boolean aSuspend,
+ in nsresult status);
+ void releaseUrlCacheEntry(in nsIMsgMailNewsUrl aUrl);
+
+ void headerFetchCompleted(in nsIImapProtocol aProtocol);
+ void setBiffStateAndUpdate(in long biffState);
+ void progressStatusString(in nsIImapProtocol aProtocol, in string aMsgId, in wstring extraInfo);
+ void percentProgress(in nsIImapProtocol aProtocol,
+ in ACString aFmtStringName, in AString aMailboxName,
+ in long long aCurrentProgress, in long long aMaxProgressProgressInfo);
+
+ void clearFolderRights();
+ void setCopyResponseUid(in string msgIdString,
+ in nsIImapUrl aUrl);
+ void setAppendMsgUid(in nsMsgKey newKey,
+ in nsIImapUrl aUrl);
+ ACString getMessageId(in nsIImapUrl aUrl);
+};
diff --git a/comm/mailnews/imap/public/nsIImapMessageSink.idl b/comm/mailnews/imap/public/nsIImapMessageSink.idl
new file mode 100644
index 0000000000..858522856c
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapMessageSink.idl
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "MailNewsTypes2.idl"
+#include "nsIImapUrl.idl"
+
+interface nsIFile;
+
+[scriptable, uuid(6ffb6a92-e43a-405f-92ea-92cf81a5e17b)]
+
+/**
+ * nsIImapMessageSink provides a way for the IMAP system to exchange
+ * message-related information with the local folder representation.
+ *
+ * The IMAP system could poke folders directly, but going through this
+ * interface has a couple of benefits:
+ *
+ * 1. It better defines the public coupling between the two systems.
+ * 2. It's easier to wrap with a proxy class so the IMAP system can safely
+ * call the methods across thread boundaries (see ImapMessageSinkProxy).
+ */
+interface nsIImapMessageSink : nsISupports {
+ // set up message download output stream
+ void setupMsgWriteStream(in nsIFile aFile, in boolean aAppendDummyEnvelope);
+
+ /**
+ * Used by the imap protocol code to notify the core backend code about
+ * downloaded imap messages.
+ *
+ * @param aAdoptedMsgLine a string with a lot of message lines,
+ * separated by native line terminators.
+ * @param aUidOfMsg IMAP UID of the fetched message.
+ * @param aImapUrl IMAP Url used to fetch the message.
+ */
+ void parseAdoptedMsgLine(in string aAdoptedMsgLine, in nsMsgKey aUidOfMsg,
+ in nsIImapUrl aImapUrl);
+
+ /**
+ * Notify the backend that the imap protocol is done downloading a message
+ *
+ * @param aUidOfMsg IMAP UID of the fetched message.
+ * @param aMarkMsgRead Set the SEEN flag on the message.
+ * @param aImapUrl IMAP Url used to fetch the message.
+ * @param aUpdatedMessageSize if this parameter is not -1, the stored size of the message
+ * should be set to this value to reflect the actual size of
+ * the downloaded message.
+ */
+ void normalEndMsgWriteStream(in nsMsgKey aUidOfMessage,
+ in boolean aMarkMsgRead, in nsIImapUrl aImapUrl,
+ in long aUpdatedMessageSize);
+
+ void abortMsgWriteStream();
+
+ void beginMessageUpload();
+
+ /**
+ * Notify the message sink that one or more flags have changed
+ * For Condstore servers, also update the highestMod Sequence
+ * @param aFlags - The new flags for the message
+ * @param aKeywords keywords for the message
+ * @param aMessageKey - The UID of the message that changed
+ * @param aHighestModSeq - The highest mod seq the parser has seen
+ * for this folder
+ **/
+ void notifyMessageFlags(in unsigned long aFlags, in ACString aKeywords,
+ in nsMsgKey aMessageKey,
+ in unsigned long long aHighestModSeq);
+
+ void notifyMessageDeleted(in string aOnlineFolderName,in boolean aDeleteAllMsgs,in string aMsgIdString);
+
+ void getMessageSizeFromDB(in string aId, out unsigned long aSize);
+
+ /**
+ * For a message stored in a file, get the message metadata needed to copy
+ * that message to an imap folder
+ *
+ * @param aRunningUrl message URL
+ * @param aDate message date
+ * @param aKeywords message custom keywords (if supported by the server),
+ * including messages tags and junk status
+ *
+ * @return message flags
+ */
+ unsigned long getCurMoveCopyMessageInfo(in nsIImapUrl aRunningUrl,
+ out PRTime aDate, out ACString aKeywords);
+};
diff --git a/comm/mailnews/imap/public/nsIImapMockChannel.idl b/comm/mailnews/imap/public/nsIImapMockChannel.idl
new file mode 100644
index 0000000000..cb624f314f
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapMockChannel.idl
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+
+/*
+ Because imap protocol connections (which are channels) run through a cache,
+ it isn't always the case that when you want to run a url, you actually get
+ a connection back right away. Often times, the url goes into a queue until
+ a connection becomes available.
+
+ Unfortunately, if we want to be a truly pluggable protocol with necko, necko
+ requires the ability to get a channel back right away when it wants to run
+ a url. It doesn't let you wait until an imap connection becomes available.
+
+ So I've created the notion of a "mock channel". This mock channel is what
+ gets returned to necko (or other callers) when they ask the imap service
+ for a new channel for a url. The mock channel has "mock" implementations
+ of nsIChannel. Eventually, when we actually assign the url to a real
+ channel, we set the real channel on the mock channel. From that point forward,
+ the mock channel forwards channel calls directly to the real channel.
+
+ In short, this class is how I'm solving the problem where necko wants
+ a channel back as soon as they ask for when with the fact that it
+ may be a while until the url is loaded into a connection.
+ */
+
+#include "nsISupports.idl"
+#include "nsIChannel.idl"
+
+interface nsIStreamListener;
+interface nsIProgressEventSink;
+interface nsIURI;
+interface nsIImapProtocol;
+
+[scriptable, uuid(e0178cd5-d37b-4bde-9ab8-752083536225)]
+interface nsIImapMockChannel : nsIChannel
+{
+ attribute nsIProgressEventSink progressEventSink;
+ void GetChannelListener(out nsIStreamListener aChannelListener);
+ void Close();
+ void setImapProtocol(in nsIImapProtocol aProtocol);
+ [noscript] void setSecurityInfo(in nsITransportSecurityInfo securityInfo);
+
+ void setURI(in nsIURI uri);
+ void readFromImapConnection();
+ attribute boolean writingToCache;
+};
diff --git a/comm/mailnews/imap/public/nsIImapOfflineSync.idl b/comm/mailnews/imap/public/nsIImapOfflineSync.idl
new file mode 100644
index 0000000000..c7f55cfa9c
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapOfflineSync.idl
@@ -0,0 +1,19 @@
+/* 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 nsIMsgFolder;
+interface nsIMsgWindow;
+interface nsIUrlListener;
+
+[scriptable, uuid(ffb683c5-f2c5-490a-b569-2f6b0de0a241)]
+interface nsIImapOfflineSync : nsISupports {
+ void init(in nsIMsgWindow window,
+ in nsIUrlListener listener,
+ in nsIMsgFolder folder,
+ in bool isPseudoOffline);
+
+ void processNextOperation();
+};
diff --git a/comm/mailnews/imap/public/nsIImapProtocol.idl b/comm/mailnews/imap/public/nsIImapProtocol.idl
new file mode 100644
index 0000000000..7f7ea50720
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapProtocol.idl
@@ -0,0 +1,90 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "MailNewsTypes2.idl" // for nsMsgKey
+
+interface nsIURI;
+interface nsIImapUrl;
+interface nsIImapIncomingServer;
+interface nsIMsgFolder;
+interface nsIMsgWindow;
+interface nsIImapFlagAndUidState;
+
+[ptr] native nsIImapHostSessionList(nsIImapHostSessionList);
+%{C++
+class nsIImapHostSessionList;
+%}
+
+[scriptable, uuid(6ef189e5-8711-4845-9625-d1c74c22c4b5)]
+interface nsIImapProtocol : nsISupports {
+ /**
+ * Set up this connection to run a URL.
+ * Called by nsImapIncomingServer to process a queued URL when it spots a
+ * free connection.
+ * Because nsImapProtocol is really a connection and doesn't follow the
+ * usual nsIChannel lifecycle, this function is provided to allow reuse.
+ * Over and over again.
+ */
+ void LoadImapUrl(in nsIURI aUrl, in nsISupports aConsumer);
+
+ /**
+ * IsBusy returns true if the connection is currently processing a URL
+ * and false otherwise.
+ */
+ void IsBusy(out boolean aIsConnectionBusy,
+ out boolean isInboxConnection);
+
+ /**
+ * Protocol instance examines the URL, looking at the host name,
+ * user name and folder the action would be on in order to figure out
+ * if it can process this URL. I decided to push the semantics about
+ * whether a connection can handle a URL down into the connection level
+ * instead of in the connection cache.
+ */
+ void CanHandleUrl(in nsIImapUrl aImapUrl, out boolean aCanRunUrl,
+ out boolean hasToWait);
+
+ /**
+ * Initialize a protocol object.
+ * @param aHostSessionList host session list service
+ * @param aServer imap server the protocol object will be talking to
+ */
+ void Initialize(in nsIImapHostSessionList aHostSessionList, in nsIImapIncomingServer aServer);
+
+ void NotifyBodysToDownload(in Array<nsMsgKey> keys);
+
+ // methods to get data from the imap parser flag state.
+ void GetFlagsForUID(in unsigned long uid, out boolean foundIt, out unsigned short flags, out string customFlags);
+ void GetSupportedUserFlags(out unsigned short flags);
+
+ void GetRunningImapURL(out nsIImapUrl aImapUrl);
+
+ void GetRunningUrl(out nsIURI aUrl);
+
+ readonly attribute nsIImapFlagAndUidState flagAndUidState;
+ /**
+ * Tell thread to die - only call from the UI thread
+ *
+ * @param aIsSafeToClose false if we're dropping a timed out connection.
+ */
+ void tellThreadToDie(in boolean aIsSafeToClose);
+
+ // Get last active time stamp
+ void GetLastActiveTimeStamp(out PRTime aTimeStamp);
+
+ void pseudoInterruptMsgLoad(in nsIMsgFolder imapFolder, in nsIMsgWindow aMsgWindow, out boolean interrupted);
+
+ /**
+ * Produce a pseudo-interrupt to trigger an abort of an imap mssage fetch.
+ *
+ * @param aInterrupt true to initiate a pseudo-interrupt; otherwise set false.
+ */
+ void pseudoInterrupt(in boolean aInterrupt);
+
+ void GetSelectedMailboxName(out string folderName);
+ // Reset folder connection to authenticated state
+ void ResetToAuthenticatedState();
+};
diff --git a/comm/mailnews/imap/public/nsIImapProtocolSink.idl b/comm/mailnews/imap/public/nsIImapProtocolSink.idl
new file mode 100644
index 0000000000..b3cda13d6e
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapProtocolSink.idl
@@ -0,0 +1,33 @@
+/* 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 nsIMsgWindow;
+interface nsIMsgMailNewsUrl;
+
+/**
+ * Helper interface that contains operations MUST be proxied
+ * over UI thread.
+ */
+[scriptable, uuid(1217cd9d-7678-4026-b323-0d4b45816af0)]
+interface nsIImapProtocolSink : nsISupports {
+
+ /**
+ * Does general cleanup for the imap protocol object.
+ */
+ void closeStreams();
+ /**
+ * Get the msg window associated with a url
+ *
+ * @param aUrl url whose msgWindow we want.
+ * @returns msgWindow associated with url.
+ */
+ nsIMsgWindow getUrlWindow(in nsIMsgMailNewsUrl aUrl);
+
+ /**
+ * Setup main thread proxies.
+ */
+ void setupMainThreadProxies();
+};
diff --git a/comm/mailnews/imap/public/nsIImapServerSink.idl b/comm/mailnews/imap/public/nsIImapServerSink.idl
new file mode 100644
index 0000000000..736487877e
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapServerSink.idl
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "MailNewsTypes2.idl"
+
+interface nsIMsgWindow;
+interface nsIMsgMailNewsUrl;
+interface nsIImapProtocol;
+interface nsIImapUrl;
+interface nsIImapMockChannel;
+
+/**
+ * nsIImapServerSink is designed to be used as a proxy to the application's UI
+ * thread from the running IMAP threads.
+ */
+[scriptable, uuid(2160c641-e4fa-4bbc-ab8b-d9ba45069027)]
+interface nsIImapServerSink : nsISupports {
+ /**
+ * Check if the given folder path is a possible IMAP mailbox.
+ * @param folderPath folder path to check
+ * @param hierarchyDelimiter IMAP hierarchy delimiter in canonical format,
+ * i.e., hierarchy delimiter has been replaced
+ * with '/'
+ * @param boxFlags IMAP folder flags (for subscription, namespaces etc.)
+ * @return true if it's a new mailbox
+ */
+ boolean possibleImapMailbox(in AUTF8String folderPath,
+ in char hierarchyDelimiter, in long boxFlags);
+ boolean folderNeedsACLInitialized(in AUTF8String folderPath);
+ void addFolderRights(in AUTF8String folderPath, in ACString userName, in ACString rights);
+ void refreshFolderRights(in AUTF8String folderPath);
+ void discoveryDone();
+ void onlineFolderDelete(in AUTF8String folderName);
+ void onlineFolderCreateFailed(in AUTF8String aFolderName);
+ void onlineFolderRename(in nsIMsgWindow msgWindow, in AUTF8String oldName, in AUTF8String newName);
+ boolean folderIsNoSelect(in AUTF8String folderName);
+ void setFolderAdminURL(in AUTF8String folderName, in AUTF8String adminUrl);
+ boolean folderVerifiedOnline(in AUTF8String folderName);
+
+ void setCapability(in unsigned long long capability);
+ /// RFC 2971 ID server response
+ void setServerID(in ACString aServerID);
+ boolean loadNextQueuedUrl(in nsIImapProtocol protocol);
+
+ /**
+ * Prepare to retry the given URL.
+ * @param imapUrl the url we're going to retry
+ * @return channel to associate with the url. We return this because access
+ * to the channel should only happen on the ui thread.
+ */
+ nsIImapMockChannel prepareToRetryUrl(in nsIImapUrl imapUrl);
+
+ /**
+ * Suspend the url. This puts it at the end of the queue. If the queue is
+ * empty, the url will get resumed immediately. Currently, the plan is
+ * do this when we have to download a lot of headers in chunks, though we
+ * could find other uses for it.
+ * @param imapUrl url to suspend
+ */
+ void suspendUrl(in nsIImapUrl aImapUrl);
+
+ /**
+ * Retry the given URL.
+ * @param imapUrl url to retry
+ * @param channel the channel to associate with the url
+ */
+ void retryUrl(in nsIImapUrl imapUrl, in nsIImapMockChannel channel);
+
+ /**
+ * If previous URL failed, this gives server chance to abort URLs with same
+ * mock channel.
+ */
+ void abortQueuedUrls();
+ AString getImapStringByName(in string msgName);
+ /**
+ * Alerts the user that the login to the IMAP server failed. Asks whether the
+ * connection should: retry, cancel, or request a new password.
+ *
+ * @param aMsgWindow The message window associated with this action (cannot
+ * be null).
+ * @return The button pressed. 0 for retry, 1 for cancel,
+ * 2 for enter a new password.
+ */
+ int32_t promptLoginFailed(in nsIMsgWindow aMsgWindow);
+
+ /**
+ * Alerts the user with the given string (FE = 'Front End').
+ *
+ * @param aAlertString The string to alert the user with.
+ * @param aUrl The running url.
+ */
+ void fEAlert(in AString aAlertString, in nsIMsgMailNewsUrl aUrl);
+
+ /**
+ * Alerts the user with a localized string. It will attempt to fill in
+ * the hostname into the string if necessary.
+ *
+ * @param aMsgName The id of the string to present to the user..
+ * @param aUrl The running url.
+ */
+ void fEAlertWithName(in string aMsgName, in nsIMsgMailNewsUrl aUrl);
+ /**
+ * Takes a response from the server and prepends it with IMAP_SERVER_SAID
+ *
+ * @param aServerString The string to alert the user with.
+ * @param url The running url.
+ */
+ void fEAlertFromServer(in ACString aServerString, in nsIMsgMailNewsUrl aUrl);
+
+ void commitNamespaces();
+
+ /**
+ * Returns a password via the out param, if we were able to prompt for one,
+ * or had one stored.
+ * If there is already a password prompt up, we return false, but we
+ * ask the async prompt service to notify us when we can put up a prompt.
+ * When that notification is received, we prompt the user and set the
+ * password on the protocol object, and signal a monitor that the imap
+ * thread should be waiting on.
+ *
+ * rv is NS_MSG_PASSWORD_PROMPT_CANCELLED if the user cancels the
+ * password prompt. That's not an exception, however.
+ *
+ * @param aProtocol imap protocol object requesting the password.
+ * @param aNewPasswordRequested Forces password prompt immediately
+ * @param aPassword returns the password, unless we had to prompt or use the,
+ * login manager and there was already a prompt up.
+ */
+ void asyncGetPassword(in nsIImapProtocol aProtocol,
+ in boolean aNewPasswordRequested,
+ out AString aPassword);
+
+ /**
+ * Returns a password via the out param if password is stored in login mgr.
+ * If no password is stored, this function returns NS_ERROR_NOT_AVAILABLE.
+ * This never triggers a password prompt.
+ *
+ * @param aPassword returns the stored password or empty string if not stored.
+ */
+ void syncGetPassword(out AString aPassword);
+
+ attribute boolean userAuthenticated;
+ void setMailServerUrls(in AUTF8String manageMailAccount, in AUTF8String manageLists, in AUTF8String manageFilters);
+
+ /** Used by the imap thread when upgrading from the socketType
+ * trySTARTTLS.
+ * @param aSucceeded whether STARTTLS succeeded. If it did, the server
+ * will set the socket type to alwaysSTARTTLS, otherwise plain.
+ */
+ void UpdateTrySTARTTLSPref(in boolean aSucceeded);
+
+ readonly attribute AUTF8String arbitraryHeaders;
+ void forgetPassword();
+
+ readonly attribute boolean showAttachmentsInline;
+ string cramMD5Hash(in string decodedChallenge, in string key);
+ /// String to send to the imap server as the login user name.
+ readonly attribute ACString loginUsername;
+ /// String to send to the imap server as the user name.
+ readonly attribute ACString originalUsername;
+ /// Internal pref key, unique over all servers
+ readonly attribute ACString serverKey;
+ /// password for server login
+ readonly attribute AString serverPassword;
+ /// remove a connection to the server
+ void removeServerConnection(in nsIImapProtocol aProtocol);
+ /// is the imap server shutting down?
+ readonly attribute boolean serverShuttingDown;
+ /// reset the connection for a particular folder
+ void resetServerConnection(in AUTF8String aFolderName);
+ /// tell the server if listing using lsub command
+ void setServerDoingLsub(in boolean aDoingLsub);
+ /// set whether UTF8=ACCEPT enabled or not
+ void setServerUtf8AcceptEnabled(in boolean aEnabled);
+};
diff --git a/comm/mailnews/imap/public/nsIImapService.idl b/comm/mailnews/imap/public/nsIImapService.idl
new file mode 100644
index 0000000000..04b2667467
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapService.idl
@@ -0,0 +1,253 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+////////////////////////////////////////////////////////////////////////////////////////
+// The IMAP Service is an interfaced designed to make building and running imap urls
+// easier. Clients typically go to the imap service and ask it do things such as:
+// get new mail, etc....
+//
+// Oh and in case you couldn't tell by the name, the imap service is a service! and you
+// should go through the service manager to obtain an instance of it.
+////////////////////////////////////////////////////////////////////////////////////////
+
+#include "nsISupports.idl"
+#include "nsIImapUrl.idl"
+
+interface nsIImapMessageSink;
+interface nsIUrlListener;
+interface nsIURI;
+interface nsIFile;
+interface nsIMsgFolder;
+interface nsIMsgWindow;
+interface nsIMsgMailNewsUrl;
+interface nsIImapIncomingServer;
+interface nsICacheStorage;
+
+/**
+ * Most of the nsIImapService methods are friendly front ends for composing and
+ * issuing "imap://" protocol operations. Usually a nsImapUrl will be returned.
+ * This url object is stateful and tracks the issued request.
+ */
+[scriptable, uuid(aba44b3d-7a0f-4987-8794-96d2de66d966)]
+interface nsIImapService : nsISupports
+{
+ nsIURI selectFolder(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ /**
+ * Select the 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 aImapMailFolder the folder to select
+ * @param aUrlListener url listener, can be null
+ * @param aMsgWindow msg window url is running in, can be null
+ *
+ * @returns the url created to run the lite select in.
+ */
+ nsIURI liteSelectFolder(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ void addImapFetchToUrl(in nsIMsgMailNewsUrl aURL,
+ in nsIMsgFolder aImapMailFolder,
+ in ACString aMessageIdentifierList,
+ in ACString aAdditionalHeader);
+
+ void fetchMessage(in nsIImapUrl aUrl,
+ in nsImapState aImapAction,
+ in nsIMsgFolder aImapMailFolder,
+ in nsIImapMessageSink aImapMessageSink,
+ in nsIMsgWindow aMsgWindow,
+ in nsISupports aConsumer,
+ in ACString aMessageIdentifierList,
+ in boolean convertDataToText,
+ out nsIURI aOutURL);
+
+ void noop(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL);
+
+ void getHeaders(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in ACString aMessageIdentifierList,
+ in boolean aMessageIdsAreUID);
+
+ nsIURI getBodyStart(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in ACString aMessageIdentifierList,
+ in long numBytes);
+
+ /**
+ * Issue an EXPUNGE on the target folder.
+ *
+ * @param aImapMailFolder the folder to expunge
+ * @param aUrlListener url listener, can be null
+ * @param aMsgWindow msg window url is running in, can be null
+ */
+ void expunge(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ /**
+ * Issue a STATUS on the target folder.
+ *
+ * @param aImapMailFolder the folder to expunge
+ * @param aUrlListener url listener, can be null
+ *
+ * @returns the url created to run the status.
+ */
+ nsIURI updateFolderStatus(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener);
+
+ /**
+ * Verify that we can login.
+ *
+ * @param aImapMailFolder - any old imap folder - we just need it to
+ * set url sinks.
+ * @param aMsgWindow - nsIMsgWindow to use for notification callbacks.
+ * @return - the url that we run.
+ */
+ nsIURI verifyLogon(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ void biff(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in unsigned long aUidHighWater);
+
+ void deleteMessages(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in ACString aMessageIdentifierList,
+ in boolean aMessageIdsAreUID);
+
+ void deleteAllMessages(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener);
+
+ void addMessageFlags(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in ACString aMessageIdentifierList,
+ in imapMessageFlagsType aFlags,
+ in boolean aMessageIdsAreUID);
+
+ void subtractMessageFlags(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in ACString aMessageIdentifierList,
+ in imapMessageFlagsType aFlags,
+ in boolean aMessageIdsAreUID);
+
+ void setMessageFlags(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in ACString aMessageIdentifierList,
+ in imapMessageFlagsType aFlags,
+ in boolean aMessageIdsAreUID);
+
+ void discoverAllFolders(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ void discoverAllAndSubscribedFolders(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ void discoverChildren(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in ACString folderPath);
+
+ void onlineMessageCopy(in nsIMsgFolder aSrcFolder,
+ in ACString aMessageIds,
+ in nsIMsgFolder aDstFolder,
+ in boolean aIdsAreUids,
+ in boolean aIsMove,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in nsISupports aCopyState,
+ in nsIMsgWindow aWindow);
+
+
+ void appendMessageFromFile(in nsIFile aFile,
+ in nsIMsgFolder aDstFolder,
+ in ACString aMessageId,
+ in boolean idsAreUids,
+ in boolean aInSelectedState,
+ in nsIUrlListener aUrlListener,
+ in nsISupports aCopyState,
+ in nsIMsgWindow aMsgWindow);
+
+ void downloadMessagesForOffline(in ACString aMessageIds, in nsIMsgFolder aSrcFolder,
+ in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);
+
+ void moveFolder(in nsIMsgFolder aSrcFolder,
+ in nsIMsgFolder aDstFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow msgWindow);
+
+ void renameLeaf(in nsIMsgFolder aSrcFolder,
+ in AString aLeafName,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow msgWindow);
+
+ void deleteFolder(in nsIMsgFolder aFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ nsIURI createFolder(in nsIMsgFolder aParentFolder,
+ in AString aLeafName,
+ in nsIUrlListener aUrlListener);
+
+ void listFolder(in nsIMsgFolder aMailFolder,
+ in nsIUrlListener aUrlListener);
+
+ nsIURI subscribeFolder(in nsIMsgFolder aMailFolder,
+ in AString mailboxName,
+ in nsIUrlListener aUrlListener);
+
+ nsIURI unsubscribeFolder(in nsIMsgFolder aMailFolder,
+ in AString mailboxName,
+ in nsIUrlListener aUrlListener);
+
+ // this method will first check if the folder exists but is
+ // not subscribed to, in which case it will subscribe to the folder.
+ // otherwise, it will try to create the folder. It will try to do this
+ // with one url.
+ void ensureFolderExists(in nsIMsgFolder aParentFolder,
+ in AString aLeafName,
+ in nsIMsgWindow aMsgWindow,
+ in nsIUrlListener aUrlListener);
+
+
+ nsIURI getFolderAdminUrl(in nsIMsgFolder aMailFolder,
+ in nsIMsgWindow aMsgWindow,
+ in nsIUrlListener aUrlListener);
+
+ nsIURI issueCommandOnMsgs(in nsIMsgFolder aMailFolder,
+ in nsIMsgWindow aMsgWindow,
+ in ACString aCommand,
+ in ACString aMessageIdentifierList);
+
+ nsIURI fetchCustomMsgAttribute(in nsIMsgFolder aMailFolder,
+ in nsIMsgWindow aMsgWindow,
+ in ACString aAttribute,
+ in ACString aMessageIdentifierList);
+
+ nsIURI storeCustomKeywords(in nsIMsgFolder aMailFolder,
+ in nsIMsgWindow aMsgWindow,
+ in ACString flagsToAdd,
+ in ACString flagsToSubtract,
+ in ACString aMessageIdentifierList);
+
+ void getListOfFoldersOnServer(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow);
+ void getListOfFoldersWithPath(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in ACString folderPath);
+
+ nsISupports playbackAllOfflineOperations(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener);
+ void downloadAllOffineImapFolders(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener);
+
+ readonly attribute nsICacheStorage cacheStorage;
+};
diff --git a/comm/mailnews/imap/public/nsIImapUrl.idl b/comm/mailnews/imap/public/nsIImapUrl.idl
new file mode 100644
index 0000000000..75f85b93a5
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIImapUrl.idl
@@ -0,0 +1,210 @@
+/* -*- 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 : nsISupports
+{
+ 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 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 mimePartSelectorDetected;
+ 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.
+ /**
+ * copyState is used by some IMAP copy operations. The exact type stashed
+ * here depends on the operation being performed. For online move/copy,
+ * it'll be an nsImapMailCopyState (private to nsImapMailFolder). For
+ * other operations it might be (say), an nsIStreamListener.
+ */
+ 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;
+};
diff --git a/comm/mailnews/imap/public/nsIMailboxSpec.idl b/comm/mailnews/imap/public/nsIMailboxSpec.idl
new file mode 100644
index 0000000000..729b867075
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIMailboxSpec.idl
@@ -0,0 +1,47 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 nsIImapFlagAndUidState;
+
+[ptr] native nsImapNamespace(nsImapNamespace);
+%{C++
+class nsImapNamespace;
+%}
+
+[scriptable, uuid(a9fbbc80-5291-4ed8-a7f7-c2fcad231269)]
+interface nsIMailboxSpec : nsISupports
+{
+ attribute long folder_UIDVALIDITY;
+ /**
+ * The highest modification sequence number the parser has seen
+ * for this mailbox. See IMAP RFC 4551
+ **/
+ attribute unsigned long long highestModSeq;
+ attribute long numMessages;
+ attribute long numUnseenMessages;
+ attribute long numRecentMessages;
+
+ /// If server supports UIDNEXT, we store the result here.
+ attribute long nextUID;
+
+ attribute unsigned long box_flags;
+ attribute unsigned long supportedUserFlags;
+
+ attribute ACString allocatedPathName;
+ attribute AString unicharPathName;
+ attribute char hierarchyDelimiter;
+ attribute ACString hostName;
+
+ attribute nsIImapFlagAndUidState flagState;
+
+ attribute boolean folderSelected;
+ attribute boolean discoveredFromLsub;
+
+ attribute boolean onlineVerified;
+
+ [noscript] attribute nsImapNamespace namespaceForFolder;
+};
diff --git a/comm/mailnews/imap/public/nsIMsgImapMailFolder.idl b/comm/mailnews/imap/public/nsIMsgImapMailFolder.idl
new file mode 100644
index 0000000000..070276508a
--- /dev/null
+++ b/comm/mailnews/imap/public/nsIMsgImapMailFolder.idl
@@ -0,0 +1,253 @@
+/* -*- 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 "MailNewsTypes2.idl"
+
+interface nsIMsgFolder;
+interface nsIUTF8StringEnumerator;
+interface nsIUrlListener;
+interface nsIURI;
+interface nsIMsgDBHdr;
+interface nsIMsgWindow;
+interface nsIImapIncomingServer;
+interface nsIMsgParseMailMsgState;
+interface nsIAutoSyncState;
+
+/**
+ * nsIMsgQuota defines the quota for a resource within a quota root.
+ * @see RFC 2087
+ */
+[scriptable, uuid(9db60f97-45c1-45c2-8ab1-395690228f3f)]
+interface nsIMsgQuota : nsISupports {
+ /**
+ * If quota root name not empty, the concatenation of the quota root name
+ * and the resource name separated by a slash , e.g.,
+ * "User Quota / MESSAGE" or with empty quota root name, just resource
+ * name, e.g., "STORAGE".
+ */
+ attribute AUTF8String name;
+
+ /**
+ * Amount of resource in use for this quota root. E.g., number of messages
+ * or storage in KB (1024 octets).
+ */
+
+ attribute unsigned long long usage;
+ /**
+ * Maximum amount of usage permitted by the server for this quota root
+ * resource.
+ */
+ attribute unsigned long long limit;
+};
+
+/**
+ * nsIMsgImapFolderProps 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);
+
+ /**
+ * Sets the quota data displayed in the folder properties Quota tab. An
+ * array of quota items is passed in.
+ */
+ void setQuotaData(in Array<nsIMsgQuota> quotaArray);
+};
+
+[scriptable, uuid(fea0f455-7adf-4683-bf2f-c95c3fff03df)]
+interface nsIMsgImapMailFolder : nsISupports {
+ /**
+ * Remove the local version of this folder (used to clean up local folders
+ * which don't correspond to ones on the server).
+ */
+ void removeLocalSelf();
+ void createClientSubfolderInfo(in AUTF8String folderName, in char hierarchyDelimiter,
+ in long flags, in boolean suppressNotification);
+ void list();
+ void renameLocal(in AUTF8String 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 AUTF8String oldName, in AUTF8String newName);
+
+ // these are used for offline synchronization
+ void storeImapFlags(in long aFlags, in boolean aAddFlags,
+ in Array<nsMsgKey> aKeysToFlag, in nsIUrlListener aUrlListener);
+ nsIURI setImapFlags(in string uids, in long flags);
+ void replayOfflineMoveCopy(in Array<nsMsgKey> keys, in boolean isMove,
+ in nsIMsgFolder aDstFolder, in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aWindow, in boolean srcFolderOffline);
+ 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 AUTF8String 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,
+ in Array<nsMsgKey> aKeysToStore);
+
+ void notifyIfNewMail();
+
+ void initiateAutoSync(in nsIUrlListener aUrlListener);
+
+ attribute boolean verifiedAsOnlineFolder;
+ attribute boolean explicitlyVerify;
+ attribute char hierarchyDelimiter;
+ attribute long boxFlags;
+ /**
+ * onlineName is the IMAP name of the mailbox that this folder represents.
+ * It's a path with components separated by hierarchyDelimiter.
+ * For example, "INBOX/bar/wibble", "INBOX.bar.wibble", etc...
+ */
+ attribute AUTF8String onlineName;
+ attribute boolean isNamespace;
+ readonly attribute boolean canOpenFolder;
+ attribute AUTF8String adminUrl;
+ readonly attribute boolean hasAdminUrl;
+ attribute boolean performingBiff;
+ readonly attribute nsIMsgParseMailMsgState hdrParser;
+ readonly attribute nsIImapIncomingServer imapIncomingServer;
+ readonly attribute nsIAutoSyncState autoSyncStateObj;
+ readonly attribute boolean shouldUseUtf8FolderName;
+ /**
+ * @{
+ * 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;
+ /** @} */
+
+ /**
+ * Return an array of quota items of type nsIMsgQuota defined above.
+ * A not-empty array indicates that the server has provided one or more
+ * sets of quota information on this folder. The array will be empty
+ * - if the server does not supports quotas,
+ * - if there are no resource quotas on this folder, or
+ * - if the folder has yet to be opened (selected) by the user.
+ */
+ Array<nsIMsgQuota> getQuota();
+
+ /**
+ * 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);
+};