summaryrefslogtreecommitdiffstats
path: root/mailnews/imap/public
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/imap/public')
-rw-r--r--mailnews/imap/public/moz.build32
-rw-r--r--mailnews/imap/public/nsIAutoSyncFolderStrategy.idl23
-rw-r--r--mailnews/imap/public/nsIAutoSyncManager.idl194
-rw-r--r--mailnews/imap/public/nsIAutoSyncMsgStrategy.idl35
-rw-r--r--mailnews/imap/public/nsIAutoSyncState.idl130
-rw-r--r--mailnews/imap/public/nsIIMAPHostSessionList.h100
-rw-r--r--mailnews/imap/public/nsIImapFlagAndUidState.idl74
-rw-r--r--mailnews/imap/public/nsIImapHeaderXferInfo.idl23
-rw-r--r--mailnews/imap/public/nsIImapIncomingServer.idl105
-rw-r--r--mailnews/imap/public/nsIImapMailFolderSink.idl103
-rw-r--r--mailnews/imap/public/nsIImapMessageSink.idl80
-rw-r--r--mailnews/imap/public/nsIImapMockChannel.idl49
-rw-r--r--mailnews/imap/public/nsIImapProtocol.idl71
-rw-r--r--mailnews/imap/public/nsIImapProtocolSink.idl32
-rw-r--r--mailnews/imap/public/nsIImapServerSink.idl169
-rw-r--r--mailnews/imap/public/nsIImapService.idl258
-rw-r--r--mailnews/imap/public/nsIImapUrl.idl207
-rw-r--r--mailnews/imap/public/nsIMailboxSpec.idl43
-rw-r--r--mailnews/imap/public/nsIMsgImapMailFolder.idl215
-rw-r--r--mailnews/imap/public/nsMsgImapCID.h59
20 files changed, 2002 insertions, 0 deletions
diff --git a/mailnews/imap/public/moz.build b/mailnews/imap/public/moz.build
new file mode 100644
index 000000000..c531cc82b
--- /dev/null
+++ b/mailnews/imap/public/moz.build
@@ -0,0 +1,32 @@
+# 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',
+ 'nsIImapProtocol.idl',
+ 'nsIImapProtocolSink.idl',
+ 'nsIImapServerSink.idl',
+ 'nsIImapService.idl',
+ 'nsIImapUrl.idl',
+ 'nsIMailboxSpec.idl',
+ 'nsIMsgImapMailFolder.idl',
+]
+
+XPIDL_MODULE = 'msgimap'
+
+EXPORTS += [
+ 'nsIIMAPHostSessionList.h',
+ 'nsMsgImapCID.h',
+]
+
diff --git a/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl b/mailnews/imap/public/nsIAutoSyncFolderStrategy.idl
new file mode 100644
index 000000000..d58b6085f
--- /dev/null
+++ b/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 nsIMsgAccount;
+
+[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/mailnews/imap/public/nsIAutoSyncManager.idl b/mailnews/imap/public/nsIAutoSyncManager.idl
new file mode 100644
index 000000000..0dee48963
--- /dev/null
+++ b/mailnews/imap/public/nsIAutoSyncManager.idl
@@ -0,0 +1,194 @@
+/* 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;
+interface nsIMsgAccount;
+
+[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/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl b/mailnews/imap/public/nsIAutoSyncMsgStrategy.idl
new file mode 100644
index 000000000..93633a2cb
--- /dev/null
+++ b/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
+{
+ /// 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/mailnews/imap/public/nsIAutoSyncState.idl b/mailnews/imap/public/nsIAutoSyncState.idl
new file mode 100644
index 000000000..d03697e11
--- /dev/null
+++ b/mailnews/imap/public/nsIAutoSyncState.idl
@@ -0,0 +1,130 @@
+/* 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 nsIArray;
+interface nsIMutableArray;
+
+[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.
+ */
+
+ /** sync'd and no pending messages */
+ const long stCompletedIdle = 0;
+
+ /** STATUS issued. Will check to see if any counts changed since last STATUS */
+ const long stStatusIssued = 1;
+
+ /**
+ * Status found new messages. Update should be issued next. Status most
+ * likely was issued by non-autosync code (e.g., check other folders for
+ * new messages).
+ */
+ const long stUpdateNeeded = 2;
+
+ /** Update issued. Will figure out if there are any bodies to download */
+ const long stUpdateIssued = 3;
+
+ /** Message body download in progress */
+ const long stDownloadInProgress = 4;
+
+ /** ready to download the next group of messages */
+ const long stReadyToDownload = 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 nsIArray aMessageList);
+
+ /**
+ * Populates the given array with the keys 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
+ */
+ nsIMutableArray 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);
+
+ /**
+ * 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/mailnews/imap/public/nsIIMAPHostSessionList.h b/mailnews/imap/public/nsIIMAPHostSessionList.h
new file mode 100644
index 000000000..e3ce35d4f
--- /dev/null
+++ b/mailnews/imap/public/nsIIMAPHostSessionList.h
@@ -0,0 +1,100 @@
+/* -*- 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"
+
+class nsIMAPBodyShellCache;
+class nsIMAPBodyShell;
+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 char *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;
+
+ // 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;
+
+ // Message Body Shells
+ NS_IMETHOD AddShellToCacheForHost(const char *serverKey, nsIMAPBodyShell *shell) = 0;
+ NS_IMETHOD FindShellInCacheForHost(const char *serverKey, const char *mailboxName, const char *UID, IMAP_ContentModifiedType modType, nsIMAPBodyShell **result) = 0;
+ NS_IMETHOD ClearShellCacheForHost(const char *serverKey) = 0;
+};
+
+NS_DEFINE_STATIC_IID_ACCESSOR(nsIImapHostSessionList,
+ NS_IIMAPHOSTSESSIONLIST_IID)
+
+#endif
diff --git a/mailnews/imap/public/nsIImapFlagAndUidState.idl b/mailnews/imap/public/nsIImapFlagAndUidState.idl
new file mode 100644
index 000000000..4a7498b9b
--- /dev/null
+++ b/mailnews/imap/public/nsIImapFlagAndUidState.idl
@@ -0,0 +1,74 @@
+/* -*- 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(290412eb-5824-4087-8984-05450c9397be)]
+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;
+
+ /**
+ * 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);
+
+ void getUidOfMessage(in long zeroBasedIndex, out unsigned long result);
+ void getMessageFlags(in long zeroBasedIndex, out unsigned short result);
+ 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);
+ 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/mailnews/imap/public/nsIImapHeaderXferInfo.idl b/mailnews/imap/public/nsIImapHeaderXferInfo.idl
new file mode 100644
index 000000000..b2b2e7840
--- /dev/null
+++ b/mailnews/imap/public/nsIImapHeaderXferInfo.idl
@@ -0,0 +1,23 @@
+/* -*- 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;
+ [noscript] void getMsgHdrs ([shared] out string aMsgHdrs); // this doesn't copy the 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/mailnews/imap/public/nsIImapIncomingServer.idl b/mailnews/imap/public/nsIImapIncomingServer.idl
new file mode 100644
index 000000000..2c687e0f3
--- /dev/null
+++ b/mailnews/imap/public/nsIImapIncomingServer.idl
@@ -0,0 +1,105 @@
+/* -*- 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
+{
+ 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 ACString forceSelect;
+ attribute long timeOutLimits;
+ attribute ACString adminUrl;
+ attribute ACString serverDirectory;
+ /// RFC 2971 ID response stored as a pref
+ attribute ACString serverIDPref;
+ attribute boolean cleanupInboxOnExit;
+ attribute nsMsgImapDeleteModel deleteModel;
+ attribute boolean dualUseFolders;
+ attribute long emptyTrashThreshhold;
+ attribute ACString personalNamespace;
+ attribute ACString publicNamespace;
+ attribute ACString otherUsersNamespace;
+ attribute boolean offlineDownload;
+ attribute boolean overrideNamespaces;
+ attribute boolean usingSubscription;
+ attribute ACString manageMailAccountUrl;
+ attribute boolean fetchByChunks;
+ attribute boolean mimePartsOnDemand;
+ attribute boolean sendID;
+ attribute boolean isAOLServer;
+ attribute boolean capabilityACL;
+ attribute boolean capabilityQuota;
+ 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;
+
+ 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;
+
+ 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 ACString 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);
+ /**
+ * 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.
+ */
+ ACString PromptPassword(in nsIMsgWindow aWindow);
+ attribute boolean doingLsub;
+
+ ACString getUriWithNamespacePrefixIfNecessary(in long namespaceType, in ACString originalUri);
+ attribute boolean shuttingDown;
+};
diff --git a/mailnews/imap/public/nsIImapMailFolderSink.idl b/mailnews/imap/public/nsIImapMailFolderSink.idl
new file mode 100644
index 000000000..465e72b1d
--- /dev/null
+++ b/mailnews/imap/public/nsIImapMailFolderSink.idl
@@ -0,0 +1,103 @@
+/* -*- 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
+{
+ 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;
+};
+
+[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 aFolderQuotaRoot The IMAP quota root for this folder,
+ * as returned by the GETQUOTAROOT IMAP command.
+ * @param aFolderQuotaUsedKB Used space, in KB, on this folder's quota root.
+ * @param aFolderQuotaMaxKB Size, in KB, of this folder's quota root.
+ **/
+ void setFolderQuotaData(in ACString aFolderQuotaRoot, in unsigned long aFolderQuotaUsedKB,
+ in unsigned long aFolderQuotaMaxKB);
+
+ /// 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 unsigned long aCount,
+ [retval, array, size_is(aCount)] out 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 wstring aMessage,
+ 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/mailnews/imap/public/nsIImapMessageSink.idl b/mailnews/imap/public/nsIImapMessageSink.idl
new file mode 100644
index 000000000..420ea7642
--- /dev/null
+++ b/mailnews/imap/public/nsIImapMessageSink.idl
@@ -0,0 +1,80 @@
+/* -*- 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 nsIMsgMailNewsUrl;
+
+[scriptable, uuid(6ffb6a92-e43a-405f-92ea-92cf81a5e17b)]
+
+interface nsIImapMessageSink : nsISupports {
+ // set up messge 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);
+
+ void setContentModified(in nsIImapUrl aImapUrl, in nsImapContentModifiedType aModified);
+
+ /**
+ * 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/mailnews/imap/public/nsIImapMockChannel.idl b/mailnews/imap/public/nsIImapMockChannel.idl
new file mode 100644
index 000000000..ab4e6b996
--- /dev/null
+++ b/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 GetChannelContext(out nsISupports aChannelContext);
+ void Close();
+ void setImapProtocol(in nsIImapProtocol aProtocol);
+ [noscript] void setSecurityInfo(in nsISupports securityInfo);
+
+ void setURI(in nsIURI uri);
+};
diff --git a/mailnews/imap/public/nsIImapProtocol.idl b/mailnews/imap/public/nsIImapProtocol.idl
new file mode 100644
index 000000000..83b19a499
--- /dev/null
+++ b/mailnews/imap/public/nsIImapProtocol.idl
@@ -0,0 +1,71 @@
+/* -*- 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 nsIImapIncomingServer;
+interface nsIMsgFolder;
+interface nsIImapHostSessionList;
+interface nsIMsgWindow;
+interface nsIImapFlagAndUidState;
+
+[scriptable, uuid(290412eb-5824-4087-8984-05450c9397be)]
+interface nsIImapProtocol : nsISupports {
+ 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(out unsigned long keys, in unsigned long count);
+ // 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);
+ void GetSelectedMailboxName(out string folderName);
+ // Reset folder connection to authenticated state
+ void ResetToAuthenticatedState();
+
+ void OverrideConnectionInfo(in wstring pHost, in unsigned short pPort, in string pCookieData);
+};
+
diff --git a/mailnews/imap/public/nsIImapProtocolSink.idl b/mailnews/imap/public/nsIImapProtocolSink.idl
new file mode 100644
index 000000000..07b533065
--- /dev/null
+++ b/mailnews/imap/public/nsIImapProtocolSink.idl
@@ -0,0 +1,32 @@
+/* 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/mailnews/imap/public/nsIImapServerSink.idl b/mailnews/imap/public/nsIImapServerSink.idl
new file mode 100644
index 000000000..77fdcb2d9
--- /dev/null
+++ b/mailnews/imap/public/nsIImapServerSink.idl
@@ -0,0 +1,169 @@
+/* -*- 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 ACString folderPath,
+ in char hierarchyDelimiter, in long boxFlags);
+ boolean folderNeedsACLInitialized(in ACString folderPath);
+ void addFolderRights(in ACString folderPath, in ACString userName, in ACString rights);
+ void refreshFolderRights(in ACString folderPath);
+ void discoveryDone();
+ void onlineFolderDelete(in ACString folderName);
+ void onlineFolderCreateFailed(in ACString aFolderName);
+ void onlineFolderRename(in nsIMsgWindow msgWindow, in ACString oldName, in ACString newName);
+ boolean folderIsNoSelect(in ACString folderName);
+ void setFolderAdminURL(in ACString folderName, in ACString adminUrl);
+ boolean folderVerifiedOnline(in ACString 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 ACString aPassword);
+
+ attribute boolean userAuthenticated;
+ void setMailServerUrls(in ACString manageMailAccount, in ACString manageLists, in ACString 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 ACString 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 ACString 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 ACString aFolderName);
+ /// tell the server if listing using lsub command
+ void setServerDoingLsub(in boolean aDoingLsub);
+ /// set force select string
+ void SetServerForceSelect(in ACString forceSelect);
+};
diff --git a/mailnews/imap/public/nsIImapService.idl b/mailnews/imap/public/nsIImapService.idl
new file mode 100644
index 000000000..0a8521ee6
--- /dev/null
+++ b/mailnews/imap/public/nsIImapService.idl
@@ -0,0 +1,258 @@
+/* -*- 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 nsIImapIncomingServer;
+interface nsICacheStorage;
+
+[scriptable, uuid(aba44b3d-7a0f-4987-8794-96d2de66d966)]
+interface nsIImapService : nsISupports
+{
+ // You can pass in null for the url listener and the url if you don't require either.....
+ void selectFolder(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow,
+ out nsIURI aURL);
+
+ /**
+ * 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 nsIURI 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,
+ in ACString additionalHeader,
+ 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
+ *
+ * @returns the url created to run the expunge.
+ */
+ void expunge(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow,
+ out nsIURI aURL);
+
+ /**
+ * 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,
+ out nsIURI aURL);
+
+ void addMessageFlags(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ in ACString aMessageIdentifierList,
+ in imapMessageFlagsType aFlags,
+ in boolean aMessageIdsAreUID);
+
+ void subtractMessageFlags(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL,
+ 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,
+ out nsIURI aURL);
+
+ void discoverAllAndSubscribedFolders(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ out nsIURI aURL);
+
+ void discoverChildren(in nsIMsgFolder aImapMailFolder,
+ in nsIUrlListener aUrlListener,
+ in ACString folderPath,
+ out nsIURI aURL);
+
+ 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,
+ out nsIURI aURL,
+ in nsISupports aCopyState,
+ in nsIMsgWindow aMsgWindow);
+
+ void downloadMessagesForOffline(in ACString aMessageIds, in nsIMsgFolder aSrcFolder,
+ in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);
+
+ nsIURI moveFolder(in nsIMsgFolder aSrcFolder,
+ in nsIMsgFolder aDstFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow msgWindow);
+
+ nsIURI renameLeaf(in nsIMsgFolder aSrcFolder,
+ in AString aLeafName,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow msgWindow);
+
+ nsIURI deleteFolder(in nsIMsgFolder aFolder,
+ in nsIUrlListener aUrlListener,
+ in nsIMsgWindow aMsgWindow);
+
+ nsIURI createFolder(in nsIMsgFolder aParentFolder,
+ in AString aLeafName,
+ in nsIUrlListener aUrlListener);
+
+ nsIURI 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.
+ nsIURI ensureFolderExists(in nsIMsgFolder aParentFolder,
+ in AString aLeafName,
+ 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/mailnews/imap/public/nsIImapUrl.idl b/mailnews/imap/public/nsIImapUrl.idl
new file mode 100644
index 000000000..03d0e03e0
--- /dev/null
+++ b/mailnews/imap/public/nsIImapUrl.idl
@@ -0,0 +1,207 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIImapMailFolderSink;
+interface nsIImapMessageSink;
+interface nsIImapServerSink;
+interface nsIImapMockChannel;
+interface nsIFile;
+
+typedef long nsImapAction;
+typedef long nsImapState;
+
+typedef unsigned short imapMessageFlagsType;
+
+typedef long nsImapContentModifiedType;
+
+[scriptable, uuid(2e91901e-ff6c-11d3-b9fa-00108335942a)]
+interface nsImapContentModifiedTypes
+{
+ const long IMAP_CONTENT_NOT_MODIFIED = 0;
+ const long IMAP_CONTENT_MODIFIED_VIEW_INLINE = 1;
+ const long IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS = 2;
+ const long IMAP_CONTENT_FORCE_CONTENT_NOT_MODIFIED = 3;
+} ;
+
+[scriptable, uuid(fe2a8f9e-2886-4146-9896-27fff660c69f)]
+interface nsIImapUrl : nsISupports
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters for the imap specific event sinks to bind to to the url
+ ///////////////////////////////////////////////////////////////////////////////
+ attribute nsIImapMailFolderSink imapMailFolderSink;
+ attribute nsIImapMessageSink imapMessageSink;
+ attribute nsIImapServerSink imapServerSink;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters for the imap url state
+ ///////////////////////////////////////////////////////////////////////////////
+ attribute nsImapAction imapAction;
+ readonly attribute nsImapState requiredImapState;
+ readonly attribute string imapPartToFetch;
+ readonly attribute ACString customAttributeToFetch;
+ attribute ACString customAttributeResult;
+ readonly attribute ACString command;
+ attribute ACString customCommandResult;
+ readonly attribute ACString customAddFlags;
+ readonly attribute ACString customSubtractFlags;
+ void allocateCanonicalPath(in string aServerPath, in char aOnlineDelimiter, out string aAllocatedPath);
+ void allocateServerPath(in string aCanonicalPath, in char aOnlineDelimiter, out string aAllocatedPath);
+ string createServerSourceFolderPathString();
+ string createCanonicalSourceFolderPathString();
+ string createServerDestinationFolderPathString();
+
+ string addOnlineDirectoryIfNecessary(in string onlineMailboxName);
+ void createSearchCriteriaString (out string aResult);
+ readonly attribute ACString listOfMessageIds;
+
+ boolean messageIdsAreUids();
+ readonly attribute imapMessageFlagsType msgFlags; // kAddMsgFlags or kSubtractMsgFlags only
+
+ readonly attribute long numBytesToFetch;
+ attribute char onlineSubDirSeparator;
+ attribute boolean allowContentChange;
+ attribute boolean mimePartSelectorDetected;
+ attribute nsImapContentModifiedType contentModified;
+ attribute boolean fetchPartsOnDemand; // set to true if we're fetching a msg for display and want to not download parts
+ attribute boolean msgLoadingFromCache; // true if this msg load is coming from a cache, so we can know to mark it read
+ attribute boolean externalLinkUrl; // true if we ran this url because the user clicked on a link.
+ attribute boolean validUrl; // false if we couldn't parse url for whatever reason.
+ attribute nsISupports copyState;
+ attribute nsIFile msgFile;
+ attribute nsIImapMockChannel mockChannel;
+ /**
+ * Set to true if we should store the msg(s) for offline use if we can,
+ * e.g., we're fetching a message and the folder is configured for offline
+ * use and we're not doing mime parts on demand.
+ */
+ attribute boolean storeResultsOffline;
+ /**
+ * If we fallback from fetching by parts to fetching the whole message,
+ * because all the parts were inline, this tells us we should store
+ * the message offline.
+ */
+ attribute boolean storeOfflineOnFallback;
+
+ /**
+ * This attribute defaults to false, but if we only want to use the offline
+ * cache (disk, memory, or offline store) to fetch the message, then we set
+ * this to true. Currently, nsIMsgMessageService.streamMessage does this.
+ */
+ attribute boolean localFetchOnly;
+
+ /// Server disconnected first time so we're retrying.
+ attribute boolean rerunningUrl;
+
+ /**
+ * Do we have more headers to download? This is set when we decide to
+ * download newest headers first, followed by older headers in a subsequent
+ * run of the url, which allows other urls to run against the folder in the
+ * meantime.
+ */
+ attribute boolean moreHeadersToDownload;
+
+ /**
+ * @{
+ * This is used to tell the runner of the url more about the status of
+ * the command, beyond whether it was successful or not. For example,
+ * subtracting flags from a UID that doesn't exist isn't an error
+ * (the server returns OK), but the backend code may want to know about it.
+ */
+ attribute long extraStatus;
+
+ /**
+ * Current possible extra status values
+ */
+ const long ImapStatusNone = 0;
+ const long ImapStatusFlagChangeFailed = 1;
+ const long ImapStatusFlagsNotSettable = 2;
+ /** @} */
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Enumerated types specific to imap urls...
+ ///////////////////////////////////////////////////////////////////////////////
+
+ // the following are nsImapState enums.
+ // we have a basic set of imap url actions. These actions are nsImapActions.
+ // Certain actions require us to be in the authenticated state and others require us to
+ // be in the selected state. nsImapState is used to store the state the url needs to
+ // be in. You'll later see us refer to the imap url state in the imap protocol when we
+ // are processing the current url. Don't confuse nsImapState with the generic url state
+ // used to keep track of whether the url is running or not...
+ const long nsImapAuthenticatedState = 0;
+ const long nsImapSelectedState = 1;
+
+ const long nsImapActionSendText = 0; // a state used for testing purposes to send raw url text straight to the server....
+ // nsImapAuthenticatedStateUrl urls
+ // since the following url actions require us to be in the authenticated
+ // state, the high bit is left blank....
+ const long nsImapTest = 0x00000001;
+ const long nsImapCreateFolder = 0x00000005;
+ const long nsImapDeleteFolder = 0x00000006;
+ const long nsImapRenameFolder = 0x00000007;
+ const long nsImapMoveFolderHierarchy = 0x00000008;
+ const long nsImapLsubFolders = 0x00000009;
+ const long nsImapGetMailAccountUrl = 0x0000000A;
+ const long nsImapDiscoverChildrenUrl = 0x0000000B;
+ const long nsImapDiscoverAllBoxesUrl = 0x0000000D;
+ const long nsImapDiscoverAllAndSubscribedBoxesUrl = 0x0000000E;
+ const long nsImapAppendMsgFromFile = 0x0000000F;
+ const long nsImapSubscribe = 0x00000010;
+ const long nsImapUnsubscribe = 0x00000011;
+ const long nsImapRefreshACL = 0x00000012;
+ const long nsImapRefreshAllACLs = 0x00000013;
+ const long nsImapListFolder = 0x00000014;
+ const long nsImapUpgradeToSubscription = 0x00000015;
+ const long nsImapFolderStatus = 0x00000016;
+ const long nsImapRefreshFolderUrls = 0x00000017;
+ const long nsImapEnsureExistsFolder = 0x00000018;
+ const long nsImapOfflineToOnlineCopy = 0x00000019;
+ const long nsImapOfflineToOnlineMove = 0x0000001A;
+ const long nsImapVerifylogon = 0x0000001B;
+ // it's okay to add more imap actions that require us to
+ // be in the authenticated state here without renumbering
+ // the imap selected state url actions. just make sure you don't
+ // set the high bit...
+
+ // nsImapSelectedState urls. Note, the high bit is always set for
+ // imap actions which require us to be in the selected state
+ const long nsImapSelectFolder = 0x10000002;
+ const long nsImapLiteSelectFolder = 0x10000003;
+ const long nsImapExpungeFolder = 0x10000004;
+ const long nsImapMsgFetch = 0x10000018;
+ const long nsImapMsgHeader = 0x10000019;
+ const long nsImapSearch = 0x1000001A;
+ const long nsImapDeleteMsg = 0x1000001B;
+ const long nsImapDeleteAllMsgs = 0x1000001C;
+ const long nsImapAddMsgFlags = 0x1000001D;
+ const long nsImapSubtractMsgFlags = 0x1000001E;
+ const long nsImapSetMsgFlags = 0x1000001F;
+ const long nsImapOnlineCopy = 0x10000020;
+ const long nsImapOnlineMove = 0x10000021;
+ const long nsImapOnlineToOfflineCopy = 0x10000022;
+ const long nsImapOnlineToOfflineMove = 0x10000023;
+ const long nsImapMsgPreview = 0x10000024;
+ const long nsImapBiff = 0x10000026;
+ const long nsImapSelectNoopFolder = 0x10000027;
+ const long nsImapAppendDraftFromFile = 0x10000028;
+ const long nsImapUidExpunge = 0x10000029;
+ const long nsImapSaveMessageToDisk = 0x10000030;
+ const long nsImapOpenMimePart = 0x10000031;
+ const long nsImapMsgDownloadForOffline = 0x10000032;
+ const long nsImapDeleteFolderAndMsgs = 0x10000033;
+ const long nsImapUserDefinedMsgCommand = 0x10000034;
+ const long nsImapUserDefinedFetchAttribute = 0x10000035;
+ const long nsImapMsgFetchPeek = 0x10000036;
+ const long nsImapMsgStoreCustomKeywords = 0x10000037;
+
+ /// Constant for the default IMAP port number
+ const int32_t DEFAULT_IMAP_PORT = 143;
+
+ /// Constant for the default IMAP over ssl port number
+ const int32_t DEFAULT_IMAPS_PORT = 993;
+};
diff --git a/mailnews/imap/public/nsIMailboxSpec.idl b/mailnews/imap/public/nsIMailboxSpec.idl
new file mode 100644
index 000000000..5888ecbf3
--- /dev/null
+++ b/mailnews/imap/public/nsIMailboxSpec.idl
@@ -0,0 +1,43 @@
+/* -*- 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 "nsIImapFlagAndUidState.idl"
+
+interface 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/mailnews/imap/public/nsIMsgImapMailFolder.idl b/mailnews/imap/public/nsIMsgImapMailFolder.idl
new file mode 100644
index 000000000..f86f622b4
--- /dev/null
+++ b/mailnews/imap/public/nsIMsgImapMailFolder.idl
@@ -0,0 +1,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);
+};
diff --git a/mailnews/imap/public/nsMsgImapCID.h b/mailnews/imap/public/nsMsgImapCID.h
new file mode 100644
index 000000000..2ba83a28f
--- /dev/null
+++ b/mailnews/imap/public/nsMsgImapCID.h
@@ -0,0 +1,59 @@
+/* -*- 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/. */
+
+#ifndef nsMsgImapCID_h__
+#define nsMsgImapCID_h__
+
+#include "nsISupports.h"
+#include "nsIFactory.h"
+#include "nsIComponentManager.h"
+#include "nsMsgBaseCID.h"
+
+#define NS_IMAPURL_CID \
+{ /* 21A89611-DC0D-11d2-806C-006008128C4E */ \
+ 0x21a89611, 0xdc0d, 0x11d2, \
+ { 0x80, 0x6c, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e }}
+
+#define NS_IMAPPROTOCOLINFO_CONTRACTID \
+ NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "imap"
+
+#define NS_IMAPINCOMINGSERVER_CONTRACTID \
+ NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "imap"
+
+#define NS_IMAPSERVICE_CONTRACTID \
+ "@mozilla.org/messenger/imapservice;1"
+
+#define NS_IMAPSERVICE_CID \
+{ /* C5852B22-EBE2-11d2-95AD-000064657374 */ \
+ 0xc5852b22, 0xebe2, 0x11d2, \
+ {0x95, 0xad, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74}}
+
+#define NS_IMAPPROTOCOL_CID \
+{ /* 8C0C40D1-E173-11d2-806E-006008128C4E */ \
+ 0x8c0c40d1, 0xe173, 0x11d2, \
+ { 0x80, 0x6e, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e }}
+
+
+#define NS_IIMAPHOSTSESSIONLIST_CID \
+{ /* 479ce8fc-e725-11d2-a505-0060b0fc04b7 */ \
+ 0x479ce8fc, 0xe725, 0x11d2, \
+ {0xa5, 0x05, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }}
+
+#define NS_IMAPINCOMINGSERVER_CID \
+{ /* 8D3675E0-ED46-11d2-8077-006008128C4E */ \
+ 0x8d3675e0, 0xed46, 0x11d2, \
+ {0x80, 0x77, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e}}
+
+#define NS_IMAPRESOURCE_CID \
+{ /* fa32d000-f6a0-11d2-af8d-001083002da8 */ \
+ 0xfa32d000, 0xf6a0, 0x11d2, \
+ { 0xaf, 0x8d, 0x00, 0x10, 0x83, 0x00, 0x2d, 0xa8 }}
+
+// 4ECA51DF-6734-11d3-989A-001083010E9B
+#define NS_IMAPMOCKCHANNEL_CID \
+ {0x4eca51df, 0x6734, 0x11d3, \
+ {0x98, 0x9a, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b}}
+
+#endif // nsMsgImapCID_h__