diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/base/public | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/base/public')
66 files changed, 6971 insertions, 0 deletions
diff --git a/comm/mailnews/base/public/MailNewsTypes.h b/comm/mailnews/base/public/MailNewsTypes.h new file mode 100644 index 0000000000..e6f58cb56b --- /dev/null +++ b/comm/mailnews/base/public/MailNewsTypes.h @@ -0,0 +1,40 @@ +/* -*- 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 MailNewsTypes_h__ +#define MailNewsTypes_h__ + +#include "msgCore.h" +#include "MailNewsTypes2.h" + +/* nsMsgKey is a unique ID for a particular message in a folder. If you want + a handle to a message that will remain valid even after resorting the folder + or otherwise changing their indices, you want one of these rather than a + nsMsgViewIndex. nsMsgKeys don't survive local mail folder compression, + however. + */ +const nsMsgKey nsMsgKey_None = 0xffffffff; + +/* nsMsgViewIndex + * + * A generic index type from which other index types are derived. All + * nsMsgViewIndex derived types are zero based. + * + * The following index types are currently supported: + * - nsMsgViewIndex - an index into the list of messages or folders or groups, + * where zero is the first one to show, one is the second, etc... + * - AB_SelectionIndex + * - AB_NameCompletionIndex + */ + +const nsMsgViewIndex nsMsgViewIndex_None = 0xFFFFFFFF; + +/* kSizeUnknown is a special value of folder size that indicates the size + * is unknown yet. Usually this causes the folder to determine the real size + * immediately as it is queried by a consumer. + */ +const int64_t kSizeUnknown = -1; + +#endif diff --git a/comm/mailnews/base/public/MailNewsTypes2.idl b/comm/mailnews/base/public/MailNewsTypes2.idl new file mode 100644 index 0000000000..aeb8df2ec6 --- /dev/null +++ b/comm/mailnews/base/public/MailNewsTypes2.idl @@ -0,0 +1,93 @@ +/* -*- 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" + +typedef unsigned long nsMsgKey; +typedef unsigned long nsMsgViewIndex; + +typedef long nsMsgSearchScopeValue; + +typedef long nsMsgPriorityValue; +typedef long nsMsgSocketTypeValue; +typedef long nsMsgAuthMethodValue; + +typedef unsigned long nsMsgJunkStatus; + +typedef unsigned long nsMsgJunkScore; + +[scriptable, uuid(94C0D8D8-2045-11d3-8A8F-0060B0FC04D2)] +interface nsMsgPriority : nsISupports { + const nsMsgPriorityValue notSet = 0; + const nsMsgPriorityValue none = 1; + const nsMsgPriorityValue lowest = 2; + const nsMsgPriorityValue low = 3; + const nsMsgPriorityValue normal = 4; + const nsMsgPriorityValue high = 5; + const nsMsgPriorityValue highest = 6; + //the default priority (if none) is set in the message + const nsMsgPriorityValue Default = 4; +}; + +/** + * Defines whether to use SSL or STARTTLS or not. + * Used by @see nsIMsgIncomingServer.socketType + * and @see nsISmtpServer.socketType + */ +[scriptable, uuid(bc78bc74-1b34-48e8-ac2b-968e8dff1aeb)] +interface nsMsgSocketType : nsISupports { + /// No SSL or STARTTLS + const nsMsgSocketTypeValue plain = 0; + /// Use TLS via STARTTLS, but only if server offers it. + /// @deprecated This is vulnerable to MITM attacks + const nsMsgSocketTypeValue trySTARTTLS = 1; + /// Insist on TLS via STARTTLS. + /// Uses normal port. + const nsMsgSocketTypeValue alwaysSTARTTLS = 2; + /// Connect via SSL. + /// Needs special SSL port. + const nsMsgSocketTypeValue SSL = 3; +}; + +/** + * Defines which authentication schemes we should try. + * Used by @see nsIMsgIncomingServer.authMethod + * and @see nsISmtpServer.authMethod + */ +[scriptable, uuid(4a10e647-d179-4a53-b7ef-df575ff5f405)] +interface nsMsgAuthMethod : nsISupports { + // 0 is intentionally undefined and invalid + /// No login needed. E.g. IP-address-based. + const nsMsgAuthMethodValue none = 1; + /// Do not use AUTH commands (e.g. AUTH=PLAIN), + /// but the original login commands that the protocol specified + /// (POP: "USER"/"PASS", IMAP: "login", not valid for SMTP) + const nsMsgAuthMethodValue old = 2; + /// password in the clear. AUTH=PLAIN/LOGIN or old-style login. + const nsMsgAuthMethodValue passwordCleartext = 3; + /// hashed password. CRAM-MD5, DIGEST-MD5 + const nsMsgAuthMethodValue passwordEncrypted = 4; + /// Kerberos / GSSAPI (Unix single-signon) + const nsMsgAuthMethodValue GSSAPI = 5; + /// NTLM is a Windows single-singon scheme. + /// Includes MSN / Passport.net, which is the same with a different name. + const nsMsgAuthMethodValue NTLM = 6; + /// Auth External is cert-based authentication + const nsMsgAuthMethodValue External = 7; + /// Encrypted password or Kerberos / GSSAPI or NTLM. + /// @deprecated - for migration only. + const nsMsgAuthMethodValue secure = 8; + /// Let us pick any of the auth types supported by the server. + /// Discouraged, because vulnerable to MITM attacks, even if server offers secure auth. + const nsMsgAuthMethodValue anything = 9; + + /// Use OAuth2 to authenticate. + const nsMsgAuthMethodValue OAuth2 = 10; +}; + +typedef long nsMsgViewSortOrderValue; +typedef long nsMsgViewSortTypeValue; +typedef long nsMsgViewTypeValue; +typedef long nsMsgViewFlagsTypeValue; diff --git a/comm/mailnews/base/public/moz.build b/comm/mailnews/base/public/moz.build new file mode 100644 index 0000000000..be6deb7da9 --- /dev/null +++ b/comm/mailnews/base/public/moz.build @@ -0,0 +1,80 @@ +# 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 += [ + "MailNewsTypes2.idl", + "mozINewMailListener.idl", + "mozINewMailNotificationService.idl", + "msgIOAuth2Module.idl", + "nsICopyMessageListener.idl", + "nsICopyMessageStreamListener.idl", + "nsIFolderListener.idl", + "nsIFolderLookupService.idl", + "nsIIncomingServerListener.idl", + "nsIMailAuthModule.idl", + "nsIMailChannel.idl", + "nsIMapiRegistry.idl", + "nsIMessenger.idl", + "nsIMessengerMigrator.idl", + "nsIMessengerOSIntegration.idl", + "nsIMessengerWindowService.idl", + "nsIMsgAccount.idl", + "nsIMsgAccountManager.idl", + "nsIMsgAsyncPrompter.idl", + "nsIMsgBiffManager.idl", + "nsIMsgContentPolicy.idl", + "nsIMsgCopyService.idl", + "nsIMsgCopyServiceListener.idl", + "nsIMsgCustomColumnHandler.idl", + "nsIMsgDBView.idl", + "nsIMsgEnumerator.idl", + "nsIMsgFolder.idl", + "nsIMsgFolderCache.idl", + "nsIMsgFolderCacheElement.idl", + "nsIMsgFolderCompactor.idl", + "nsIMsgFolderListener.idl", + "nsIMsgFolderNotificationService.idl", + "nsIMsgHdr.idl", + "nsIMsgIdentity.idl", + "nsIMsgIncomingServer.idl", + "nsIMsgMailNewsUrl.idl", + "nsIMsgMailSession.idl", + "nsIMsgMdnGenerator.idl", + "nsIMsgMessageService.idl", + "nsIMsgOfflineManager.idl", + "nsIMsgPluggableStore.idl", + "nsIMsgProgress.idl", + "nsIMsgProtocolHandler.idl", + "nsIMsgProtocolInfo.idl", + "nsIMsgPurgeService.idl", + "nsIMsgShutdown.idl", + "nsIMsgStatusFeedback.idl", + "nsIMsgTagService.idl", + "nsIMsgThread.idl", + "nsIMsgUserFeedbackListener.idl", + "nsIMsgWindow.idl", + "nsISpamSettings.idl", + "nsIStatusBarBiffManager.idl", + "nsIStopwatch.idl", + "nsISubscribableServer.idl", + "nsIUrlListener.idl", + "nsIUserInfo.idl", + "nsMsgFolderFlags.idl", + "nsMsgMessageFlags.idl", +] + +if CONFIG["OS_ARCH"] == "WINNT": + XPIDL_SOURCES += [ + "nsIMessengerWindowsIntegration.idl", + ] + +XPIDL_MODULE = "msgbase" + +EXPORTS += [ + "MailNewsTypes.h", + "msgCore.h", + "nsMsgHeaderMasks.h", + "nsMsgLocalFolderHdrs.h", +] diff --git a/comm/mailnews/base/public/mozINewMailListener.idl b/comm/mailnews/base/public/mozINewMailListener.idl new file mode 100644 index 0000000000..467acb671c --- /dev/null +++ b/comm/mailnews/base/public/mozINewMailListener.idl @@ -0,0 +1,22 @@ +/* -*- 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" + +[scriptable, uuid(e15f104f-a16d-4e51-a362-4b4c5efe05b9)] +/** + * Callback interface for objects interested in receiving new mail notifications + * from mozINewMailNotificationService + * NOTE: THIS INTERFACE IS UNDER ACTIVE DEVELOPMENT AND SUBJECT TO CHANGE, + * see https://bugzilla.mozilla.org/show_bug.cgi?id=715799 + */ +interface mozINewMailListener : nsISupports { + /** The new mail notification service will call this when the number of interesting + * messages has changed + * + * @param unreadCount The number of unread messages the user cares to be notified about + */ + void onCountChanged(in unsigned long count); +}; diff --git a/comm/mailnews/base/public/mozINewMailNotificationService.idl b/comm/mailnews/base/public/mozINewMailNotificationService.idl new file mode 100644 index 0000000000..cdd049bcca --- /dev/null +++ b/comm/mailnews/base/public/mozINewMailNotificationService.idl @@ -0,0 +1,58 @@ +/* -*- 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 mozINewMailListener; + +typedef long newMailListenerFlag; + +[scriptable, uuid(7fef9018-c9f1-4cbd-b57c-d6555cf3a668)] +/** New mail notification service. This service watches all the relevant + * folder and message change events, preferences etc. and keeps track of + * the specific messages the user wants notifications for. + * NOTE: THIS INTERFACE IS UNDER ACTIVE DEVELOPMENT AND SUBJECT TO CHANGE, + * see https://bugzilla.mozilla.org/show_bug.cgi?id=715799 + * Registered mozINewMailListeners are called when the message count or + * specific list of notified messages changes. + * ** Should also document the observer service callback that allows + * plugins to override notifications by folder + */ +interface mozINewMailNotificationService : nsISupports { + /** + * @name Notification flags + * These flags determine which notifications will be sent. + * @{ + */ + /// mozINewMailListener::count notification + const newMailListenerFlag count = 0x1; + + /// mozINewMailListener::messages notification + const newMailListenerFlag messages = 0x2; + + /** @} */ + + /** + * addListener - Register a mozINewMailListener to receive callbacks + * when the count or list of notification-worthy messages + * changes. + * @param aListener mozINewMailListener to call back + * @param flags Bitmask of newMailListenerFlag values indicating + * the particular callbacks this listener wants. + * If the listener is already registered with the + * notification service, the existing set of flags is + * replaced by the values passed in this parameter. + */ + void addListener(in mozINewMailListener aListener, + in newMailListenerFlag flags); + /** + * removeListener - remove a listener from the service + * @param aListener The listener to remove + */ + void removeListener(in mozINewMailListener aListener); + + /// The current count of notification-worth unread messages + readonly attribute long messageCount; +}; diff --git a/comm/mailnews/base/public/msgCore.h b/comm/mailnews/base/public/msgCore.h new file mode 100644 index 0000000000..679e510887 --- /dev/null +++ b/comm/mailnews/base/public/msgCore.h @@ -0,0 +1,210 @@ +/* -*- 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 files we are going to want available to all files....these files + include NSPR, memory, and string header files among others */ + +#ifndef msgCore_h__ +#define msgCore_h__ + +#include "nscore.h" +#include "nspr.h" +#include "plstr.h" +#include "nsCRTGlue.h" + +class nsIMsgDBHdr; +class nsIMsgFolder; + +// include common interfaces such as the service manager and the repository.... +#include "nsIServiceManager.h" +#include "nsIComponentManager.h" + +/* + * The suffix we use for the mail summary file. + */ +#define SUMMARY_SUFFIX u".msf" +#define SUMMARY_SUFFIX8 ".msf" +#define SUMMARY_SUFFIX_LENGTH 4 + +/* + * The suffix we use for folder subdirectories. + */ +#define FOLDER_SUFFIX u".sbd" +#define FOLDER_SUFFIX8 ".sbd" +#define FOLDER_SUFFIX_LENGTH 4 + +/* + * These are folder property strings, which are used in several places. + + */ +// Most recently used (opened, moved to, got new messages) +#define MRU_TIME_PROPERTY "MRUTime" +// Most recently moved to, for recent folders list in move menu +#define MRM_TIME_PROPERTY "MRMTime" + +/* NS_ERROR_MODULE_MAILNEWS is defined in mozilla/xpcom/public/nsError.h */ + +/* + * NS_ERROR macros - use these macros to generate error constants + * to be used by XPCOM interfaces and possibly other useful things + * do not use these macros in your code - declare error macros for + * each specific error you need. + * + * for example: + * #define NS_MSG_ERROR_NO_SUCH_FOLDER NS_MSG_GENERATE_FAILURE(4) + * + */ + +/* use these routines to generate error values */ +#define NS_MSG_GENERATE_RESULT(severity, value) \ + NS_ERROR_GENERATE(severity, NS_ERROR_MODULE_MAILNEWS, value) + +#define NS_MSG_GENERATE_SUCCESS(value) \ + NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MAILNEWS, value) + +#define NS_MSG_GENERATE_FAILURE(value) \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value) + +/* these are shortcuts to generate simple errors with a zero value */ +#define NS_MSG_SUCCESS NS_MSG_GENERATE_SUCCESS(0) +#define NS_MSG_FAILURE NS_MSG_GENERATE_FAILURE(0) + +#define IS_SPACE(VAL) \ + (((((PRIntn)(VAL)) & 0x7f) == ((PRIntn)(VAL))) && isspace((PRIntn)(VAL))) + +#define IS_DIGIT(i) ((((unsigned int)(i)) > 0x7f) ? (int)0 : isdigit(i)) +#if defined(XP_WIN) +# define IS_ALPHA(VAL) (isascii((int)(VAL)) && isalpha((int)(VAL))) +#else +# define IS_ALPHA(VAL) \ + ((((unsigned int)(VAL)) > 0x7f) ? (int)0 : isalpha((int)(VAL))) +#endif + +/* for retrieving information out of messenger nsresults */ + +#define NS_IS_MSG_ERROR(err) \ + (NS_ERROR_GET_MODULE(err) == NS_ERROR_MODULE_MAILNEWS) + +#define NS_MSG_SUCCEEDED(err) (NS_IS_MSG_ERROR(err) && NS_SUCCEEDED(err)) + +#define NS_MSG_FAILED(err) (NS_IS_MSG_ERROR(err) && NS_FAILED(err)) + +#define NS_MSG_PASSWORD_PROMPT_CANCELLED NS_MSG_GENERATE_SUCCESS(1) + +/** + * Indicates that a search is done/terminated because it was interrupted. + * Interrupting a search originally notified listeners with + * OnSearchDone(NS_OK), so we define a success value to continue doing this, + * and because the search was fine except for an explicit call to interrupt it. + */ +#define NS_MSG_SEARCH_INTERRUPTED NS_MSG_GENERATE_SUCCESS(2) + +/* This is where we define our errors. There has to be a central + place so we don't use the same error codes for different errors. +*/ +#define NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE NS_MSG_GENERATE_FAILURE(5) +#define NS_MSG_ERROR_FOLDER_SUMMARY_MISSING NS_MSG_GENERATE_FAILURE(6) +#define NS_MSG_ERROR_FOLDER_MISSING NS_MSG_GENERATE_FAILURE(7) + +#define NS_MSG_MESSAGE_NOT_FOUND NS_MSG_GENERATE_FAILURE(8) +#define NS_MSG_NOT_A_MAIL_FOLDER NS_MSG_GENERATE_FAILURE(9) + +#define NS_MSG_FOLDER_BUSY NS_MSG_GENERATE_FAILURE(10) + +#define NS_MSG_COULD_NOT_CREATE_DIRECTORY NS_MSG_GENERATE_FAILURE(11) +#define NS_MSG_CANT_CREATE_FOLDER NS_MSG_GENERATE_FAILURE(12) + +#define NS_MSG_FILTER_PARSE_ERROR NS_MSG_GENERATE_FAILURE(13) + +#define NS_MSG_FOLDER_UNREADABLE NS_MSG_GENERATE_FAILURE(14) + +#define NS_MSG_ERROR_WRITING_MAIL_FOLDER NS_MSG_GENERATE_FAILURE(15) + +#define NS_MSG_ERROR_NO_SEARCH_VALUES NS_MSG_GENERATE_FAILURE(16) + +#define NS_MSG_ERROR_INVALID_SEARCH_SCOPE NS_MSG_GENERATE_FAILURE(17) + +#define NS_MSG_ERROR_INVALID_SEARCH_TERM NS_MSG_GENERATE_FAILURE(18) + +#define NS_MSG_FOLDER_EXISTS NS_MSG_GENERATE_FAILURE(19) + +#define NS_MSG_ERROR_OFFLINE NS_MSG_GENERATE_FAILURE(20) + +#define NS_MSG_POP_FILTER_TARGET_ERROR NS_MSG_GENERATE_FAILURE(21) + +#define NS_MSG_INVALID_OR_MISSING_SERVER NS_MSG_GENERATE_FAILURE(22) + +#define NS_MSG_SERVER_USERNAME_MISSING NS_MSG_GENERATE_FAILURE(23) + +#define NS_MSG_INVALID_DBVIEW_INDEX NS_MSG_GENERATE_FAILURE(24) + +#define NS_MSG_NEWS_ARTICLE_NOT_FOUND NS_MSG_GENERATE_FAILURE(25) + +#define NS_MSG_ERROR_COPY_FOLDER_ABORTED NS_MSG_GENERATE_FAILURE(26) +// this error means a url was queued but never run because one of the urls +// it was queued after failed. We send an OnStopRunningUrl with this error code +// so the listeners can know that we didn't run the url. +#define NS_MSG_ERROR_URL_ABORTED NS_MSG_GENERATE_FAILURE(27) + +// when num of custom headers exceeds 50 +#define NS_MSG_CUSTOM_HEADERS_OVERFLOW NS_MSG_GENERATE_FAILURE(28) + +// when custom header has invalid characters (as per rfc 2822) +#define NS_MSG_INVALID_CUSTOM_HEADER NS_MSG_GENERATE_FAILURE(29) + +// when local caches are password protect and user isn't auth +#define NS_MSG_USER_NOT_AUTHENTICATED NS_MSG_GENERATE_FAILURE(30) + +#define NS_MSG_ERROR_COPYING_FROM_TMP_DOWNLOAD \ + NS_MSG_GENERATE_FAILURE(31) // pop3 downloaded to tmp file, and failed. + +// The code tried to stream a message using the aLocalOnly argument, but +// the message was not cached locally. +#define NS_MSG_ERROR_MSG_NOT_OFFLINE NS_MSG_GENERATE_FAILURE(32) + +// The imap server returned NO or BAD for an IMAP command +#define NS_MSG_ERROR_IMAP_COMMAND_FAILED NS_MSG_GENERATE_FAILURE(33) + +#define NS_MSG_ERROR_INVALID_FOLDER_NAME NS_MSG_GENERATE_FAILURE(34) + +/* Error codes for message compose are defined in + compose\src\nsMsgComposeStringBundle.h. Message compose use the same error + code space as other mailnews modules. To avoid any conflict, values between + 12500 and 12999 are reserved. +*/ +#define NS_MSGCOMP_ERROR_BEGIN 12500 +/* NS_ERROR_NNTP_NO_CROSS_POSTING lives here, and not in + * nsMsgComposeStringBundle.h, because it is used in news and compose. */ +#define NS_ERROR_NNTP_NO_CROSS_POSTING NS_MSG_GENERATE_FAILURE(12554) +#define NS_MSGCOMP_ERROR_END 12999 + +#if defined(XP_WIN) +# define MSG_LINEBREAK "\015\012" +# define MSG_LINEBREAK_LEN 2 +#else +# define MSG_LINEBREAK "\012" +# define MSG_LINEBREAK_LEN 1 +#endif + +/* + * On Windows, we use \r\n as the line terminator in mbox files. On + * other platforms, we use \n. However, we need to be able to + * recognize line terminators produced on any platform, because we + * allow profiles (including the mbox files they contain) to be shared + * between platforms. + * + * Returns 0 (i.e., false) if the line is not blank, or otherwise the + * length of the line terminator, i.e., 1 for \n or 2 for \r\n. + */ +#define IS_MSG_LINEBREAK(line) \ + (line[0] == '\012' ? 1 : ((line[0] == '\015' && line[1] == '\012') ? 2 : 0)) + +#define NS_MSG_BASE +#define NS_MSG_BASE_STATIC_MEMBER_(type) type + +/// The number of microseconds in a day. This comes up a lot. +#define PR_USEC_PER_DAY (PRTime(PR_USEC_PER_SEC) * 60 * 60 * 24) + +#endif // msgCore_h__ diff --git a/comm/mailnews/base/public/msgIOAuth2Module.idl b/comm/mailnews/base/public/msgIOAuth2Module.idl new file mode 100644 index 0000000000..e3d1f8aa15 --- /dev/null +++ b/comm/mailnews/base/public/msgIOAuth2Module.idl @@ -0,0 +1,56 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +interface nsIMsgIncomingServer; +interface nsISmtpServer; + +/** + * A listener callback for OAuth2 SASL authentication. This would be represented + * as a promise, but this needs to be consumed by C++ code. + */ +[scriptable, uuid(9a088b49-bc13-4f99-9478-053a6a43e370)] +interface msgIOAuth2ModuleListener : nsISupports { + /** + * Called on successful OAuth2 authentication with the base64-encoded + * string to send as the client initial response for SASL XOAUTH2. + */ + void onSuccess(in ACString aBearerToken); + + /// Called on failed OAuth2 authentication. + void onFailure(in nsresult aError); +}; + +/** + * An interface for managing the responsibilities of using OAuth2 to produce a + * bearer token, for use in SASL steps. + */ +[scriptable, uuid(68c275f8-cfa7-4622-b279-af290616cae6)] +interface msgIOAuth2Module : nsISupports { + /** + * Initialize the OAuth2 parameters from an SMTP server, and return whether or + * not we can authenticate with OAuth2. + */ + bool initFromSmtp(in nsISmtpServer aSmtpServer); + + /** + * Initialize the OAuth2 parameters from an incoming server, and return + * whether or not we can authenticate with OAuth2. + */ + bool initFromMail(in nsIMsgIncomingServer aServer); + + /** + * Connect to the OAuth2 server to get an access token. + * @param aWithUI If false, do not allow a dialog to be popped up to query + * for a password. + * @param aCallback Listener that handles the async response. + */ + void connect(in boolean aWithUI, in msgIOAuth2ModuleListener aCallback); +}; + +%{C++ +#define MSGIOAUTH2MODULE_CONTRACTID "@mozilla.org/mail/oauth2-module;1" +%} diff --git a/comm/mailnews/base/public/nsICopyMessageListener.idl b/comm/mailnews/base/public/nsICopyMessageListener.idl new file mode 100644 index 0000000000..4c13dab280 --- /dev/null +++ b/comm/mailnews/base/public/nsICopyMessageListener.idl @@ -0,0 +1,24 @@ +/* -*- 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 nsIMsgDBHdr; +interface nsIInputStream; + +[scriptable, uuid(53CA78FE-E231-11d2-8A4D-0060B0FC04D2)] + +/* Use this for any object that wants to handle copying/moving messages to it */ + +interface nsICopyMessageListener : nsISupports +{ + void beginCopy(); + void startMessage(); + void copyData(in nsIInputStream aIStream, in long aLength); + void endMessage(in nsMsgKey key); + void endCopy(in boolean copySucceeded); + void endMove(in boolean moveSucceeded); +}; diff --git a/comm/mailnews/base/public/nsICopyMessageStreamListener.idl b/comm/mailnews/base/public/nsICopyMessageStreamListener.idl new file mode 100644 index 0000000000..772a69080b --- /dev/null +++ b/comm/mailnews/base/public/nsICopyMessageStreamListener.idl @@ -0,0 +1,20 @@ +/* -*- 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 nsICopyMessageListener; +interface nsIURI; + +[scriptable, uuid(7741DAEC-2125-11d3-8A90-0060B0FC04D2)] + +interface nsICopyMessageStreamListener: nsISupports +{ + void init(in nsICopyMessageListener destination); + void startMessage(); + void endMessage(in nsMsgKey key); + void endCopy(in nsIURI uri, in nsresult status); +}; diff --git a/comm/mailnews/base/public/nsIFolderListener.idl b/comm/mailnews/base/public/nsIFolderListener.idl new file mode 100644 index 0000000000..3906ef2f46 --- /dev/null +++ b/comm/mailnews/base/public/nsIFolderListener.idl @@ -0,0 +1,70 @@ +/* -*- 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" + +interface nsIMsgFolder; +interface nsIMsgDBHdr; + +typedef unsigned long folderListenerNotifyFlagValue; + +/** + * nsIFolderListener defines callbacks to handle various notifications + * about changes in folders. + * These listeners can be attached to individual folders, or they + * can be registered globally, with nsIMsgMailSession. + * These notifications originate from nsIMsgFolder implementations. + * (nsIMsgFolder has corresponding methods for generating these + * notifications). + */ +[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)] +interface nsIFolderListener : nsISupports { + // "added" flag covers adding both messages and child folders. + const folderListenerNotifyFlagValue added = 0x1; + void onFolderAdded(in nsIMsgFolder parent, in nsIMsgFolder child); + void onMessageAdded(in nsIMsgFolder parent, in nsIMsgDBHdr msg); + + // "removed" flag covers removing both messages and child folders. + const folderListenerNotifyFlagValue removed = 0x2; + void onFolderRemoved(in nsIMsgFolder parent, in nsIMsgFolder child); + void onMessageRemoved(in nsIMsgFolder parent, in nsIMsgDBHdr msg); + + const folderListenerNotifyFlagValue propertyChanged = 0x4; + void onFolderPropertyChanged(in nsIMsgFolder folder, + in ACString property, + in AUTF8String oldValue, + in AUTF8String newValue); + + const folderListenerNotifyFlagValue intPropertyChanged = 0x8; + // While this property handles long long (64bit wide) values, + // the Javascript engine will only pass values up to 2^53 to the consumers. + void onFolderIntPropertyChanged(in nsIMsgFolder folder, + in ACString property, + in long long oldValue, + in long long newValue); + + const folderListenerNotifyFlagValue boolPropertyChanged = 0x10; + void onFolderBoolPropertyChanged(in nsIMsgFolder folder, + in ACString property, + in boolean oldValue, + in boolean newValue); + + const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20; + void onFolderUnicharPropertyChanged(in nsIMsgFolder folder, + in ACString property, + in AString oldValue, + in AString newValue); + + const folderListenerNotifyFlagValue propertyFlagChanged = 0x40; + void onFolderPropertyFlagChanged(in nsIMsgDBHdr msg, + in ACString property, + in unsigned long oldFlag, + in unsigned long newFlag); + + const folderListenerNotifyFlagValue event = 0x80; + void onFolderEvent(in nsIMsgFolder folder, in ACString event); + + const folderListenerNotifyFlagValue all = 0xFFFFFFFF; +}; diff --git a/comm/mailnews/base/public/nsIFolderLookupService.idl b/comm/mailnews/base/public/nsIFolderLookupService.idl new file mode 100644 index 0000000000..fece4102ad --- /dev/null +++ b/comm/mailnews/base/public/nsIFolderLookupService.idl @@ -0,0 +1,52 @@ +/* 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; + +/** + * This service provides a way to lookup any nsIMsgFolder. + * + * When looking up folders by URL, note that the URL must be encoded to be a + * valid folder URL. Of particular note are the following requirements: + * - invalid characters in paths must be percent-encoded + * - the URL MUST NOT have a trailing slash (excepting root folders) + * - the case must match the expected value exactly + * An example of a valid URL is thus: + * imap://someuser%40google.com@imap.google.com/INBOX + * + * The contractid for this service is "@mozilla.org/mail/folder-lookup;1". + */ +[scriptable,uuid(f5ed5997-3945-48fc-a59d-d2191a94bb60)] +interface nsIFolderLookupService : nsISupports +{ + /** + * Returns a folder with the given URL or null if no such folder exists. + * + * @param aUrl The folder URL + */ + nsIMsgFolder getFolderForURL(in AUTF8String aUrl); + + /** + * Returns a folder with the given URL. + * Will happily create and return an invalid (unparented) folder. + * Will return null if aUrl is not a folder url. + * NOTE: don't use this for new code! It's here purely to help + * transition away from RDF-based folder creation. + * + * @param aUrl The folder URL + */ + nsIMsgFolder getOrCreateFolderForURL(in AUTF8String aUrl); + + /** + * Set pretty name again from original name on all folders, + * typically used when locale changes. + */ + void setPrettyNameFromOriginalAllFolders(); +}; + +%{C++ +#define NSIFLS_CONTRACTID "@mozilla.org/mail/folder-lookup;1" +%} diff --git a/comm/mailnews/base/public/nsIIncomingServerListener.idl b/comm/mailnews/base/public/nsIIncomingServerListener.idl new file mode 100644 index 0000000000..f2dd7faca5 --- /dev/null +++ b/comm/mailnews/base/public/nsIIncomingServerListener.idl @@ -0,0 +1,32 @@ +/* -*- 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 "nsIMsgIncomingServer.idl" + +[scriptable, uuid(E6B64B86-90CB-11d3-8B02-0060B0FC04D2)] +interface nsIIncomingServerListener : nsISupports { + /** + * Notification sent when a server is first loaded into the account manager. + * + * @param server Loaded server. + */ + void onServerLoaded(in nsIMsgIncomingServer server); + + /** + * Notification sent when a server is unloaded from the account manager. + * + * @param server Unloaded server. + */ + void onServerUnloaded(in nsIMsgIncomingServer server); + + /** + * Notification sent when a server hostname or username changes. + * + * @param server Server that was changed. + */ + void onServerChanged(in nsIMsgIncomingServer server); +}; diff --git a/comm/mailnews/base/public/nsIMailAuthModule.idl b/comm/mailnews/base/public/nsIMailAuthModule.idl new file mode 100644 index 0000000000..83c0bdca0d --- /dev/null +++ b/comm/mailnews/base/public/nsIMailAuthModule.idl @@ -0,0 +1,40 @@ +/* -*- 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" + +/** + * nsIAuthModule provides GSSAPI, NTLM authentications, but it is not + * scriptable. nsIMailAuthModule wraps nsIAuthModule and makes it easy to use in + * JavaScript. + * + * The contract id is: "@mozilla.org/mail/auth-module;1". + * + * @see nsIAuthModule + */ +[scriptable, uuid(9895e904-642e-11eb-bb69-6b87832ac976)] +interface nsIMailAuthModule : nsISupports { + + /** + * Initialize an auth module. This is a combination of + * nsIAuthModule::CreateInstance and nsIAuthModule::Init. The aType argument + * is passed to CreateInstance, other arguments are passed to Init. + */ + void init(in string aType, + in ACString aServiceName, + in unsigned long aServiceFlags, + in AString aDomain, + in AString aUsername, + in AString aPassword); + + /** + * Get the next token in a sequence of authentication steps. + * @param aInToken + * A base64 encoded string, usually a server challenge. + * @returns + * A base64 encoded string, usually a response to a server challenge. + */ + ACString getNextToken(in ACString aInToken); +}; diff --git a/comm/mailnews/base/public/nsIMailChannel.idl b/comm/mailnews/base/public/nsIMailChannel.idl new file mode 100644 index 0000000000..f5785e6e65 --- /dev/null +++ b/comm/mailnews/base/public/nsIMailChannel.idl @@ -0,0 +1,109 @@ +/* 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 "calIItipItem.idl" +#include "nsIPropertyBag2.idl" +#include "nsIMsgSMIMEHeaderSink.idl" + +interface nsIMailProgressListener; +interface nsIWebProgress; +interface nsIRequest; + +/** + * An interface that email-streaming channels can use to provide access to + * parsed message headers, message attachment info, and other metadata. + * The intended use is by QIing nsIChannel to nsIMailChannel. + */ +[scriptable, uuid(e4abdb58-54fa-4deb-8c43-714a69519b3a)] +interface nsIMailChannel : nsISupports { + /** + * Called by MIME emitters to add a header to this mail channel. + * Do not call otherwise. + */ + void addHeaderFromMIME(in AUTF8String name, in AUTF8String value); + + /** + * Header names for this request, available at onStopRequest. + * The number of header names is the same as the number of header values, + * and they are in the same order. + */ + readonly attribute Array<AUTF8String> headerNames; + + /** + * Header values for this request, available at onStopRequest. + */ + readonly attribute Array<AUTF8String> headerValues; + + /** + * Called by MIME emitters to add attachment info to this mail channel. + * Do not call otherwise. + */ + void handleAttachmentFromMIME(in AUTF8String contentType, + in AUTF8String url, + in AUTF8String displayName, + in AUTF8String uri, + in boolean aNotDownloaded); + + /** + * Called by MIME emitters to add attachment info to this mail channel. + * Do not call otherwise. + */ + void addAttachmentFieldFromMIME(in AUTF8String field, in AUTF8String value); + + /** + * Attachments for this request, available at onStopRequest. + */ + readonly attribute Array<nsIPropertyBag2> attachments; + + /** + * The character set of the message, according to the MIME parser. Not the + * character set of the channel, which should always be UTF-8. + */ + attribute AUTF8String mailCharacterSet; + + /** + * The method property of iMIP attachments, as determined by the MIME parser. + * Not to be set after onStopRequest. + */ + attribute AUTF8String imipMethod; + + /** + * The actual iMIP invitation, as created by CalMIMEConverter. + * Not to be set after onStopRequest. + */ + attribute calIItipItem imipItem; + + /** + * Set this in onStartRequest to receive security status notifications. + */ + attribute nsIMsgSMIMEHeaderSink smimeHeaderSink; + + /** + * A listener for progress events. This object must also implement + * nsISupportsWeakReference. + */ + attribute nsIMailProgressListener listener; +}; + +[scriptable, uuid(1286f969-1c20-422e-8247-233fe0d26ba5)] +interface nsIMailProgressListener : nsISupports { + /** + * Receive a notification from the parser that it has finished outputting + * the headers to the channel. + */ + void onHeadersComplete(in nsIMailChannel mailChannel); + + /** + * Receive a notification from the parser that it has finished outputting + * the message body to the channel. + */ + void onBodyComplete(in nsIMailChannel mailChannel); + + /** + * Receive a notification from the parser that it has finished outputting + * the attachment information to the channel. + */ + void onAttachmentsComplete(in nsIMailChannel mailChannel); +}; diff --git a/comm/mailnews/base/public/nsIMapiRegistry.idl b/comm/mailnews/base/public/nsIMapiRegistry.idl new file mode 100644 index 0000000000..c4a2c6d545 --- /dev/null +++ b/comm/mailnews/base/public/nsIMapiRegistry.idl @@ -0,0 +1,50 @@ +/* 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 mozIDOMWindowProxy; + +/** + * This interface provides support for registering Mozilla as the default + * Mail Client. This interface can also be used to get/set the user preference + * for the default Mail Client. + * + */ + +[scriptable, uuid(47D707C3-4369-46A6-A053-5118E12579D6)] +interface nsIMapiRegistry: nsISupports { + + /** This is set to TRUE if Mozilla is the default mail application + */ + attribute boolean isDefaultMailClient; + + /* Set to TRUE if Mozilla is the default news application */ + attribute boolean isDefaultNewsClient; + + /* Set to TRUE if we are the default feed/rss application */ + attribute boolean isDefaultFeedClient; + + /** This is set TRUE only once per session. + */ + readonly attribute boolean showDialog; + + /** This will bring the dialog asking the user if he/she wants to set + * Mozilla as default Mail Client. + * Call this only if Mozilla is not the default Mail client + */ + void showMailIntegrationDialog(in mozIDOMWindowProxy parentWindow); + + /* After being installed, when we first launch, make sure we add the correct + OS registry entries to make us show up as registered mail and news client + in the OS + */ + + void registerMailAndNewsClient(); +}; + +%{C++ +#define NS_IMAPIREGISTRY_CONTRACTID "@mozilla.org/mapiregistry;1" +#define NS_IMAPIREGISTRY_CLASSNAME "Mozilla MAPI Registry" +%} diff --git a/comm/mailnews/base/public/nsIMessenger.idl b/comm/mailnews/base/public/nsIMessenger.idl new file mode 100644 index 0000000000..437879782a --- /dev/null +++ b/comm/mailnews/base/public/nsIMessenger.idl @@ -0,0 +1,127 @@ +/* -*- 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 "nsrootidl.idl" +#include "nsIMsgWindow.idl" +#include "nsIMsgIdentity.idl" + +interface nsIMsgDBHdr; +interface mozIDOMWindowProxy; +interface nsITransactionManager; +interface nsIMsgMessageService; +interface nsIFile; +interface nsIUrlListener; + +[scriptable, uuid(01b967c8-b289-4e32-ad46-6eb7c89d4106)] +interface nsIMessenger : nsISupports { + + const long eUnknown = 0; + const long eDeleteMsg = 1; + const long eMoveMsg = 2; + const long eCopyMsg = 3; + const long eMarkAllMsg = 4; + + readonly attribute nsITransactionManager transactionManager; + + void setWindow(in mozIDOMWindowProxy ptr, in nsIMsgWindow msgWindow); + + boolean canUndo(); + boolean canRedo(); + unsigned long getUndoTransactionType(); + unsigned long getRedoTransactionType(); + void undo(in nsIMsgWindow msgWindow); + void redo(in nsIMsgWindow msgWindow); + + /** + * Saves a given message to a file or template. + * + * @param aURI The URI of the message to save + * @param aAsFile If true, save as file, otherwise save as a template + * @param aIdentity When saving as a template, this is used to determine + * the location to save the template to. + * @param aMsgFilename When saving as a file, the filename to save the + * message as, or the default filename for the file + * picker. + * @param aBypassFilePicker + * If not specified or false, this function will show + * a file picker when saving as a file. If true, no + * file picker will be shown. + */ + void saveAs(in AUTF8String aURI, in boolean aAsFile, + in nsIMsgIdentity aIdentity, in AString aMsgFilename, + [optional] in boolean aBypassFilePicker); + + /** + * Save the given messages as files in a folder - the user will be prompted + * for which folder to use. + * @param count message count + * @param filenameArray the filenames to use + * @param messageUriArray uris of the messages to save + */ + void saveMessages(in Array<AString> filenameArray, + in Array<AUTF8String> messageUriArray); + + void saveAttachment(in AUTF8String contentType, + in AUTF8String url, + in AUTF8String displayName, + in AUTF8String messageUri, + in boolean isExternalAttachment); + void saveAllAttachments(in Array<AUTF8String> contentTypeArray, + in Array<AUTF8String> urlArray, + in Array<AUTF8String> displayNameArray, + in Array<AUTF8String> messageUriArray); + + void saveAttachmentToFile(in nsIFile aFile, + in AUTF8String aUrl, + in AUTF8String aMessageUri, + in AUTF8String aContentType, + in nsIUrlListener aListener); + + /** + * For a single message and attachments, save these attachments to a file, and + * remove from the message. No warning windows will appear, so this is + * suitable for use in test and filtering. + * + * @param aDestFolder Folder to save files in + * @param aCount Number of attachments to save + * @param aContentTypeArray Content types of the attachments + * @param aUrlArray Urls for the attachments + * @param aDisplayNameArray Files names to save attachments to. Unique + * names will be created if needed. + * @param aMessageUriArray Uri for the source message + * @param aListener Listener to inform of start and stop of detach + */ + void detachAttachmentsWOPrompts(in nsIFile aDestFolder, + in Array<AUTF8String> aContentTypeArray, + in Array<AUTF8String> aUrlArray, + in Array<AUTF8String> aDisplayNameArray, + in Array<AUTF8String> aMessageUriArray, + in nsIUrlListener aListener); + + void detachAttachment(in AUTF8String contentType, + in AUTF8String url, + in AUTF8String displayName, + in AUTF8String messageUri, + in boolean saveFirst, + [optional] in boolean withoutWarning); + void detachAllAttachments(in Array<AUTF8String> contentTypeArray, + in Array<AUTF8String> urlArray, + in Array<AUTF8String> displayNameArray, + in Array<AUTF8String> messageUriArray, + in boolean saveFirst, + [optional] in boolean withoutWarning); + // saveAttachmentToFolder is used by the drag and drop code to drop an attachment to a destination folder + // We need to return the actual file path (including the filename). + nsIFile saveAttachmentToFolder(in AUTF8String contentType, + in AUTF8String url, + in AUTF8String displayName, + in AUTF8String messageUri, + in nsIFile aDestFolder); + + nsIMsgDBHdr msgHdrFromURI(in AUTF8String aUri); + + AString formatFileSize(in unsigned long long aPos, [optional] in boolean aUseKB); +}; diff --git a/comm/mailnews/base/public/nsIMessengerMigrator.idl b/comm/mailnews/base/public/nsIMessengerMigrator.idl new file mode 100644 index 0000000000..e5a74123d3 --- /dev/null +++ b/comm/mailnews/base/public/nsIMessengerMigrator.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(54818d98-1dd2-11b2-82aa-a9197f997503)] +interface nsIMessengerMigrator: nsISupports { + /* migrate old mailnews prefs to the 5.x world */ + void UpgradePrefs(); + + void createLocalMailAccount(in boolean migrating); +}; diff --git a/comm/mailnews/base/public/nsIMessengerOSIntegration.idl b/comm/mailnews/base/public/nsIMessengerOSIntegration.idl new file mode 100644 index 0000000000..99c5127701 --- /dev/null +++ b/comm/mailnews/base/public/nsIMessengerOSIntegration.idl @@ -0,0 +1,26 @@ +/* -*- 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" + +/** + * Common interfaces to integrate with different platforms, how they are + * implemented depends on the specific platform. + */ +[scriptable, uuid(d9e45fee-1dd1-11b2-938c-9147855ed837)] +interface nsIMessengerOSIntegration : nsISupports { + /** + * Update the unread count. + * @param unreadCount - The number of unread messages. + * @param unreadTooltip - The tooltip for the unread count. + */ + void updateUnreadCount(in unsigned long unreadCount, + in AString unreadTooltip); + + /** + * Use this to do necessary clean up on exit, e.g. reset the badge/tray icon. + */ + void onExit(); +}; diff --git a/comm/mailnews/base/public/nsIMessengerWindowService.idl b/comm/mailnews/base/public/nsIMessengerWindowService.idl new file mode 100644 index 0000000000..9056a734a8 --- /dev/null +++ b/comm/mailnews/base/public/nsIMessengerWindowService.idl @@ -0,0 +1,17 @@ +/* -*- 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" + +[scriptable, uuid(113a1a5a-1dd2-11b2-b1b7-a85ccc06c8ce)] +interface nsIMessengerWindowService : nsISupports { + /** + * @param aWindowType the type of window you want to create. i.e. "mail:3pane" + * @param aFolderURI the folder resource you want pre-selected (if any) + * @param aMsgKey a particular message you may want selected in that folder (if any) + */ + void openMessengerWindowWithUri(in string aWindowType, in AUTF8String aFolderURI, in nsMsgKey aMsgKey); +}; diff --git a/comm/mailnews/base/public/nsIMessengerWindowsIntegration.idl b/comm/mailnews/base/public/nsIMessengerWindowsIntegration.idl new file mode 100644 index 0000000000..86f33dd651 --- /dev/null +++ b/comm/mailnews/base/public/nsIMessengerWindowsIntegration.idl @@ -0,0 +1,16 @@ +/* -*- 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/. */ + +interface mozIDOMWindowProxy; + +#include "nsIBaseWindow.idl" +#include "nsIMessengerOSIntegration.idl" + +[scriptable, uuid(e14eb9fe-e05e-4b78-bd31-5b7e1497f91b)] +interface nsIMessengerWindowsIntegration : nsIMessengerOSIntegration { + void hideWindow(in nsIBaseWindow aWindow); + + void showWindow(in mozIDOMWindowProxy aWindow); +}; diff --git a/comm/mailnews/base/public/nsIMsgAccount.idl b/comm/mailnews/base/public/nsIMsgAccount.idl new file mode 100644 index 0000000000..aa59222824 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgAccount.idl @@ -0,0 +1,86 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "nsIMsgIncomingServer.idl" +#include "nsIMsgIdentity.idl" + +/** + * An account consists of an incoming server and one or more + * outgoing identities. An account is identified by a key, + * which is the <account> string in the account preferences, + * such as in mail.account.<account>.identities. + */ + +[scriptable, uuid(84181351-4ec8-4ca8-8439-5c68cc591177)] +interface nsIMsgAccount : nsISupports { + + /// Internal key identifying itself + attribute ACString key; + + /// Incoming server stuff + attribute nsIMsgIncomingServer incomingServer; + + /// Outgoing identity list (array of nsIMsgIdentity's) + readonly attribute Array<nsIMsgIdentity> identities; + + /// The default identity for this account. + attribute nsIMsgIdentity defaultIdentity; + + /// Add a new identity to this account + void addIdentity(in nsIMsgIdentity identity); + + /// Remove an identity from this account + void removeIdentity(in nsIMsgIdentity identity); + + /// Clear all user preferences associated with an account. + void clearAllValues(); + + /// Name in javascript + AString toString(); + + /** + * Create the server, with error returns. + * + * Normally each valid account also has a valid server. + * + * If an extension that creates a server type failed to load, then we + * may have an existing account without a valid server. We don't want + * to simply delete that account, as that would make the user re-enter + * all of the account information after what may be a temporary + * update glitch. But we also don't want to leave junk lying around + * forever. So what we do is note the time when we first noticed + * that the server was unavailable. After a period of time set + * in a preference, if the server is still unavailable then delete + * the associated account. + * + * Accounts with invalid server are not shown in any way by the account + * manager. But if the server becomes available (for example if an extension + * is loaded), then the account will reappear when accounts are loaded. + * + * Preference definitions: + * + * mail.server.serverN.secondsToLeaveUnavailable + * mail.server.serverN.timeFoundUnavailable + * + * secondsToLeaveUnavailable: is set by the extension to indicate the + * delay, in seconds, between first detection that a server is + * unavailable, and the time it can be deleted. This should be set + * by the extension when the server is created. If missing, treat as 0. + * A typical value would be 2592000 (30 days)(24 hr/day)(3600 seconds/hr) + * + * timeFoundUnavailable: is set by core code the first time that a + * server is detected as unavailable, using now() converted to seconds. + * If that time + secondsToLeaveUnavailable is exceeded, core code may + * delete the server and its associated account (though for now we default + * to the previous behavior, which is to just delete the account). + * + * @throws NS_ERROR_NOT_AVAILABLE if the server component type could not + * be created + * NS_ERROR_ALREADY_INITIALIZED if the server is already created + * (Other errors may also be possible) + */ + void createServer(); +}; diff --git a/comm/mailnews/base/public/nsIMsgAccountManager.idl b/comm/mailnews/base/public/nsIMsgAccountManager.idl new file mode 100644 index 0000000000..39f4aecd79 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgAccountManager.idl @@ -0,0 +1,256 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "nsIMsgAccount.idl" +#include "nsIMsgIdentity.idl" +#include "nsIMsgIncomingServer.idl" +#include "nsIIncomingServerListener.idl" +#include "nsIMsgFolder.idl" + +interface nsIMsgFolderCache; +interface nsIFolderListener; + +[scriptable, uuid(d5ab0eea-49c5-42f2-b2e6-8ad306606d8b)] +interface nsIMsgAccountManager : nsISupports { + + ACString getUniqueAccountKey(); + + nsIMsgAccount createAccount(); + /* + * Return the account with the provided key, or null if none found. + */ + nsIMsgAccount getAccount(in ACString key); + + /** + * Removes the account from the list of accounts. + * + * @param aAccount the account to remove + * @param aRemoveFiles remove data directory (local directory) of this account + */ + void removeAccount(in nsIMsgAccount aAccount, [optional] in boolean aRemoveFiles); + + /* + * creates a new identity and assigns it a new, unique "key" + */ + nsIMsgIdentity createIdentity(); + + /** + * Scan the preferences to find a unique server key. + */ + ACString getUniqueServerKey(); + + /* + * creates a new server and assigns it a new, unique "key" + * the given type will be used to construct a ContractID + * + * @param type "imap", "pop3", "nntp", "none", "rss", "generic" + * (suffix of contract ID @mozilla.org/messenger/server;1?type= ) + */ + nsIMsgIncomingServer createIncomingServer(in ACString username, + in ACString hostname, + in ACString type); + + /** + * Removes the server from the list of servers + * + * @param aServer server to remove + * @param aRemoveFiles remove directory from profile + * + * @throws NS_ERROR_FAILURE if server not found + */ + void removeIncomingServer(in nsIMsgIncomingServer aServer, + in boolean aRemoveFiles); + /* + * get the identity with the given key + * if the identity does not exist, it will be created + */ + nsIMsgIdentity getIdentity(in ACString key); + + /* + * Gets the existing incoming server with the given key + * if the server's type does not exist in the preference, + * an error is returned/thrown + */ + nsIMsgIncomingServer getIncomingServer(in ACString key); + + /* account list stuff */ + + /** + * Returns the account that was marked as the default one. + * Only some server types can serve as default account. + * If there is no such account, null is returned. + * You can only set the defaultAccount to an + * account already in the account manager. + */ + attribute nsIMsgAccount defaultAccount; + + /** + * Ordered list of all accounts, by the order they are in the prefs. + * Accounts with hidden servers are not returned. + * array of nsIMsgAccount + */ + readonly attribute Array<nsIMsgAccount> accounts; + + /* list of all identities in all accounts + * array of nsIMsgIdentity + */ + readonly attribute Array<nsIMsgIdentity> allIdentities; + + /* list of all servers in all accounts, except for hidden and IM servers + * array of nsIMsgIncomingServer + */ + readonly attribute Array<nsIMsgIncomingServer> allServers; + + /* summary of summary files folder cache */ + readonly attribute nsIMsgFolderCache folderCache; + + /* are we shutting down */ + readonly attribute boolean shutdownInProgress; + + /** + * for preventing unauthenticated users from seeing header information + */ + attribute boolean userNeedsToAuthenticate; + /* + * search for the server with the given username, hostname, and type + * the type is the same as is specified in the preferences, + * i.e. "imap", "pop3", "none", or "nntp" + */ + nsIMsgIncomingServer findServer(in ACString userName, + in ACString hostname, + in ACString type, + [optional] in long port); + + /* + * search for the server with the given uri + * an analog to FindServer() + */ + nsIMsgIncomingServer findServerByURI(in nsIURI aURI); + + /** + * find the index of this server in the (ordered) list of accounts + */ + long FindServerIndex(in nsIMsgIncomingServer server); + + /** + * Finds an account for the given incoming server. + * + * @param server An incoming server to find the account for. + * @return If found, the nsIMsgAccount representing the account found. + * Otherwise returns null. + */ + nsIMsgAccount FindAccountForServer(in nsIMsgIncomingServer server); + + /* given a server, return all identities in accounts that have this server + * returns an array of nsIMsgIdentity + */ + Array<nsIMsgIdentity> getIdentitiesForServer(in nsIMsgIncomingServer server); + + /** + * given a server, return the first identity in accounts that have this server + */ + nsIMsgIdentity getFirstIdentityForServer(in nsIMsgIncomingServer server); + + /* given an identity, return all servers in accounts that have + * this identity + * returns an array of nsIMsgIncomingServer + */ + Array<nsIMsgIncomingServer> getServersForIdentity(in nsIMsgIdentity identity); + + /* there is a special server "Local Folders" that is guaranteed to exist. + * this will allow you to get */ + attribute nsIMsgIncomingServer localFoldersServer; + + // Create the account for that special server. + void createLocalMailAccount(); + + /** + * Kicks off the creation of all accounts. You do not need to call this and + * all accounts should be loaded lazily if you use any of the above. + */ + void loadAccounts(); + + /** Frees all the account manager data structures. */ + void unloadAccounts(); + + /** + * When the server for an account could not be loaded, typically because the + * extension providing it could not be loaded, it is deactivated for a period + * of time as documented in nsIMsgAccount.idl. The server is normally only + * rechecked at startup but this function can be used to recheck all servers + * at any time to avoid having to restart to reactivate an account. + */ + void reactivateAccounts(); + + void setSpecialFolders(); + + void loadVirtualFolders(); + + void WriteToFolderCache(in nsIMsgFolderCache folderCache); + void saveVirtualFolders(); + void closeCachedConnections(); + void shutdownServers(); + + void CleanupOnExit(); + void SetFolderDoingEmptyTrash(in nsIMsgFolder folder); + boolean GetEmptyTrashInProgress(); + + void SetFolderDoingCleanupInbox(in nsIMsgFolder folder); + boolean GetCleanupInboxInProgress(); + + void addRootFolderListener(in nsIFolderListener listener); + void removeRootFolderListener(in nsIFolderListener listener); + + // these are going away in favor of add/removeRootFolderListener + void addIncomingServerListener(in nsIIncomingServerListener serverListener); + void removeIncomingServerListener(in nsIIncomingServerListener serverListener); + + // these are going away in favor of nsIMsgFolder::NotifyEvent(in ACString event); + // XXX what does this mean? There is no such function yet. + void notifyServerLoaded(in nsIMsgIncomingServer server); + void notifyServerUnloaded(in nsIMsgIncomingServer server); + void notifyServerChanged(in nsIMsgIncomingServer server); + + // force account info out to prefs file + void saveAccountInfo(); + + ACString getChromePackageName(in ACString aExtensionName); + + /// Enumerate all incoming servers and their folders and return in an array. + readonly attribute Array<nsIMsgFolder> allFolders; + + /** + * Iterates over all folders looking for one with the passed in path, + * and returns the uri for the matching folder. In the future, + * the folder lookup service will provide this functionality. + * + * @param aLocalPath path of the folder whose uri we want. + * @return the URI of the folder that corresponds to aLocalPath + */ + AUTF8String folderUriForPath(in nsIFile aLocalPath); + + // Used to sort servers (accounts) for e.g. the folder pane + long getSortOrder(in nsIMsgIncomingServer server); + + /** + * Sets new order of accounts. + * + * @param accountKeys - Account keys in the new preferred order. + */ + void reorderAccounts(in Array<ACString> accountKeys); +}; + +%{C++ +#define MAILNEWS_ACCOUNTMANAGER_EXTENSIONS "mailnews-accountmanager-extensions" +%} + +[scriptable, uuid(70032DE0-CD59-41ba-839D-FC1B65367EE7)] +interface nsIMsgAccountManagerExtension : nsISupports +{ + readonly attribute ACString name; // examples: mdn + boolean showPanel(in nsIMsgIncomingServer server); + readonly attribute ACString chromePackageName; // example: messenger, chrome://messenger/content/am-mdn.xhtml and chrome://messenger/locale/am-mdn.properties +}; diff --git a/comm/mailnews/base/public/nsIMsgAsyncPrompter.idl b/comm/mailnews/base/public/nsIMsgAsyncPrompter.idl new file mode 100644 index 0000000000..0e1a68846b --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgAsyncPrompter.idl @@ -0,0 +1,79 @@ +/* -*- 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 nsIMsgAsyncPromptListener; + +/** + * The nsIMsgAsyncPrompter is intended to provide a way to make asynchronous + * message prompts into synchronous ones - so that the user is only prompted + * with one at a time. + */ +[scriptable, uuid(15f67d0f-947a-4a1e-8f72-6ab7162b4b9c)] +interface nsIMsgAsyncPrompter : nsISupports { + /** + * Queues an async prompt request. If there are none queued then this will be + * actioned straight away, otherwise the prompt will be queued for action + * once previous prompt(s) have been cleared. + * + * Queued prompts using the same aKey may be amalgamated into one prompt to + * save repeated prompts to the user. + * + * @param aKey A key to determine whether or not the queued prompts can + * be combined. + * @param aPromptImmediately If the user is retrying a failed password, we + * need to prompt right away, even if there is a + * prompt up, or prompts queued up. Note that + * immediately may not be synchronously, on OS/X. + * @param aCaller An nsIMsgAsyncPromptListener to call back to when the prompt + * is ready to be made. + */ + void queueAsyncAuthPrompt(in ACString aKey, in boolean aPromptImmediately, + in nsIMsgAsyncPromptListener aCaller); +}; + +[scriptable, function, uuid(acca94c9-378e-46e3-9a91-6655bf9c91a3)] +interface nsIMsgAsyncPromptCallback : nsISupports { + /** + * Called when an auth result is available. Can be passed as a function. + * + * @param aResult True if there is auth information available following the + * prompt, false otherwise. + */ + void onAuthResult(in boolean aResult); +}; + +/** + * This is used in combination with nsIMsgAsyncPrompter. + */ +[scriptable, uuid(fb5307a3-39d0-462e-92c8-c5c288a2612f)] +interface nsIMsgAsyncPromptListener : nsISupports { + /** + * This method has been deprecated, please use onPromptStartAsync instead. + */ + boolean onPromptStart(); + + /** + * Called when the listener should do its prompt. This can happen + * synchronously or asynchronously, but in any case when done the callback + * method should be called. + * + * @param aCallback The callback to execute when auth prompt has completed. + */ + void onPromptStartAsync(in nsIMsgAsyncPromptCallback aCallback); + + /** + * Called in the case that the queued prompt was combined with another and + * there is now authentication information available. + */ + void onPromptAuthAvailable(); + + /** + * Called in the case that the queued prompt was combined with another but + * the prompt was canceled. + */ + void onPromptCanceled(); +}; diff --git a/comm/mailnews/base/public/nsIMsgBiffManager.idl b/comm/mailnews/base/public/nsIMsgBiffManager.idl new file mode 100644 index 0000000000..168ce1ace1 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgBiffManager.idl @@ -0,0 +1,18 @@ +/* -*- 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 "nsIMsgIncomingServer.idl" + +[scriptable, uuid(17275D52-1622-11d3-8A84-0060B0FC04D2)] +interface nsIMsgBiffManager : nsISupports { + + void init(); + void addServerBiff(in nsIMsgIncomingServer server); + void removeServerBiff(in nsIMsgIncomingServer server); + void forceBiff(in nsIMsgIncomingServer server); + void forceBiffAll(); + void shutdown(); +}; diff --git a/comm/mailnews/base/public/nsIMsgContentPolicy.idl b/comm/mailnews/base/public/nsIMsgContentPolicy.idl new file mode 100644 index 0000000000..882a39b49b --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgContentPolicy.idl @@ -0,0 +1,35 @@ +/* -*- 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" + +[scriptable, uuid(c29b2fd3-64d0-4083-a096-c20a9b847a99)] + +/** + * This interface provide functions which help extension developers + * add their customized schema to the exposed protocls of nsMsgContentPolicy. + * By default, a list of existing protocols (such as imap and nntp) + * are allowed to process urls locally, while non-matching urls are required + * to be processed as external. + * This interface allows additional protocols to be added to + * the list of protocols that are processed locally. + * Typically this would be used in cases where a new messaging protocol + * is being added by an extension. + */ +interface nsIMsgContentPolicy : nsISupports { + /** + * Add the specific aScheme to nsMsgContentPolicy's exposed protocols. + * + * @param aScheme scheme who will be added to nsMsgContentPolicy's exposed protocols + */ + void addExposedProtocol(in ACString aScheme); + + /** + * Remove the specific aScheme from nsMsgContentPolicy's exposed protocols. + * + * @param aScheme scheme who will be removed from nsMsgContentPolicy's exposed protocols + */ + void removeExposedProtocol(in ACString aScheme); +}; diff --git a/comm/mailnews/base/public/nsIMsgCopyService.idl b/comm/mailnews/base/public/nsIMsgCopyService.idl new file mode 100644 index 0000000000..b28ee9170c --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgCopyService.idl @@ -0,0 +1,116 @@ +/* -*- 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/. */ + +#include "nsrootidl.idl" +#include "nsISupports.idl" +#include "nsIMsgFolder.idl" +#include "nsIMsgCopyServiceListener.idl" + +interface nsIMsgDBHdr; +interface nsIMsgWindow; +interface nsIFile; + +/** + * nsIMsgCopyService is a central point for kicking off message and folder + * copy/move operations. + * Each operation is queued up and executed in sequence. The actual work is + * handled by folder code in an asynchronous fashion. The folder indicates + * completion by calling notifyCompletion(). + * + * If the operation was initiated with a non-null nsIMsgCopyServiceListener, + * its OnStartCopy() and OnStopCopy() methods will be called when the + * operation begins/ends. Any errors are communicated via the result code + * parameter passed to OnStopCopy(). + */ +[scriptable, uuid(f21e428b-73c5-4607-993b-d37325b33722)] +interface nsIMsgCopyService : nsISupports { + + /** + * Copies or moves existing messages from source folder to destination folder. + * + * @param srcFolder Source folder of an operation. + * @param messages The array of nsIMsgHdrs in source folder which will be moved/copied. + * @param dstFolder Destination folder of operation. + * @param isMove false for copy operation, true for move operation. + * @param listener Listener which receive operation notifications + * @param msgWindow Window for notification callbacks, can be null. + * @param allowUndo Specifies if this operation will be done as an transaction + * that can be undone. + */ + void copyMessages(in nsIMsgFolder srcFolder, + in Array<nsIMsgDBHdr> messages, + in nsIMsgFolder dstFolder, + in boolean isMove, + in nsIMsgCopyServiceListener listener, + in nsIMsgWindow msgWindow, + in boolean allowUndo); + + /** + * Copies or moves a folder into an existing destination folder. + * + * @param srcFolder The nsIMsgFolder which will be moved/copied. + * @param dstFolder The destination folder of operation. + * @param isMove false for copy operation, true for move operation. + * @param listener Listener which receive operation notifications. + * @param msgWindow Window for notification callbacks, can be null. + */ + void copyFolder(in nsIMsgFolder srcFolder, + in nsIMsgFolder dstFolder, + in boolean isMove, + in nsIMsgCopyServiceListener listener, + in nsIMsgWindow msgWindow); + + /** + * Copies message in rfc format from file to folder. + * + * @param aFile A file which contains message in rfc format which + * will copied to destFolder. + * @param dstFolder Destination folder where a message will be copied. + * @param msgToReplace Header which identifies a message to use as a source + * of message properties, or null. For example, when + * deleting an attachment, the processed message is + * stored in a file, but the metadata should be copied + * from the original message. This method will NOT delete + * the original message. + * @param isDraftOrTemplate Specifies whether a message is a stored in draft + * folder or not. If is true listener should + * implement GetMessageId and return unique id for + * message in destination folder. This is important + * for IMAP servers which doesn't support uidplus. + * If destination folder contains message with the + * same message-id then it is possible that listener + * get wrong message key in callback + * nsIMsgCopyServiceListener::SetMessageKey. + * @param aMsgFlags Message flags which will be set after message is + * copied + * @param aMsgKeywords Keywords which will be set for newly copied + * message. + * @param listener Listener which receive copy notifications. + * @param msgWindow Window for notification callbacks, can be null. + */ + void copyFileMessage(in nsIFile aFile, + in nsIMsgFolder dstFolder, + in nsIMsgDBHdr msgToReplace, + in boolean isDraftOrTemplate, + in unsigned long aMsgFlags, + in ACString aMsgKeywords, + in nsIMsgCopyServiceListener listener, + in nsIMsgWindow msgWindow); + + /** + * Notify the message copy service that the destination folder has finished + * it's messages copying operation so that the copy service can continue + * copying the rest of the messages if there are more to copy with. + * aSupport and dstFolder uniquely identify a copy service request. + * + * @param aSupport The originator of CopyMessages or copyFileMessage; it can + * be either a nsIMsgFolder or a nsIFile + * @param dstFolder The destination folder which performs the copy operation + * @param result The result of the copy operation + */ + void notifyCompletion(in nsISupports aSupport, + in nsIMsgFolder dstFolder, + in nsresult result); +}; diff --git a/comm/mailnews/base/public/nsIMsgCopyServiceListener.idl b/comm/mailnews/base/public/nsIMsgCopyServiceListener.idl new file mode 100644 index 0000000000..0c915c8d38 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgCopyServiceListener.idl @@ -0,0 +1,55 @@ +/* -*- 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 "nsrootidl.idl" +#include "nsISupports.idl" +#include "MailNewsTypes2.idl" + +[scriptable, uuid(da6b9843-5464-4630-b121-c5970aa3d6ed)] +interface nsIMsgCopyServiceListener : nsISupports { + + /** + * Notify the observer that the message has started to be copied. This + * method is called only once, at the beginning of a message + * copyoperation. + */ + void OnStartCopy(); + + /** + * Notify the observer that progress as occurred for the message copy + * aProgress - + * aProgressMax - + */ + void OnProgress(in uint32_t aProgress, + in uint32_t aProgressMax); + + /** + * Setting newly created message key. This method is tailored specifically + * for nsIMsgCopyService::copyFileMessage() when saving Drafts/Templates. + * We need to have a way to inform the client what's the key of the newly + * created message. + * aKey - + */ + void SetMessageKey(in nsMsgKey aKey); + + /** + * Getting the file message message ID. This method is tailored + * specifically for nsIMsgCopyService::copyFileMessage() when saving + * Drafts/Templates. In order to work with imap server which doesn't + * support uidplus we have to use search command to retrieve the key of + * newly created message. Message ID generated by the compose guarantee its + * uniqueness. + * aMessageId - + */ + void GetMessageId(out ACString aMessageId); + + /** + * Notify the observer that the message copied operation has completed. + * This method is called regardless of whether the the operation was + * successful. + * aStatus - indicate whether the operation was succeeded + */ + void OnStopCopy(in nsresult aStatus); +}; diff --git a/comm/mailnews/base/public/nsIMsgCustomColumnHandler.idl b/comm/mailnews/base/public/nsIMsgCustomColumnHandler.idl new file mode 100644 index 0000000000..1b5287c56e --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgCustomColumnHandler.idl @@ -0,0 +1,40 @@ +/* -*- 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 "nsITreeView.idl" + +interface nsIMsgDBHdr; + + /* //TODO JavaDoc + When implementing a js custom column handler (of type nsITreeView) you must implement the following + functions: + 1. isEditable + 2. GetCellProperties + 3. GetImageSrc + 4. GetCellText + 5. CycleCell + 6. GetSortStringForRow + 7. GetSortLongForRow + 8. isString + + You can, at your option, implement + 9. GetRowProperties. + + With Bug 1192696, Grouped By Sort was implemented for custom columns. + Implementers should consider that the value returned by GetSortStringForRow + will be displayed in the grouped header row, as well as be used as the + sort string. + + If implementing a c++ custom column handler, you must define all + nsITreeView and nsIMsgCustomColumnHandler methods. + */ + +[scriptable, uuid(00f75b13-3ac4-4a17-a8b9-c6e4dd1b3f32)] +interface nsIMsgCustomColumnHandler : nsITreeView +{ + AString getSortStringForRow(in nsIMsgDBHdr aHdr); + unsigned long getSortLongForRow(in nsIMsgDBHdr aHdr); + boolean isString(); +}; diff --git a/comm/mailnews/base/public/nsIMsgDBView.idl b/comm/mailnews/base/public/nsIMsgDBView.idl new file mode 100644 index 0000000000..1c824c58f9 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgDBView.idl @@ -0,0 +1,558 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "MailNewsTypes2.idl" + +interface nsIMsgFolder; +interface nsIMsgWindow; +interface nsIMessenger; +interface nsIMsgDBHdr; +interface nsIMsgThread; +interface nsIMsgDBViewCommandUpdater; +interface nsIMsgJSTree; +interface nsIMsgDatabase; +interface nsIMsgSearchSession; +interface nsIMsgEnumerator; +interface nsIMsgCustomColumnHandler; + +typedef long nsMsgViewNotificationCodeValue; +typedef long nsMsgViewCommandCheckStateValue; +typedef long nsMsgViewCommandTypeValue; +typedef long nsMsgNavigationTypeValue; + +[scriptable, uuid(682a18be-fd18-11d4-a5be-0060b0fc04b7)] +interface nsMsgViewSortOrder : nsISupports +{ + const nsMsgViewSortOrderValue none = 0; + const nsMsgViewSortOrderValue ascending = 1; + const nsMsgViewSortOrderValue descending = 2; +}; + +[scriptable, uuid(f28a1cdf-06c3-4e98-8f66-f49991670071)] +interface nsMsgViewType : nsISupports { + const nsMsgViewTypeValue eShowAllThreads = 0; + const nsMsgViewTypeValue eShowThreadsWithUnread = 2; + const nsMsgViewTypeValue eShowWatchedThreadsWithUnread = 3; + const nsMsgViewTypeValue eShowQuickSearchResults = 4; + const nsMsgViewTypeValue eShowVirtualFolderResults = 5; + const nsMsgViewTypeValue eShowSearch = 6; +}; + +[scriptable, uuid(64852276-1dd2-11b2-8103-afe12002c053)] +interface nsMsgViewFlagsType : nsISupports +{ + /** + * flags for GetViewFlags + */ + const nsMsgViewFlagsTypeValue kNone = 0x0; + const nsMsgViewFlagsTypeValue kThreadedDisplay = 0x1; + const nsMsgViewFlagsTypeValue kShowIgnored = 0x8; + const nsMsgViewFlagsTypeValue kUnreadOnly = 0x10; + const nsMsgViewFlagsTypeValue kExpandAll = 0x20; + const nsMsgViewFlagsTypeValue kGroupBySort = 0x40; +}; + +[scriptable, uuid(b94fc200-3008-420a-85c7-67842f133ef8)] +interface nsMsgViewSortType : nsISupports +{ + const nsMsgViewSortTypeValue byNone = 0x11; /* not sorted */ + const nsMsgViewSortTypeValue byDate = 0x12; + const nsMsgViewSortTypeValue bySubject = 0x13; + const nsMsgViewSortTypeValue byAuthor = 0x14; + const nsMsgViewSortTypeValue byId = 0x15; + const nsMsgViewSortTypeValue byThread = 0x16; + const nsMsgViewSortTypeValue byPriority = 0x17; + const nsMsgViewSortTypeValue byStatus = 0x18; + const nsMsgViewSortTypeValue bySize = 0x19; + const nsMsgViewSortTypeValue byFlagged = 0x1a; + const nsMsgViewSortTypeValue byUnread = 0x1b; + const nsMsgViewSortTypeValue byRecipient = 0x1c; + const nsMsgViewSortTypeValue byLocation = 0x1d; + const nsMsgViewSortTypeValue byTags = 0x1e; + const nsMsgViewSortTypeValue byJunkStatus = 0x1f; + const nsMsgViewSortTypeValue byAttachments = 0x20; + const nsMsgViewSortTypeValue byAccount = 0x21; + const nsMsgViewSortTypeValue byCustom = 0x22; + const nsMsgViewSortTypeValue byReceived = 0x23; + const nsMsgViewSortTypeValue byCorrespondent = 0x24; +}; + +[scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)] +interface nsMsgViewNotificationCode : nsISupports +{ + const nsMsgViewNotificationCodeValue none = 0; + /* No change; this call is just being used to potentially nest other sets of calls + inside it. The "where" and "num" parameters are unused. + */ + const nsMsgViewNotificationCodeValue insertOrDelete = 1; + /* Some lines have been inserted or deleted. + The "where" parameter will indicate the first line that has been added or + removed; the "num" parameter will indicate how many lines, and will be positive on + an insertion and negative on a deletion. + */ + const nsMsgViewNotificationCodeValue changed = 2; + /* Some lines have had their contents changed (e.g., messages have been marked read + or something.) "where" indicates the first line with a change; "num" indicates + how many changed. + */ + const nsMsgViewNotificationCodeValue all = 4; + /* Everything changed. We're now not displaying anything like what we were; we + probably opened a new folder or something. The FE needs to forget anything it ever knew + about what was being displayed, and start over. The "where" and "num" parameters are + unused. + */ +}; + +[scriptable, uuid(4ec9248e-0108-11d5-a5be-0060b0fc04b7)] +interface nsMsgViewCommandCheckState : nsISupports +{ + const nsMsgViewCommandCheckStateValue notUsed = 0; + const nsMsgViewCommandCheckStateValue checked = 1; + const nsMsgViewCommandCheckStateValue unchecked = 2; +}; + +[scriptable, uuid(ad36e6cc-0109-11d5-a5be-0060b0fc04b7)] +interface nsMsgViewCommandType : nsISupports +{ + const nsMsgViewCommandTypeValue markMessagesRead = 0; + const nsMsgViewCommandTypeValue markMessagesUnread = 1; + const nsMsgViewCommandTypeValue toggleMessageRead = 2; + + const nsMsgViewCommandTypeValue flagMessages = 3; + const nsMsgViewCommandTypeValue unflagMessages = 4; + + const nsMsgViewCommandTypeValue toggleThreadWatched = 6; + + const nsMsgViewCommandTypeValue deleteMsg = 7; + const nsMsgViewCommandTypeValue deleteNoTrash = 8; + const nsMsgViewCommandTypeValue markThreadRead = 9; + const nsMsgViewCommandTypeValue markAllRead = 10; + const nsMsgViewCommandTypeValue expandAll = 11; + const nsMsgViewCommandTypeValue collapseAll = 12; + + const nsMsgViewCommandTypeValue copyMessages = 13; + const nsMsgViewCommandTypeValue moveMessages = 14; + + const nsMsgViewCommandTypeValue selectAll = 15; + const nsMsgViewCommandTypeValue downloadSelectedForOffline = 16; + const nsMsgViewCommandTypeValue downloadFlaggedForOffline = 17; + + const nsMsgViewCommandTypeValue selectThread = 18; + const nsMsgViewCommandTypeValue selectFlagged = 19; + const nsMsgViewCommandTypeValue cmdRequiringMsgBody = 20; + const nsMsgViewCommandTypeValue label0 = 21; + const nsMsgViewCommandTypeValue label1 = 22; + const nsMsgViewCommandTypeValue label2 = 23; + const nsMsgViewCommandTypeValue label3 = 24; + const nsMsgViewCommandTypeValue label4 = 25; + const nsMsgViewCommandTypeValue label5 = 26; + const nsMsgViewCommandTypeValue lastLabel = 26; + + const nsMsgViewCommandTypeValue junk = 27; + const nsMsgViewCommandTypeValue unjunk = 28; + const nsMsgViewCommandTypeValue undeleteMsg = 29; + + const nsMsgViewCommandTypeValue applyFilters = 30; + const nsMsgViewCommandTypeValue runJunkControls = 31; + const nsMsgViewCommandTypeValue deleteJunk = 32; +}; + +[scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)] +interface nsMsgNavigationType : nsISupports +{ + const nsMsgNavigationTypeValue firstMessage = 1; + const nsMsgNavigationTypeValue nextMessage = 2; + const nsMsgNavigationTypeValue previousMessage = 3; + const nsMsgNavigationTypeValue lastMessage = 4; + /** + * must match nsMsgViewCommandTypeValue toggleThreadKilled + */ + const nsMsgNavigationTypeValue toggleThreadKilled = 5; + const nsMsgNavigationTypeValue firstUnreadMessage = 6; + const nsMsgNavigationTypeValue nextUnreadMessage = 7; + const nsMsgNavigationTypeValue previousUnreadMessage = 8; + const nsMsgNavigationTypeValue lastUnreadMessage = 9; + const nsMsgNavigationTypeValue nextUnreadThread = 10; + const nsMsgNavigationTypeValue nextUnreadFolder = 11; + const nsMsgNavigationTypeValue nextFolder = 12; + const nsMsgNavigationTypeValue readMore = 13; + /** + * Go back to the previous visited message + */ + const nsMsgNavigationTypeValue back = 15; + /** + * Go forward to the previous visited message + */ + const nsMsgNavigationTypeValue forward = 16; + const nsMsgNavigationTypeValue firstFlagged = 17; + const nsMsgNavigationTypeValue nextFlagged = 18; + const nsMsgNavigationTypeValue previousFlagged = 19; + const nsMsgNavigationTypeValue firstNew = 20; + const nsMsgNavigationTypeValue editUndo = 21; + const nsMsgNavigationTypeValue editRedo = 22; + const nsMsgNavigationTypeValue toggleSubthreadKilled = 23; +}; + +/* + * The contract ID for this component is @mozilla.org/msgDBView/msgDBViewService;1. + */ +[scriptable, uuid(bcf6afbe-7d4f-11ec-9092-eb4fed0a5aaa)] +interface nsIMsgDBViewService : nsISupports +{ + /** + * JS-callable service to initialize static variables in nsMsgDBView.cpp + * upon initialization or when locale changes. + */ + void initializeDBViewStrings(); +}; + +[scriptable, uuid(fe8a2326-4dd0-11e5-8b8a-206a8aa7a25c)] +interface nsIMsgDBView : nsISupports +{ + /** A shim of XULTreeElement, with only the methods called by nsMsgDBView. */ + void setJSTree(in nsIMsgJSTree tree); + + void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count); + void openWithHdrs(in nsIMsgEnumerator aHeaders, in nsMsgViewSortTypeValue aSortType, + in nsMsgViewSortOrderValue aSortOrder, + in nsMsgViewFlagsTypeValue aViewFlags, out long aCount); + void close(); + + void init(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater); + + void sort(in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder); + + void doCommand(in nsMsgViewCommandTypeValue command); + void doCommandWithFolder(in nsMsgViewCommandTypeValue command, in nsIMsgFolder destFolder); + void getCommandStatus(in nsMsgViewCommandTypeValue command, out boolean selectable_p, + out nsMsgViewCommandCheckStateValue selected_p); + void applyCommandToIndices(in nsMsgViewCommandTypeValue command, + in Array<nsMsgViewIndex> selection); + + readonly attribute nsMsgViewTypeValue viewType; + attribute nsMsgViewFlagsTypeValue viewFlags; + /** Assigning to this value does not induce a sort; use the sort() method! */ + attribute nsMsgViewSortTypeValue sortType; + readonly attribute nsMsgViewSortOrderValue sortOrder; + /** + * Reflects the current secondary sort when a secondary sort is in effect. + * If the primary sort is by date or id, the value of this attribute is moot. + * Assigning to this value does not induce a sort; use the sort() method once + * to set your secondary sort, then use it again to set your primary sort. + * The only conceivable reason to write to this value is if you have a + * grouped view where you want to affect the sort order of the (secondary) + * date sort. (Secondary sort is always by date for grouped views.) + */ + attribute nsMsgViewSortTypeValue secondarySortType; + /** + * Reflects the current secondary sort order. + * Assigning to this value does not induce a sort; use the sort() method for + * all primary and secondary sort needs. The only reason to assign to this + * value is to affect the secondary sort of a grouped view. + */ + attribute nsMsgViewSortOrderValue secondarySortOrder; + readonly attribute nsMsgKey keyForFirstSelectedMessage; + readonly attribute nsMsgViewIndex viewIndexForFirstSelectedMsg; + /** + * this method will automatically expand the destination thread, + * if needs be. + */ + void viewNavigate(in nsMsgNavigationTypeValue motion, out nsMsgKey resultId, out nsMsgViewIndex resultIndex, out nsMsgViewIndex threadIndex, in boolean wrap); + + readonly attribute nsIMsgFolder msgFolder; + attribute nsIMsgFolder viewFolder; // in the case of virtual folders, the VF db. + + nsMsgKey getKeyAt(in nsMsgViewIndex index); + + /** + * Get the view flags at the passed in index. + * + * @param aIndex - index to get the view flags for + * + * @ return - 32 bit view flags (e.g., elided) + */ + unsigned long getFlagsAt(in nsMsgViewIndex aIndex); + + /** + * Get the msg hdr at the passed in index + * + * @param aIndex - index to get the msg hdr at. + * + * @return - msg hdr at the passed in index + * @exception - NS_MSG_INVALID_DBVIEW_INDEX + */ + nsIMsgDBHdr getMsgHdrAt(in nsMsgViewIndex aIndex); + + nsIMsgFolder getFolderForViewIndex(in nsMsgViewIndex index); // mainly for search + AUTF8String getURIForViewIndex(in nsMsgViewIndex index); + nsIMsgDBView cloneDBView(in nsIMessenger aMessengerInstance, in nsIMsgWindow aMsgWindow, in nsIMsgDBViewCommandUpdater aCommandUpdater); + + /** + * Provides a list of the message headers for the currently selected messages. + * If the "mail.operate_on_msgs_in_collapsed_threads" preference is enabled, + * then any collapsed thread roots that are selected will also (conceptually) + * have all of the messages in that thread selected and they will be included + * in the returned list. The one exception to this is if the front end fails + * to summarize the selection, and we fall back to just displaying a single + * message. In that case, we won't include the children of the collapsed + * thread. However, the numSelected attribute will count those children, + * because the summarizeSelection code uses that to know that it should + * try to summarize the selection. + * + * If the user has right-clicked on a message, this will return that message + * (and any collapsed children if so enabled) and not the selection prior to + * the right-click. + * + * @return an array containing the selected message headers. You are free to + * mutate the array; it will not affect the underlying selection. + */ + Array<nsIMsgDBHdr> getSelectedMsgHdrs(); + + Array<AUTF8String> getURIsForSelection(); + Array<nsMsgViewIndex> getIndicesForSelection(); + + readonly attribute AUTF8String URIForFirstSelectedMessage; + readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage; + + /** + * The number of selected messages. If the + * "mail.operate_on_msgs_in_collapsed_threads" preference is enabled, then + * any collapsed thread roots that are selected will also conceptually have + * all of the messages in that thread selected. + */ + readonly attribute unsigned long numSelected; + readonly attribute nsMsgViewIndex msgToSelectAfterDelete; + readonly attribute nsMsgViewIndex currentlyDisplayedMessage; + + /** + * Number of messages in view, including messages in collapsed threads. + * Not currently implemented for threads with unread or watched threads + * with unread. + */ + readonly attribute long numMsgsInView; + // used by "go to folder" feature + // and "remember last selected message" feature + // if key is not found, we don't select. + void selectMsgByKey(in nsMsgKey key); + + void selectFolderMsgByKey(in nsIMsgFolder aFolder, in nsMsgKey aKey); + // we'll suppress displaying messages if the message pane is collapsed + attribute boolean suppressMsgDisplay; + + // we'll suppress command updating during folder loading + attribute boolean suppressCommandUpdating; + + /** + * Suppress change notifications. This is faster than Begin/EndUpdateBatch + * on the tree, but less safe in that you're responsible for row invalidation + * and row count changes. + */ + attribute boolean suppressChangeNotifications; + + //to notify tree that rows are going away + void onDeleteCompleted(in boolean succeeded); + + readonly attribute nsIMsgDatabase db; + + readonly attribute boolean supportsThreading; + + attribute nsIMsgSearchSession searchSession; + readonly attribute boolean removeRowOnMoveOrDelete; + + /** + * Finds the view index of the passed in msgKey. Note this should not + * be called on cross-folder views since the msgKey may not be unique. + * + * @param aMsgKey - key to find. + * @param aExpand - whether to expand a collapsed thread to find the key. + * + * @return - view index of msg hdr, -1 if hdr not found. + */ + nsMsgViewIndex findIndexFromKey(in nsMsgKey aMsgKey, in boolean aExpand); + /** + * Finds the view index of the passed in msgHdr. + * + * @param aMsgHdr - hdr to find. + * @param aExpand - whether to expand a collapsed thread to find the hdr. + * + * @return - view index of msg hdr, -1 if hdr not found. + */ + nsMsgViewIndex findIndexOfMsgHdr(in nsIMsgDBHdr aMsgHdr, in boolean aExpand); + + /** + * Expands a thread and selects all it's member messages. + * + * @param aIndex - View index of a message in the thread to expand (can be + any message which is a member of the thread). + * @param aAugment - If true, Augment the existing selection. + * If false, replace it. + */ + void ExpandAndSelectThreadByIndex(in nsMsgViewIndex aIndex, in boolean aAugment); + + /** + * This method returns the nsIMsgThread object containing the header displayed + * at the desired row. For grouped views and cross folder saved searches, + * this will be the view thread, not the db thread. + * + * @param aIndex view index we want corresponding thread object of. + * + * @return the thread object at the requested view index + */ + nsIMsgThread getThreadContainingIndex(in nsMsgViewIndex aIndex); + + /** + * Insert rows into the view. The caller should use NoteChange() below to + * update the view. + * + * @param aIndex view index for insertion start. + * @param aNumRows number of rows to insert. + * @param aKey msgKey. + * @param aFlags msgFlags. + * @param aLevel treeview indent level. + * @param aFolder nsIMsgFolder, required for search/xfvf views. + */ + void insertTreeRows(in nsMsgViewIndex aIndex, in unsigned long aNumRows, + in nsMsgKey aKey, in nsMsgViewFlagsTypeValue aFlags, + in unsigned long aLevel, in nsIMsgFolder aFolder); + + /** + * Remove rows from the view. The caller should use NoteChange() below to + * update the view. + * + * @param aIndex view index for removal start. + * @param aNumRows number of rows to remove. + */ + void removeTreeRows(in nsMsgViewIndex aIndex, in unsigned long aNumRows); + + /** + * Notify tree that rows have changed. + * + * @param aFirstLineChanged first view index for changed rows. + * @param aNumRows number of rows changed; < 0 means removed. + * @param aChangeType changeType. + */ + void NoteChange(in nsMsgViewIndex aFirstLineChanged, in long aNumRows, + in nsMsgViewNotificationCodeValue aChangeType); + + /** + * Return the view thread corresponding to aMsgHdr. If we're a cross-folder + * view, then it would be the cross folder view thread, otherwise, the + * db thread object. + * + * @param aMsgHdr message header we want the view thread object of. + * + * @return view thread object for msg hdr. + */ + nsIMsgThread getThreadContainingMsgHdr(in nsIMsgDBHdr aMsgHdr); + + // use lines or kB for size? + readonly attribute boolean usingLines; + + // Custom Column Implementation note: see nsIMsgCustomColumnHandler + + // attaches a custom column handler to a specific column (can be a new column or a built in) + void addColumnHandler(in AString aColumn, in nsIMsgCustomColumnHandler aHandler); + + // removes a custom column handler leaving the column to be handled by the system + void removeColumnHandler(in AString aColumn); + + // returns the custom column handler attached to a specific column - if any + nsIMsgCustomColumnHandler getColumnHandler(in AString aColumn); + + /** + * The custom column to use for sorting purposes (when sort type is + * nsMsgViewSortType.byCustom.) + */ + attribute AString curCustomColumn; + + /** + * The custom column used for a secondary sort, blank if secondarySort is + * not byCustom. The secondary sort design is such that the desired secondary + * is sorted first, followed by sort by desired primary. The secondary is + * read only, as it is set internally according to this design. + */ + readonly attribute AString secondaryCustomColumn; + /** + * Scriptable accessor for the cell text for a column + * + * @param aRow - row we want cell text for + * @param aColumnName - name of column we want cell text for + * + * @returns The cell text for the given row and column, if any. + * @notes This does not work for custom columns yet. + */ + AString cellTextForColumn(in long aRow, in AString aColumnName); + + /** + * Get all of the data needed to display a row. Effectively a combination of + * CellTextForColumn, GetRowProperties and GetLevel, for performance reasons. + * + * @param aRow - Index of the row we want data for. + * @param aColumnNames - The column names we want cell text for. + * @param aProperties - The properties of the row. + * @param aThreadLevel - The thread level of the row. + * + * @returns The cell text for the columns in `aColumnNames`. + */ + Array<AString> cellDataForColumns(in long aRow, + in Array<AString> aColumnNames, + out AString aProperties, + out long aThreadLevel); +}; + +/* this interface is rapidly morphing from a command updater interface into a more generic + FE updater interface to handle changes in the view +*/ + +[scriptable, uuid(ce8f52ee-e742-4b31-8bdd-2b3a8168a117)] +interface nsIMsgDBViewCommandUpdater : nsISupports +{ + /* Eventually we'll flush this out into some kind of rich interface + which may take specific selection changed type notifications like + no selections, single selection, multi-selection, etc. For starters, + we are going to keep it generic. The back end will only push an update + command status when the # of selected items changes. + */ + + void updateCommandStatus(); + + /* displayed message has changed */ + void displayMessageChanged(in nsIMsgFolder aFolder, in AString aSubject, in ACString aKeywords); + + /** + * allows the backend to tell the front end to re-determine + * which message we should selet after a delete or move + */ + void updateNextMessageAfterDelete(); + + /** + * tell the front end that the selection has changed, and may need to be + * resummarized. + * + * @return true if we did summarize, false otherwise. + */ + boolean summarizeSelection(); + + /** + * Tell the front end that the selected message was removed and it should update. + */ + void selectedMessageRemoved(); +}; + +/** + * A shim of XULTreeElement, with only the methods called by nsMsgDBView. + */ +[scriptable, uuid(c5f6b1a2-f56a-49cb-b863-badf158206d5)] +interface nsIMsgJSTree : nsISupports +{ + void beginUpdateBatch(); + void endUpdateBatch(); + void ensureRowIsVisible(in long index); + void invalidate(); + void invalidateRange(in long startIndex, in long endIndex); + void rowCountChanged(in long index, in long count); + attribute long currentIndex; +}; diff --git a/comm/mailnews/base/public/nsIMsgEnumerator.idl b/comm/mailnews/base/public/nsIMsgEnumerator.idl new file mode 100644 index 0000000000..9ce2523a88 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgEnumerator.idl @@ -0,0 +1,94 @@ +/* -*- 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" + +interface nsIMsgDBHdr; +interface nsIMsgThread; + +/** + * nsIJSIterator implements the JavaScript iterator protocol. + * For details on the JS side, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterator_protocol + */ +[scriptable, uuid(4406175e-1aa4-414c-ad7c-86bd76e102f8)] +interface nsIJSIterator : nsISupports { + /** + * @returns {{value: Object, done: Boolean}} the iteration state. + * 'value' holds the next item, and 'done' flags the end of the iteration. + * (notionally, both 'value' and 'done' are always present, but a missing + * 'done' is considered to be false, and 'value' should be ignored if + * 'done' is true, according to the protocol). + */ + [implicit_jscontext] + jsval next(); +}; + + +/** + * nsIMsgEnumerator is an object for iterating forward over an ordered set of + * messages (nsIMsgHdrs). There is no provision to reset the iteration. + */ +[scriptable, uuid(5760cb6d-1a71-485f-ad85-5a98a9da2104)] +interface nsIMsgEnumerator : nsISupports { + /** + * Implements the JavaScript iterable protocol, which allows + * for...of constructs and the like. + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol + * NOTE: the nsIMsgEnumerator is "used up" by iterator(), just as it is by + * getNext()/hasMoreElements(). So you can only loop over the enumerator once. + */ + [symbol] + nsIJSIterator iterator(); + + /** + * Called to determine whether or not there are any messages remaining + * to be retrieved from the enumerator. + * + * @returns true if getNext() may be called to fetch a message, or + * false if there are no more messages. + */ + boolean hasMoreElements(); + + /** + * Called to retrieve the next message in the set. + * + * @returns the next element in the enumeration. + */ + nsIMsgDBHdr getNext(); +}; + +/** + * nsIMsgThreadEnumerator is an object for iterating forward over an ordered set of + * message threads (nsIMsgThread). There is no provision to reset the iteration. + */ +[scriptable, uuid(e39ae1a8-2b94-4f2b-abb4-250171047501)] +interface nsIMsgThreadEnumerator : nsISupports { + /** + * Implements the JavaScript iterable protocol, which allows + * for...of constructs and the like. + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol + * NOTE: the nsIMsgThreadEnumerator is "used up" by iterator(), just as it is by + * getNext()/hasMoreElements(). So you can only loop over the enumerator once. + */ + [symbol] + nsIJSIterator iterator(); + + /** + * Called to determine whether or not there are any messages remaining + * to be retrieved from the enumerator. + * + * @returns true if getNext() may be called to fetch a message, or + * false if there are no more messages. + */ + boolean hasMoreElements(); + + /** + * Called to retrieve the next thread in the set. + * + * @returns the next element in the enumeration. + */ + nsIMsgThread getNext(); +}; diff --git a/comm/mailnews/base/public/nsIMsgFolder.idl b/comm/mailnews/base/public/nsIMsgFolder.idl new file mode 100644 index 0000000000..4f0edb8818 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolder.idl @@ -0,0 +1,877 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "nsIFolderListener.idl" +#include "nsIMsgIncomingServer.idl" +#include "nsIMsgCopyServiceListener.idl" +#include "nsIUrlListener.idl" +#include "nsIMsgEnumerator.idl" + +interface nsIMsgDBHdr; +interface nsIMsgWindow; +interface nsIMsgDatabase; +interface nsIDBFolderInfo; +interface nsIMsgFilterList; +interface nsIFile; +interface nsIOutputStream; +interface nsIInputStream; +interface nsIFile; +interface nsIMsgIdentity; +interface nsIMsgThread; +interface nsIMsgPluggableStore; + +typedef long nsMsgBiffState; + +// enumerated type for determining if a message has been replied to, forwarded, etc. +typedef long nsMsgDispositionState; + +/* + * The contract ID for this component is @mozilla.org/msgFolder/msgFolderService;1. + */ +[scriptable, uuid(5639c204-48ac-4115-897f-3b16821fe118)] +interface nsIMsgFolderService : nsISupports +{ + /** + * JS-callable service to initialize static variables in nsMsgDBFolder.cpp + * upon initialization or when locale changes. + */ + void initializeFolderStrings(); +}; + +[scriptable, uuid(5d253ba2-42aa-43a7-b584-0059855ababf)] +interface nsIMsgFolder : nsISupports { + + const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting. + const nsMsgBiffState nsMsgBiffState_NoMail = 1; // No new mail is waiting. + const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is new mail. + + /* folder name properties */ + readonly attribute AUTF8String URI; + attribute AString name; + attribute AString prettyName; + readonly attribute AString abbreviatedName; + + /** + * Set pretty name again from original name, + * typically used when locale changes. + */ + void setPrettyNameFromOriginal(); + + attribute nsIMsgFolder parent; + + /// Returns an enumerator containing the messages within the current database. + readonly attribute nsIMsgEnumerator messages; + + /** + * This method is called by the folder-lookup-service after constructing + * a folder to initialize its URI. You would not normally + * call this method directly. + * + * @param uri - The URI of the folder. + */ + void Init(in AUTF8String uri); + + void startFolderLoading(); + void endFolderLoading(); + + void folderNamesReady(out boolean aReady); + + /* get new headers for db */ + void updateFolder(in nsIMsgWindow aWindow); + + /** + * URL for this folder + */ + readonly attribute AUTF8String folderURL; + + /** + * should probably move to the server + */ + readonly attribute boolean showDeletedMessages; + + /** + * this folder's parent server + */ + readonly attribute nsIMsgIncomingServer server; + + /** + * is this folder the "phantom" server folder? + */ + readonly attribute boolean isServer; + readonly attribute boolean canSubscribe; + readonly attribute boolean canFileMessages; + readonly attribute boolean noSelect; // this is an imap no select folder + readonly attribute boolean imapShared; // this is an imap shared folder + readonly attribute boolean canDeleteMessages; // can't delete from imap read-only + + /** + * does this folder allow subfolders? + * for example, newsgroups cannot have subfolders, and the INBOX + * on some IMAP servers cannot have subfolders + */ + readonly attribute boolean canCreateSubfolders; + + /** + * can you change the name of this folder? + * for example, newsgroups + * and some special folders can't be renamed + */ + readonly attribute boolean canRename; + + readonly attribute boolean canCompact; + + /** + * the phantom server folder + */ + readonly attribute nsIMsgFolder rootFolder; + + /** + * Get the server's list of filters. (Or in the case of news, the + * filter list for this newsgroup) + * This list SHOULD be used for all incoming messages. + * + * Since the returned nsIMsgFilterList is mutable, it is not necessary to call + * setFilterList after the filters have been changed. + * + * @param aMsgWindow @ref msgwindow "The standard message window" + * @return The list of filters + */ + nsIMsgFilterList getFilterList(in nsIMsgWindow msgWindow); + + /** + * Set the server's list of filters. + * + * Note that this does not persist the filter list. To change the contents + * of the existing filters, use getFilterList and mutate the values as + * appropriate. + * + * @param aFilterList The new list of filters. + */ + void setFilterList(in nsIMsgFilterList filterList); + + /** + * Get user editable filter list. This does not have to be the same as + * the filterlist above, typically depending on the users preferences. + * The filters in this list are not processed, but only to be edited by + * the user. + * @see getFilterList + * + * @param aMsgWindow @ref msgwindow "The standard message window" + * @return The list of filters + */ + nsIMsgFilterList getEditableFilterList(in nsIMsgWindow aMsgWindow); + + /** + * Set user editable filter list. + * This does not persist the filterlist, @see setFilterList + * @see getEditableFilterList + * @see setFilterList + * + * @param aFilterList The new list of filters. + */ + void setEditableFilterList(in nsIMsgFilterList aFilterList); + + /** + * Force close the mail database associated with this folder. + */ + void ForceDBClosed(); + /** + * Close and backup a folder database prior to reparsing + * + * @param newName New name of the corresponding message folder. + * Used in rename to set the file name to match the renamed + * folder. Set to empty to use the existing folder name. + */ + void closeAndBackupFolderDB(in ACString newName); + + /** + * Delete the backing store of the folder, but not the folder itself. + */ + [noscript] + void deleteStorage(); + + /** + * Delete this folder and its children, if any. + * Note: this may mean moving it to trash and/or requesting confirmation + * from the user, depending on implementation. + * So the deletion may not take place immediately (or at all!) + * + * @param msgWindow msgWindow to display status feedback in + */ + void deleteSelf(in nsIMsgWindow msgWindow); + + /** + * Delete the given subfolder of this folder. + * It does not need to be a direct child. + * + * @param folder a child subfolder to delete + * @param deleteStorage whether to also delete the folder storage on disk + */ + void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage); + + /** + * Delete the folder and all of its subfolders. + * + * @param deleteStorage whether to also delete the folder storage on disk + */ + [noscript] + void recursiveDelete(in boolean deleteStorage); + + /** + * Create a subfolder of the current folder with the passed in name. + * For IMAP, this will be an async operation and the folder won't exist + * until it is created on the server. + * + * @param folderName name of the folder to create. + * @param msgWindow msgWindow to display status feedback in. + * + * @exception NS_MSG_FOLDER_EXISTS + */ + void createSubfolder(in AString folderName, in nsIMsgWindow msgWindow); + + /** + * Adds the subfolder with the passed name to the folder hierarchy. + * This is used internally during folder discovery; It shouldn't be + * used to create folders since it won't create storage for the folder, + * especially for imap. Unless you know exactly what you're doing, you + * should be using createSubfolder + getChildNamed or createLocalSubfolder. + * + * @param aFolderName Name of the folder to add. + * @returns The folder added. + */ + nsIMsgFolder addSubfolder(in AString aFolderName); + + /* this method ensures the storage for the folder exists. + For local folders, it creates the berkeley mailbox if missing. + For imap folders, it subscribes to the folder if it exists, + or creates it if it doesn't exist + */ + void createStorageIfMissing(in nsIUrlListener urlListener); + + /** + * Compact this folder (Expunge _and_ compact, for IMAP folders). + * + * @param aListener Notified upon completion, can be null. + * OnStartRunningUrl() will not be called. + * OnStopRunningUrl() will be called upon completion, + * with a null URL. + * @param aMsgWindow For progress/status, can be null. + */ + void compact(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow); + /** + * Compact all folders in the account corresponding to this folder. + * + * @param aListener Notified upon completion, can be null. + * OnStartRunningUrl() will not be called. + * OnStopRunningUrl() will be called upon completion, + * with a null URL. + * @param aMsgWindow For progress/status, can be null. + */ + void compactAll(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow); + + void emptyTrash(in nsIUrlListener aListener); + + /** + * change the name of the folder + * + * @param name the new name of the folder + */ + void rename(in AString name, in nsIMsgWindow msgWindow); + void renameSubFolders( in nsIMsgWindow msgWindow, in nsIMsgFolder oldFolder); + + AString generateUniqueSubfolderName(in AString prefix, + in nsIMsgFolder otherFolder); + + void updateSummaryTotals(in boolean force); + void summaryChanged(); + /** + * get the total number of unread messages in this folder, + * or in all subfolders + * + * @param deep if true, descends into all subfolders and gets a grand total + */ + long getNumUnread(in boolean deep); + + /** + * get the total number of messages in this folder, + * or in all subfolders + * + * @param deep if true, descends into all subfolders and gets a grand total + */ + long getTotalMessages(in boolean deep); + + /** + * These functions are used for tricking the front end into thinking that we + * have more messages than are really in the DB. This is usually after an + * IMAP message copy where we don't want to do an expensive select until the + * user actually opens that folder. These functions are called when + * MSG_Master::GetFolderLineById is populating a MSG_FolderLine struct used + * by the FE. + */ + readonly attribute long numPendingUnread; + readonly attribute long numPendingTotalMessages; + void changeNumPendingUnread(in long delta); + void changeNumPendingTotalMessages(in long delta); + + /** + * does this folder have new messages + * + */ + attribute boolean hasNewMessages; + + /** + * Indicates whether this folder or any of its subfolders have new messages. + */ + readonly attribute boolean hasFolderOrSubfolderNewMessages; + + /** + * return the first new message in the folder + * + */ + readonly attribute nsIMsgDBHdr firstNewMessage; + + /** + * clear new status flag of all of the new messages + */ + void clearNewMessages(); + + readonly attribute long long expungedBytes; + + /** + * Can this folder be deleted? + * For example, special folders and isServer folders cannot be deleted. + */ + readonly attribute boolean deletable; + + /** + * should we be displaying recipients instead of the sender? + * for example, in the Sent folder, recipients are more relevant + * than the sender + */ + readonly attribute boolean displayRecipients; + + /** + * used to determine if it will take a long time to download all + * the headers in this folder - so that we can do folder notifications + * synchronously instead of asynchronously + */ + readonly attribute boolean manyHeadersToDownload; + + readonly attribute ACString relativePathName; + + /** + * size of this folder on disk (not including .msf file) + * for imap, it's the sum of the size of the messages + */ + attribute long long sizeOnDisk; + + readonly attribute ACString username; + readonly attribute ACString hostname; + + /** + * Sets a flag on the folder. The known flags are defined in + * nsMsgFolderFlags.h. + * + * @param flag The flag to set on the folder. + */ + void setFlag(in unsigned long flag); + + /** + * Clears a flag on the folder. The known flags are defined in + * nsMsgFolderFlags.h. + * + * @param flag The flag to clear on the folder. + */ + void clearFlag(in unsigned long flag); + + /** + * Determines if a flag is set on the folder or not. The known flags are + * defined in nsMsgFolderFlags.h. + * + * @param flag The flag to check on the folder. + * @return True if the flag exists. + */ + boolean getFlag(in unsigned long flag); + + /** + * Toggles a flag on the folder. The known flags are defined in + * nsMsgFolderFlags.h. + * + * @param flag The flag to toggle + */ + void toggleFlag(in unsigned long flag); + + /** + * Called to notify the database and/or listeners of a change of flag. The + * known flags are defined in nsMsgFolderFlags.h + * + * @note This doesn't need to be called for normal flag changes via + * the *Flag functions on this interface. + * + * @param flag The flag that was changed. + */ + void onFlagChange(in unsigned long flag); + + /** + * Direct access to the set/get all the flags at once. + */ + attribute unsigned long flags; + + /** + * Gets the first folder that has the specified flags set. + * + * @param flags The flag(s) to check for. + * @return The folder or the first available child folder that has + * the specified flags set, or null if there are none. + */ + nsIMsgFolder getFolderWithFlags(in unsigned long flags); + + /** + * Gets the folders that have the specified flag set. + * + * @param flags The flag(s) to check for. + * @return An array of folders that have the specified flags set. + * The array may have zero elements. + */ + Array<nsIMsgFolder> getFoldersWithFlags(in unsigned long flags); + + /** + * Check if this folder (or one of its ancestors) is special. + * + * @param flags The "special" flags to check. + * @param checkAncestors Should ancestors be checked too. + */ + boolean isSpecialFolder(in unsigned long flags, + [optional] in boolean checkAncestors); + + AUTF8String getUriForMsg(in nsIMsgDBHdr msgHdr); + + /** + * Deletes the messages from the folder. + * + * @param messages The array of nsIMsgDBHdr objects to be deleted. + * @param msgWindow The standard message window object, for alerts et al. + * @param deleteStorage Whether or not the message should be truly deleted, as + opposed to moving to trash. + * @param isMove Whether or not this is a deletion for moving messages. + * @param allowUndo Whether this action should be undoable. + */ + void deleteMessages(in Array<nsIMsgDBHdr> messages, + in nsIMsgWindow msgWindow, + in boolean deleteStorage, in boolean isMove, + in nsIMsgCopyServiceListener listener, in boolean allowUndo); + + void copyMessages(in nsIMsgFolder srcFolder, in Array<nsIMsgDBHdr> messages, + in boolean isMove, in nsIMsgWindow msgWindow, + in nsIMsgCopyServiceListener listener, in boolean isFolder, + in boolean allowUndo); + + void copyFolder(in nsIMsgFolder srcFolder, in boolean isMoveFolder, + in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener); + + void copyFileMessage(in nsIFile file, in nsIMsgDBHdr msgToReplace, + in boolean isDraft, in unsigned long newMsgFlags, + in ACString aKeywords, + in nsIMsgWindow msgWindow, + in nsIMsgCopyServiceListener listener); + + void acquireSemaphore(in nsISupports semHolder); + void releaseSemaphore(in nsISupports semHolder); + boolean testSemaphore(in nsISupports semHolder); + readonly attribute boolean locked; + + void getNewMessages(in nsIMsgWindow aWindow, in nsIUrlListener aListener); + + /** + * Write out summary data for this folder to the given folder cache. + */ + void writeToFolderCache(in nsIMsgFolderCache folderCache, in boolean deep); + + attribute unsigned long biffState; + + /** + * The number of new messages since this folder's last biff. + * + * @param deep if true, descends into all subfolders and gets a grand total + */ + + long getNumNewMessages(in boolean deep); + + void setNumNewMessages(in long numNewMessages); + + /** + * are we running a url as a result of the user clicking get msg? + */ + attribute boolean gettingNewMessages; + + /** + * local path of this folder + */ + attribute nsIFile filePath; + + /// an nsIFile corresponding to the .msf file. + readonly attribute nsIFile summaryFile; + + readonly attribute AUTF8String baseMessageURI; + AUTF8String generateMessageURI(in nsMsgKey msgKey); + + const nsMsgDispositionState nsMsgDispositionState_None = -1; + const nsMsgDispositionState nsMsgDispositionState_Replied = 0; + const nsMsgDispositionState nsMsgDispositionState_Forwarded = 1; + const nsMsgDispositionState nsMsgDispositionState_Redirected = 2; + + void addMessageDispositionState(in nsIMsgDBHdr aMessage, + in nsMsgDispositionState aDispositionFlag); + + void markMessagesRead(in Array<nsIMsgDBHdr> messages, in boolean markRead); + void markAllMessagesRead(in nsIMsgWindow aMsgWindow); + void markMessagesFlagged(in Array<nsIMsgDBHdr> messages, in boolean markFlagged); + void markThreadRead(in nsIMsgThread thread); + + /** + * Gets the message database for the folder. + * + * Note that if the database is out of date, the implementation MAY choose to + * throw an error. For a handle to the database which MAY NOT throw an error, + * one can use getDBFolderInfoAndDB. + * + * The attribute can also be set to another database or to null to force the + * folder to reopen the same database when it is needed again. + * + * @exception NS_MSG_ERROR_FOLDER_SUMMARY_MISSING If the database does not + * exist. + * @exception NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE If the database contains + * out of date information. + * @see nsIMsgFolder::getDBFolderInfoAndDB. + */ + attribute nsIMsgDatabase msgDatabase; + + /// Close the database if not open in folder. + void closeDBIfFolderNotOpen(in boolean forceClosed); + + /// Does the folder have a local reference to the msgDatabase? + readonly attribute boolean databaseOpen; + + /** + * Get the backup message database, used in reparsing. This database must + * be created first using closeAndBackupFolderDB() + * + * @return backup message database + */ + nsIMsgDatabase getBackupMsgDatabase(); + /** + * Remove the backup message database file + */ + void removeBackupMsgDatabase(); + /** + * Open the backup message database file + */ + void openBackupMsgDatabase(); + nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo); + nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey); + + readonly attribute boolean supportsOffline; + boolean shouldStoreMsgOffline(in nsMsgKey msgKey); + boolean hasMsgOffline(in nsMsgKey msgKey); + + /** + * Get an offline store output stream for the passed message header. + * + * @param aHdr hdr of message to get outputstream for + * @returns An output stream to write to. + */ + nsIOutputStream getOfflineStoreOutputStream(in nsIMsgDBHdr aHdr); + + /** + * !!! DEPRECATED (Bug 1733849) !!! + * Use getLocalMsgStream() instead. + * + * Get an input stream for the passed message header. The stream will + * be positioned at the start of the message. + * + * @param aHdr hdr of message to get the input stream for. + * @returns an input stream to read the message from + */ + nsIInputStream getMsgInputStream(in nsIMsgDBHdr aHdr); + + /** + * Returns an input stream for reading a locally-stored message. + * (That means any message in a local folder, or a message marked as + * Offline on a non-local folder). + * The stream contains the single message. + * The returned stream should _not_ be considered seekable. + * + * @param hdr The message to get the input stream for. + * @returns Input stream to read the message from. + */ + nsIInputStream getLocalMsgStream(in nsIMsgDBHdr aHdr); + + void downloadMessagesForOffline(in Array<nsIMsgDBHdr> messages, + in nsIMsgWindow window); + nsIMsgFolder getChildWithURI(in AUTF8String uri, in boolean deep, + in boolean caseInsensitive); + void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window); + /** + * Turn notifications on/off for various notification types. Currently only + * supporting allMessageCountNotifications which refers to both total and + * unread message counts. + */ + const unsigned long allMessageCountNotifications = 0; + void enableNotifications(in long notificationType, in boolean enable); + boolean isCommandEnabled(in ACString command); + boolean matchOrChangeFilterDestination(in nsIMsgFolder folder, + in boolean caseInsensitive); + boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow); + void alertFilterChanged(in nsIMsgWindow msgWindow); + void throwAlertMsg(in string msgName, in nsIMsgWindow msgWindow); + AString getStringWithFolderNameFromBundle(in string msgName); + void notifyCompactCompleted(); + /** + * Calculate ordering of this folder against another. + */ + long compareSortKeys(in nsIMsgFolder msgFolder); + + attribute nsIMsgRetentionSettings retentionSettings; + attribute nsIMsgDownloadSettings downloadSettings; + boolean callFilterPlugins(in nsIMsgWindow aMsgWindow); + /** + * used for order in the folder pane, folder pickers, etc. + */ + attribute long sortOrder; + + attribute nsIDBFolderInfo dBTransferInfo; + + /** + * Set a string property on the folder. + */ + void setStringProperty(in string propertyName, in AUTF8String propertyValue); + + /** + * Returns the value of a string property. + * Throws an error if property does not exist. + */ + AUTF8String getStringProperty(in string propertyName); + + /* does not persist across sessions */ + attribute nsMsgKey lastMessageLoaded; + + /** + * Returns an array containing nsIMsgFolder items that are + * subfolders of the instance this is called on. + */ + readonly attribute Array<nsIMsgFolder> subFolders; + + /** + * Returns true if this folder has sub folders. + */ + readonly attribute boolean hasSubFolders; + + /** + * Returns the number of sub folders that this folder has. + */ + readonly attribute unsigned long numSubFolders; + + /** + * Determines if this folder is an ancestor of the supplied folder. + * + * @param folder The folder that may or may not be a descendent of this + * folder. + */ + boolean isAncestorOf(in nsIMsgFolder folder); + + /** + * Looks in immediate children of this folder for the given name. + * + * @param name the name of the target subfolder + */ + boolean containsChildNamed(in AString name); + + /** + * Return the child folder which the specified name. + * + * @param aName The name of the child folder to find + * @return The child folder + * @exception NS_ERROR_FAILURE Thrown if the folder with aName does not exist + */ + nsIMsgFolder getChildNamed(in AString aName); + + /** + * Finds the sub folder with the specified name. + * + * @param escapedSubFolderName The name of the sub folder to find. + * @note Even if the folder doesn't currently exist, + * a nsIMsgFolder may be returned. + */ + nsIMsgFolder findSubFolder(in ACString escapedSubFolderName); + + void AddFolderListener(in nsIFolderListener listener); + void RemoveFolderListener(in nsIFolderListener listener); + + // These notification functions invoke the appropriate nsIFolderListener + // method on all the listeners attached to this folder, and _also_ + // all the nsIFolderListeners registered in the MailSession. + // See nsIMsgMailSession AddFolderListener()/RemoveFolderListener(). + void NotifyPropertyChanged(in ACString property, + in ACString oldValue, + in ACString newValue); + void NotifyIntPropertyChanged(in ACString property, + in long long oldValue, + in long long newValue); + void NotifyBoolPropertyChanged(in ACString property, + in boolean oldValue, + in boolean newValue); + void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, + in ACString property, + in unsigned long oldValue, + in unsigned long newValue); + void NotifyUnicharPropertyChanged(in ACString property, + in AString oldValue, + in AString newValue); + + void notifyMessageAdded(in nsIMsgDBHdr msg); + void notifyMessageRemoved(in nsIMsgDBHdr msg); + void notifyFolderAdded(in nsIMsgFolder child); + void notifyFolderRemoved(in nsIMsgFolder child); + + void NotifyFolderEvent(in ACString event); + + // Gets all descendants, not just first level children. + readonly attribute Array<nsIMsgFolder> descendants; + void Shutdown(in boolean shutdownChildren); + + void copyDataToOutputStreamForAppend(in nsIInputStream aIStream, + in long aLength, in nsIOutputStream outputStream); + void copyDataDone(); + void setJunkScoreForMessages(in Array<nsIMsgDBHdr> aMessages, in ACString aJunkScore); + void applyRetentionSettings(); + + /** + * Get the beginning of the message bodies for the passed in keys and store + * them in the msg hdr property "preview". This is intended for + * new mail alerts, title tips on folders with new messages, and perhaps + * titletips/message preview in the thread pane. + * + * @param aKeysToFetch keys of msgs to fetch + * @param aUrlListener url listener to notify if we run url to fetch msgs + * + * @result aAsyncResults if true, we ran a url to fetch one or more of msg bodies + * + */ + boolean fetchMsgPreviewText(in Array<nsMsgKey> aKeysToFetch, + in nsIUrlListener aUrlListener); + + // used to set/clear tags - we could have a single method to setKeywords which + // would figure out the diffs, but these methods might be more convenient. + // keywords are space delimited, in the case of multiple keywords + void addKeywordsToMessages(in Array<nsIMsgDBHdr> aMessages, in ACString aKeywords); + void removeKeywordsFromMessages(in Array<nsIMsgDBHdr> aMessages, in ACString aKeywords); + /** + * Extract the message text from aStream. + * + * @param aStream stream to read from + * @param aCharset character set to use to interpret the body. If an empty string, then the + * charset is retrieved from the headers. msgHdr.charset is recommended in case you have it. + * @param aBytesToRead number of bytes to read from the stream. The function will read till the end + * of the line, and there will also be some read ahead due to NS_ReadLine + * @param aMaxOutputLen desired length of the converted message text. Used to control how many characters + * of msg text we want to store. + * @param aCompressQuotes Replace quotes and citations with " ... " in the preview text + * @param aStripHTMLTags strip HTML tags from the output, if present + * @param[out] aContentType the content type of the MIME part that was used to generate the text -- + * for an HTML part, this will be "text/html" even though aStripHTMLTags might be true + */ + AUTF8String getMsgTextFromStream(in nsIInputStream aStream, in ACString aCharset, + in unsigned long aBytesToRead, in unsigned long aMaxOutputLen, + in boolean aCompressQuotes, in boolean aStripHTMLTags, + out ACString aContentType); + + AString convertMsgSnippetToPlainText(in AString aMessageText); + + // this allows a folder to have a special identity. E.g., you might want to + // associate an identity with a particular newsgroup, or for IMAP shared folders in + // the other users namespace, you might want to create a delegated identity + readonly attribute nsIMsgIdentity customIdentity; + + /** + * @{ + * Processing flags, used to manage message processing. + * + * @param msgKey message key + * @return processing flags + */ + unsigned long getProcessingFlags(in nsMsgKey msgKey); + + /** + * @param msgKey message key + * @param mask mask to OR into the flags + */ + void orProcessingFlags(in nsMsgKey msgKey, in unsigned long mask); + + /** + * @param msgKey message key + * @param mask mask to AND into the flags + */ + void andProcessingFlags(in nsMsgKey msgKey, in unsigned long mask); + /** @} */ + + /** + * Gets an inherited string property from the folder. + * + * If the forcePropertyEmpty boolean is set (see below), return an + * empty string. + * + * If the specified folder has a non-empty value for the property, + * return that value. Otherwise, return getInheritedStringProperty + * for the folder's parent. + * + * If a folder is the root folder for a server, then instead of + * checking the folder property, check the property of the same name + * for the server using nsIMsgIncomingServer.getCharValue(...) + * + * Note nsIMsgIncomingServer.getCharValue for a server inherits from + * the preference mail.server.default.(propertyName) as a global value + * + * (ex: if propertyName = "IAmAGlobal" and no folder nor server properties + * are set, then the inherited property will return the preference value + * mail.server.default.IAmAGlobal) + * + * If the propertyName is undefined, returns an empty, void string. + * + * @param propertyName The name of the property for the value to retrieve. + */ + ACString getInheritedStringProperty(in string propertyName); + + /** + * Set a boolean to force an inherited propertyName to return empty instead + * of inheriting from a parent folder, server, or the global + * + * @param propertyName The name of the property + * @param aForcePropertyEmpty true if an empty inherited property should be returned + */ + void setForcePropertyEmpty(in string propertyName, in boolean aForcePropertyEmpty); + + /** + * Get a boolean to force an inherited propertyName to return empty instead + * of inheriting from a parent folder, server, or the global + * + * @param propertyName The name of the property + * + * @return true if an empty inherited property should be returned + */ + boolean getForcePropertyEmpty(in string propertyName); + + /** + * Pluggable store for this folder. Currently, this will always be the same + * as the pluggable store for the server. + */ + readonly attribute nsIMsgPluggableStore msgStore; + + /** + * Protocol type, i.e. "pop3", "imap", "nntp", "none", etc + * used to construct URLs for this account type. + */ + readonly attribute ACString incomingServerType; +}; diff --git a/comm/mailnews/base/public/nsIMsgFolderCache.idl b/comm/mailnews/base/public/nsIMsgFolderCache.idl new file mode 100644 index 0000000000..b5ba40afdc --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderCache.idl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +interface nsIFile; +interface nsIMsgFolderCacheElement; + +/** + * nsIMsgFolderCache is a store of values which might be slow for the folder + * to calculate. For example: the number of unread messages. + * The account manager holds the cache, and each folder manipulates its cached + * properties via nsIMsgFolderCacheElement. + */ +[scriptable, uuid(78C2B6A2-E29F-44de-9543-10DBB51E245C)] +interface nsIMsgFolderCache : nsISupports +{ + /** + * Set up the cache, loading/saving to cacheFile. + * If a new-style cacheFile isn't found, it looks for an old panacea.dat, + * specified by legacyFile and migrates it to the new format. + * Neither file has to exist - it'll just start up with an empty cache. + * nsMsgFolderCache (the only implementation) will autosave to cacheFile + * when changes are made. + * + * @param cacheFile File to persist the cache data (folderCache.json). + * @param legacyFile Old panacea.dat file to check for and migrate, if + * cacheFile doesn't exist. + */ + void init(in nsIFile cacheFile, in nsIFile legacyFile); + + /** + * Return an nsIMsgFolderCacheElement for a given folder. + * Unless createIfMissing is set, a missing entry will cause failure. + */ + nsIMsgFolderCacheElement getCacheElement(in ACString key, in boolean createIfMissing); + void removeElement(in ACString key); + + /** + * Write immediately to cacheFile if any data has been changed. + * Write immediately to cacheFile if any data has been changed. + * This happens in the cache dtor anyway, but we use it during shutdown and + * in unit testing (so tests don't have to wait for JS garbage collection). + */ + void flush(); +}; diff --git a/comm/mailnews/base/public/nsIMsgFolderCacheElement.idl b/comm/mailnews/base/public/nsIMsgFolderCacheElement.idl new file mode 100644 index 0000000000..dd4b54c4f0 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderCacheElement.idl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +/** + * Interface for a folder to get/set its values in the foldercache. + */ +[scriptable, uuid(c7392b12-f68a-46b2-af5e-d47350bb17c3)] +interface nsIMsgFolderCacheElement : nsISupports +{ + readonly attribute ACString key; + // Notes on the getCached...() functions: + // - They will fail if the property doesn't exist. That is, they'll + // throw an exception in JS, or return an NS_ERROR_* code in C++. + // - null values are returned as empty string (for getCachedString()), + // or zero (for the numeric accessors). NOTE: there should be no + // way to actually set properties to null, but the + // panacea.dat->folderCache.json might have introduced some, so we + // need to handle them. + // - On the C++ side there is legacy code which calls these functions + // without checking the error code and relies on the return value + // remaining unchanged if the function fails. + AUTF8String getCachedString(in string propertyName); + long getCachedInt32(in string propertyName); + unsigned long getCachedUInt32(in string propertyName); + long long getCachedInt64(in string propertyName); + + void setCachedString(in string propertyName, in AUTF8String propertyValue); + void setCachedInt32(in string propertyName, in long propertyValue); + void setCachedUInt32(in string propertyName, in unsigned long propertyValue); + void setCachedInt64(in string propertyName, in long long propertyValue); +}; diff --git a/comm/mailnews/base/public/nsIMsgFolderCompactor.idl b/comm/mailnews/base/public/nsIMsgFolderCompactor.idl new file mode 100644 index 0000000000..96df873f32 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderCompactor.idl @@ -0,0 +1,34 @@ +/* -*- 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" + +interface nsIMsgFolder; +interface nsIMsgWindow; +interface nsIUrlListener; + +[scriptable, uuid(38c7e876-3083-4aea-8dcd-0ea0ec1753a3)] + +/** + * Use this for any object that wants to handle compacting folders. + * Currently, the folders themselves create this object. + */ + +interface nsIMsgFolderCompactor : nsISupports +{ + /** + * Compact the passed in array of folders. + * + * @param folders The folders to compact. + * @param listener Notified of completion, can be null. + * OnStartRunningUrl() will not be called. + * OnStopRunningUrl() will be called upon + * completion, with a null URL. + * @param window Used for progress/status, can be null. + */ + void compactFolders(in Array<nsIMsgFolder> folders, + in nsIUrlListener listener, + in nsIMsgWindow window); +}; diff --git a/comm/mailnews/base/public/nsIMsgFolderListener.idl b/comm/mailnews/base/public/nsIMsgFolderListener.idl new file mode 100644 index 0000000000..34932a3361 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderListener.idl @@ -0,0 +1,227 @@ +/* -*- 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" +#include "MailNewsTypes2.idl" + +interface nsIMsgDBHdr; +interface nsIMsgFolder; + +/** + * nsIMsgFolderListener defines the callbacks which are invoked by + * nsIMsgFolderNotificationService. + * + * This is similar to nsIFolderListener, but with slightly different semantics, + * especially w.r.t. moving messages and folders. Some listeners want to know + * about moves, instead of getting an itemAdded and itemRemoved notification. + * Folder listeners also only tend to get called if a view is open on the folder, + * which is not always the case. I don't want to change nsIFolderListener at this + * point since there are lots of extensions that rely on it. Eventually, + * these two interfaces should be combined somehow. + */ + +[scriptable, uuid(2f87be72-0565-4e64-a824-0eb9c258f884)] +interface nsIMsgFolderListener : nsISupports { + /** + * Notified immediately after a message is added to a folder. This could be a + * new incoming message to a local folder, or a new message in an IMAP folder + * when it is opened. + * + * You may want to consider using the msgsClassified notification instead of + * this notification if any of the following are true: + * + * - You only want to be notified about messages after junk classification + * has occurred (if it is going to occur for a message). This also goes for + * trait classification which is a generic use of the bayesian engine at + * the heart of the spam logic. + * + * - You only want to be notified about messages after all filters have been + * run. Although some filters may be run before the msgAdded notification + * is generated, filters dependent on junk/trait classification wait until + * classification completes. + * + * @param aMsg The message header that was just added + */ + void msgAdded(in nsIMsgDBHdr aMsg); + + /** + * Notification that (new to the client) messages have been through junk and + * trait classification. This event will occur for all messages at some point + * after their existence is revealed by msgAdded. + * + * Because junk classification does not run if no messages have ever been + * marked as junk by the user, it is possible to receive this message without + * any classification having actually been performed. We still generate the + * notification in this case so that code is reliably notified about the + * existence of the new message headers. + * + * @param aMsgs The message headers that have been classified or were + * intentionally not classified. + * @param aJunkProcessed Were the messages processed for junk classification? + * @param aTraitProcessed Were the messages processed for trait + * classification? + */ + void msgsClassified(in Array<nsIMsgDBHdr> aMsgs, in boolean aJunkProcessed, + in boolean aTraitProcessed); + + /** + * msgsJunkStatusChanged indicates that some messages that had already been + * reported by msgsClassified have had their junk status changed. This + * event will not fire for the initial automatic classification of + * messages; msgsClassified will tell you about those messages. + * This is not guaranteed to be a comprehensive source of junk + * notification events; right now any time an nsMsgDBView marks things as + * junk/non-junk a notification is produced. + * + * @param {nsIMsgDBHdr[]} messages - The affected messages. + * + */ + void msgsJunkStatusChanged(in Array<nsIMsgDBHdr> messages); + + /** + * Notified after a command to delete a group of messages has been given, but before the + * messages have actually been deleted. + * + * @param aMsgs An array of the message headers about to be deleted + * + * @note + * This notification will not take place if the messages are being deleted from the folder + * as the result of a move to another folder. Instead, the msgsMoveCopyCompleted() notification + * takes place. + * + * @note + * "Deleting" to a trash folder is actually a move, and is covered by msgsMoveCopyCompleted() + * + * @note + * If the user has selected the IMAP delete model (marking messages as deleted, then purging them + * later) for an IMAP account, this notification will not take place on the delete. This will only + * take place on the purge. + */ + void msgsDeleted(in Array<nsIMsgDBHdr> aMsgs); + + /** + * Notified after a command to move or copy a group of messages completes. In + * case of a move, this is before the messages have been deleted from the + * source folder. + * + * @param aMove true if a move, false if a copy + * @param aSrcMsgs An array of the message headers in the source folder + * @param aDestFolder The folder these messages were moved to. + * @param aDestMsgs This provides the list of target message headers. + For imap messages, these will be "pseudo" headers, with + a made up UID. When we download the "real" header, we + will send a msgKeyChanged notification. Currently, if + the imap move/copy happens strictly online (essentially, + not user-initiated), then aDestMsgs will be null. + * + * @note + * If messages are moved from a server which uses the IMAP delete model, + * you'll get aMove = false. That's because the messages are not deleted from + * the source database, but instead simply marked deleted. + */ + void msgsMoveCopyCompleted(in boolean aMove, + in Array<nsIMsgDBHdr> aSrcMsgs, + in nsIMsgFolder aDestFolder, + in Array<nsIMsgDBHdr> aDestMsgs); + + /** + * Notification sent when the msg key for a header may have changed. + * This is used when we create a header for an offline imap move result, + * without knowing what the ultimate UID will be. When we download the + * headers for the new message, we replace the old "pseudo" header with + * a new header that has the correct UID/message key. The uid of the new hdr + * may turn out to be the same as aOldKey if we've guessed correctly but + * the listener can use this notification to know that it can ignore the + * msgAdded notification that's coming for aNewHdr. We do NOT send a + * msgsDeleted notification for the pseudo header. + * + * @param aOldKey The fake UID. The header with this key has been removed + * by the time this is called. + * @param aNewHdr The header that replaces the header with aOldKey. + */ + void msgKeyChanged(in nsMsgKey aOldKey, in nsIMsgDBHdr aNewHdr); + + /** + * msgUnincorporatedMoved: A message received via POP was moved by a + * "before junk" rule. + * + * @param {nsIMsgFolder} srcFolder - Folder the message was moved from. + * @param {nsIMsgDBHdr} msg - The message. + */ + void msgUnincorporatedMoved(in nsIMsgFolder srcFolder, in nsIMsgDBHdr msg); + + /** + * Notified after a folder has been added. + * + * @param aFolder The folder that has just been added + */ + void folderAdded(in nsIMsgFolder aFolder); + + /** + * Notified after a folder has been deleted and its corresponding file(s) deleted from disk. + * + * @param aFolder The folder that has just been deleted + * + * @note + * "Deleting" to a trash folder is actually a move, and is covered by folderMoveCopyCompleted() + */ + void folderDeleted(in nsIMsgFolder aFolder); + + /** + * Notified after a command to move or copy a folder completes. In case of a move, at this point, + * the original folder and its files have already been moved to the new location. + * + * @param aMove true if a move, false if a copy + * @param aSrcFolder The original folder that was moved + * @param aDestFolder The parent folder this folder was moved to + */ + void folderMoveCopyCompleted(in boolean aMove, + in nsIMsgFolder aSrcFolder, + in nsIMsgFolder aDestFolder); + + /** + * Notified after a folder is renamed. + * + * @param aOrigFolder The folder with the old name + * @param aNewFolder The folder with the new name + */ + void folderRenamed(in nsIMsgFolder aOrigFolder, in nsIMsgFolder aNewFolder); + + + /** + * Called to indicate nsIMsgFolderCompactor is beginning compaction of the + * folder. If the summary file was missing or out-of-date and a parse + * is required, this notification will come after the completion of the + * parse. The compactor will be holding the folder's semaphore when + * this notification is generated. This only happens for local folders + * currently. + * + * @param {nsIMsgFolder} folder - Target folder of the compaction. + */ + void folderCompactStart(in nsIMsgFolder folder); + + + /** + * Called when nsIMsgFolderCompactor has completed compaction of the folder. + * At this point, the folder semaphore has been released and the database + * has been committed. + * + * @param {nsIMsgFolder} folder - Target folder of the compaction. + */ + void folderCompactFinish(in nsIMsgFolder folder); + + /** + * The user has opted to rebuild the mork msf index for a folder. + * Following this notification, the database will be closed, backed up + * (so that header properties can be propagated), and then rebuilt from the + * source. The rebuild is triggered by a call to updateFolder, so an + * nsIFolderListener OnFolderEvent(folder, FolderLoaded atom) notification + * will be received if you want to know when this is all completed. + * Note: this event is only generated for Thunderbird because the event + * currently comes from Thunderbird-specific code. + * + * @param {nsIMsgFolder} folder - The folder being reindexed. + */ + void folderReindexTriggered(in nsIMsgFolder folder); +}; diff --git a/comm/mailnews/base/public/nsIMsgFolderNotificationService.idl b/comm/mailnews/base/public/nsIMsgFolderNotificationService.idl new file mode 100644 index 0000000000..79cf0fb7d2 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgFolderNotificationService.idl @@ -0,0 +1,119 @@ +/* -*- 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" +#include "MailNewsTypes2.idl" + +interface nsIMsgDBHdr; +interface nsIMsgFolder; +interface nsIMsgFolderListener; + +typedef unsigned long msgFolderListenerFlag; + + +/** + * nsIMsgFolderNotificationService provides a central point for sending out + * notifications related to folders. + * nsIMsgFolderListeners are registered with the service along with flags to + * indicate which kinds of notifications are of interest. + */ +[scriptable, uuid(e54a592c-2f23-4771-9670-bdb9d4f5dbbd)] +interface nsIMsgFolderNotificationService : nsISupports { + /** + * @name Notification flags + * These flags determine which notifications will be sent. + * @{ + */ + /// nsIMsgFolderListener::msgAdded notification + const msgFolderListenerFlag msgAdded = 0x1; + + /// nsIMsgFolderListener::msgsDeleted notification + const msgFolderListenerFlag msgsDeleted = 0x2; + + /// nsIMsgFolderListener::msgsMoveCopyCompleted notification + const msgFolderListenerFlag msgsMoveCopyCompleted = 0x4; + + /// nsIMsgFolderListener::msgsClassified notification + const msgFolderListenerFlag msgsClassified = 0x8; + + /// nsIMsgFolderListener::msgsJunkStatusChanged notification + const msgFolderListenerFlag msgsJunkStatusChanged = 0x10; + + /// nsIMsgFolderListener::msgUnincorporatedMoved notification + const msgFolderListenerFlag msgUnincorporatedMoved = 0x20; + + /// nsIMsgFolderListener::folderAdded notification + const msgFolderListenerFlag folderAdded = 0x8000; + + /// nsIMsgFolderListener::folderDeleted notification + const msgFolderListenerFlag folderDeleted = 0x1000; + + /// nsIMsgFolderListener::folderMoveCopyCompleted notification + const msgFolderListenerFlag folderMoveCopyCompleted = 0x2000; + + /// nsIMsgFolderListener::folderRenamed notification + const msgFolderListenerFlag folderRenamed = 0x4000; + + /// nsIMsgFolderListener::folderCompactStart notification + const msgFolderListenerFlag folderCompactStart = 0x10000; + + /// nsIMsgFolderListener::folderCompactFinish notification + const msgFolderListenerFlag folderCompactFinish = 0x20000; + + /// nsIMsgFolderListener::folderReindexTriggered notification + const msgFolderListenerFlag folderReindexTriggered = 0x40000; + + /// nsIMsgFolderListener::msgKeyChanged notification + const msgFolderListenerFlag msgKeyChanged = 0x2000000; + + /** @} */ + + readonly attribute boolean hasListeners; + void addListener(in nsIMsgFolderListener aListener, + in msgFolderListenerFlag flags); + void removeListener(in nsIMsgFolderListener aListener); + + // message-specific functions + // single message for added, array for delete/move/copy + void notifyMsgAdded(in nsIMsgDBHdr aMsg); + void notifyMsgsClassified(in Array<nsIMsgDBHdr> aMsgs, + in boolean aJunkProcessed, + in boolean aTraitProcessed); + void notifyMsgsJunkStatusChanged(in Array<nsIMsgDBHdr> messages); + void notifyMsgsDeleted(in Array<nsIMsgDBHdr> aMsgs); + void notifyMsgsMoveCopyCompleted(in boolean aMove, + in Array<nsIMsgDBHdr> aSrcMsgs, + in nsIMsgFolder aDestFolder, + in Array<nsIMsgDBHdr> aDestMsgs); + + /** + * Notify listeners that the msg key for a header has changed. Currently, + * this is used when we create a header for an offline imap move result, + * without knowing what the ultimate UID will be. When we download the + * headers for the new message, we replace the old "pseudo" header with + * a new header that has the correct UID/message key, by cloning the pseudo + * header, which maintains all the existing header attributes. + * + * @param aOldKey The fake UID. The header with this key has been removed + * by the time this is called. + * @param aNewHdr The header that replaces the header with aOldKey. + */ + void notifyMsgKeyChanged(in nsMsgKey aOldKey, in nsIMsgDBHdr aNewHdr); + + void notifyMsgUnincorporatedMoved(in nsIMsgFolder srcFolder, in nsIMsgDBHdr msg); + + // folder specific functions + // single folders, all the time + void notifyFolderAdded(in nsIMsgFolder aFolder); + void notifyFolderDeleted(in nsIMsgFolder aFolder); + void notifyFolderMoveCopyCompleted(in boolean aMove, + in nsIMsgFolder aSrcFolder, + in nsIMsgFolder aDestFolder); + void notifyFolderRenamed(in nsIMsgFolder aOrigFolder, + in nsIMsgFolder aNewFolder); + + void notifyFolderCompactStart(in nsIMsgFolder folder); + void notifyFolderCompactFinish(in nsIMsgFolder folder); + void notifyFolderReindexTriggered(in nsIMsgFolder folder); +}; diff --git a/comm/mailnews/base/public/nsIMsgHdr.idl b/comm/mailnews/base/public/nsIMsgHdr.idl new file mode 100644 index 0000000000..14dc6cddf1 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgHdr.idl @@ -0,0 +1,109 @@ +/* -*- 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 nsIMsgFolder; +interface nsIUTF8StringEnumerator; + +[scriptable, uuid(3c11ddbe-c805-40c5-b9c9-d065fad5d0be)] +interface nsIMsgDBHdr : nsISupports +{ + void setStringProperty(in string propertyName, in AUTF8String propertyValue); + AUTF8String getStringProperty(in string propertyName); + unsigned long getUint32Property(in string propertyName); + void setUint32Property(in string propertyName, + in unsigned long propertyVal); + + // accessors, to make our JS cleaner + readonly attribute boolean isRead; + readonly attribute boolean isFlagged; + + // Special accessor that checks if a message is part of an ignored subthread + readonly attribute boolean isKilled; + + // Mark message routines + void markRead(in boolean read); + void markFlagged(in boolean flagged); + void markHasAttachments(in boolean hasAttachments); + + attribute nsMsgPriorityValue priority; + + /* flag handling routines */ + attribute unsigned long flags; + unsigned long orFlags(in unsigned long flags); + unsigned long andFlags(in unsigned long flags); + + /* various threading stuff */ + attribute nsMsgKey threadId; + attribute nsMsgKey messageKey; + attribute nsMsgKey threadParent; + + /* meta information about the message, learned from reading the message */ + + /** + * For "Offline" supporting folders (IMAP, NNTP), .messageSize is + * the size of the original message on the server. + * For Local folders, this is the exact size of the message as written to + * the msgStore. + * See also Bug 1764857. + */ + attribute unsigned long messageSize; + attribute unsigned long lineCount; + /** + * The offset into the local folder/offline store of the message. This + * will be pluggable store-dependent, e.g., for mail dir it should + * always be 0. + */ + attribute unsigned long long messageOffset; + /** + * For "Offline" supporting folders (IMAP, NNTP): .offlineMessageSize is + * the exact size of the local copy of the message in the msgStore. + * If the message is not flagged Offline, this will be zero or unset. + * For Local folders, this is unset or zero. + * See also Bug 1764857. + */ + attribute unsigned long offlineMessageSize; + /* common headers */ + attribute PRTime date; + readonly attribute unsigned long dateInSeconds; + attribute string messageId; + attribute string ccList; + attribute string bccList; + attribute string author; + attribute AUTF8String subject; + attribute string recipients; + + /* anything below here still has to be fixed */ + void setReferences(in AUTF8String references); + readonly attribute unsigned short numReferences; + AUTF8String getStringReference(in long refNum); + + readonly attribute AString mime2DecodedAuthor; + readonly attribute AString mime2DecodedSubject; + readonly attribute AString mime2DecodedRecipients; + + Array<octet> getAuthorCollationKey(); + Array<octet> getSubjectCollationKey(); + Array<octet> getRecipientsCollationKey(); + + attribute string charset; + + /** + * Returns the effective character set for the message (@ref charset). + * For NNTP, if there is no specific set defined for the message, + * the character set of the server instead. + */ + readonly attribute ACString effectiveCharset; + + attribute string accountKey; + readonly attribute nsIMsgFolder folder; + + /// Array of names of all database properties in the header. + readonly attribute Array<AUTF8String> properties; +}; +/* *******************************************************************************/ diff --git a/comm/mailnews/base/public/nsIMsgIdentity.idl b/comm/mailnews/base/public/nsIMsgIdentity.idl new file mode 100644 index 0000000000..f02a240694 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgIdentity.idl @@ -0,0 +1,311 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "nsIFile.idl" + +/** + * This interface contains all the personal outgoing mail information + * for a given person. + * Each identity is identified by a key, which is the <id> string in + * the identity preferences, such as in mail.identity.<id>.replyTo. + */ +[scriptable, uuid(9dede9a0-f6fc-4afc-8fc9-a6af52414b3d)] +interface nsIMsgIdentity : nsISupports { + /** + * Internal preferences ID. + */ + attribute ACString key; + + /** + * A unique identifier for this identity that can be used for the same + * identity synced across multiple profiles. Auto-generated on first use. + */ + attribute AUTF8String UID; + + /** + * Label describing this identity. May be empty. + */ + attribute AString label; + + /** + * Pretty display name to identify this specific identity. Will return a + * composed string like "fullname <email> (label)". + */ + readonly attribute AString identityName; + + /** + * User's full name, i.e. John Doe. + */ + attribute AString fullName; + + /** + * User's e-mail address, i.e. john@doe.com. + */ + attribute ACString email; + + /** + * Do we use multiple e-mail addresses (like Catch-All) with this identity? + */ + attribute boolean catchAll; + + /** + * Hint for when to use this identity as catch all. It is a comma separated + * list of things to look for delivery in headers when replying to a message + * that was not directly addressed to a matching identity. + */ + attribute AUTF8String catchAllHint; + + /** + * Formats fullName and email into the proper string to use as sender: + * name <email> + */ + readonly attribute AString fullAddress; + + /** + * Optional replyTo address, i.e. johnNOSPAM@doe.com. + */ + attribute AUTF8String replyTo; + + /** + * Optional organization. + */ + attribute AString organization; + + /** + * Should we compose with HTML by default? + */ + attribute boolean composeHtml; + + /** + * Should we attach a signature from file? + */ + attribute boolean attachSignature; + + /** + * Should we attach a vcard by default? + */ + attribute boolean attachVCard; + + /** + * Should we automatically quote the original message? + */ + attribute boolean autoQuote; + + /** + * What should our quoting preference be? + */ + attribute long replyOnTop; + + /** + * Should our signature be at the end of the quoted text when replying + * above it? + */ + attribute boolean sigBottom; + + /** + * Include a signature when forwarding a message? + */ + attribute boolean sigOnForward; + + /** + * Include a signature when replying to a message? + */ + attribute boolean sigOnReply; + + /** + * The current signature file. + */ + attribute nsIFile signature; + + /** + * Modification time of the signature file. + */ + attribute long signatureDate; + + /** + * Signature text if not read from file; format depends on htmlSigFormat. + */ + attribute AString htmlSigText; + + /** + * Does htmlSigText contain HTML? Use plain text if false. + */ + attribute boolean htmlSigFormat; + + /** + * Suppress the double-dash signature separator + */ + attribute boolean suppressSigSep; + + /** + * The encoded string representing the vcard. + */ + attribute ACString escapedVCard; + + attribute boolean doFcc; + /// URI for the fcc (Sent) folder + attribute AUTF8String fccFolder; + attribute boolean fccReplyFollowsParent; + + /** + * @{ + * these attributes control whether the special folder pickers for + * fcc, drafts,archives, and templates are set to pick between servers + * (e.g., Sent on accountName) or to pick any folder on any account. + * "0" means choose between servers; "1" means use the full folder picker. + */ + attribute ACString fccFolderPickerMode; + attribute ACString draftsFolderPickerMode; + attribute ACString archivesFolderPickerMode; + attribute ACString tmplFolderPickerMode; + /** @} */ + + // Don't call bccSelf, bccOthers, and bccList directly, they are + // only used for migration and backward compatibility. Use doBcc + // and doBccList instead. + attribute boolean bccSelf; + attribute boolean bccOthers; + attribute ACString bccList; + + attribute boolean doCc; + attribute AUTF8String doCcList; + + attribute boolean doBcc; + attribute AUTF8String doBccList; + /** + * @{ + * URIs for the special folders (drafts, templates, archive) + */ + attribute AUTF8String draftFolder; + attribute AUTF8String archiveFolder; + attribute AUTF8String stationeryFolder; + /** @} */ + + attribute boolean archiveEnabled; + /** + * @{ + * This attribute and constants control the granularity of sub-folders of the + * Archives folder - either messages go in the single archive folder, or a + * yearly archive folder, or in a monthly archive folder with a yearly + * parent folder. If the server doesn't support folders that both contain + * messages and have sub-folders, we will ignore this setting. + */ + attribute long archiveGranularity; + const long singleArchiveFolder = 0; + const long perYearArchiveFolders = 1; + const long perMonthArchiveFolders = 2; + /// Maintain the source folder name when creating Archive subfolders + attribute boolean archiveKeepFolderStructure; + /** @} */ + + attribute boolean showSaveMsgDlg; + attribute ACString directoryServer; + attribute boolean overrideGlobalPref; + /** + * If this is false, don't append the user's domain + * to an autocomplete address with no matches + */ + attribute boolean autocompleteToMyDomain; + /** + * valid determines if the UI should use this identity + * and the wizard uses this to determine whether or not + * to ask the user to complete all the fields + */ + attribute boolean valid; + + /** + * this is really dangerous. this destroys all pref values + * do not call this unless you know what you're doing! + */ + void clearAllValues(); + + /** + * the preferred smtp server for this identity. + * if this is set, this the smtp server that should be used + * for the message send + */ + attribute ACString smtpServerKey; + + /** + * default request for return receipt option for this identity + * if this is set, the Return Receipt menu item on the compose + * window will be checked + */ + readonly attribute boolean requestReturnReceipt; + readonly attribute long receiptHeaderType; + + /** + * default request for DSN option for this identity + * if this is set, the DSN menu item on the compose + * window will be checked + */ + readonly attribute boolean requestDSN; + + /** + * If true, include supported Autocrypt headers whenever sending a + * plain text or OpenPGP message. (Ignored when sending S/MIME.) + */ + attribute boolean sendAutocryptHeaders; + + /** + * If true, automatically attach the user's own public OpenPGP key + * whenever adding an OpenPGP digital signature. + */ + attribute boolean attachPgpKey; + + /** + * If true, encrypt draft messages that are saved to disk or on the + * mail server. This requires that a personal OpenPGP key or S/MIME + * certificate is configured and valid, matching the selected + * encryption technology for the current message. + */ + attribute boolean autoEncryptDrafts; + + /* + * If true, when sending an OpenPGP encrypted message, encrypt the + * email's subject, too. + */ + attribute boolean protectSubject; + + /* + * The default encryption setting for new emails that aren't already + * in an encryption context. (When forwarding or replying to an + * encrypted message we always automatically turn on encryption.) + * 0: disable encryption + * 1: optional encryption (not implemented) + * 2: require encryption + */ + attribute long encryptionPolicy; + + /* + * If true, add a digital signature for messages that aren't using + * encryption. (A message that uses encryption will automatically + * have signing enabled.) + */ + attribute boolean signMail; + + /* copy the attributes of the identity we pass in */ + void copy(in nsIMsgIdentity identity); + + /** + * these generic getter / setters, useful for extending mailnews + * note, these attributes persist across sessions + */ + AString getUnicharAttribute(in string name); + void setUnicharAttribute(in string name, in AString value); + + ACString getCharAttribute(in string name); + void setCharAttribute(in string name, in ACString value); + + boolean getBoolAttribute(in string name); + void setBoolAttribute(in string name, in boolean value); + + long getIntAttribute(in string name); + void setIntAttribute(in string name, in long value); + + /* useful for debugging */ + AString toString(); +}; diff --git a/comm/mailnews/base/public/nsIMsgIncomingServer.idl b/comm/mailnews/base/public/nsIMsgIncomingServer.idl new file mode 100644 index 0000000000..c1b4c7e16d --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgIncomingServer.idl @@ -0,0 +1,596 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "MailNewsTypes2.idl" + +interface nsIMsgFolder; +interface nsIMsgFolderCache; +interface nsIMsgWindow; +interface nsIMsgProtocolInfo; +interface nsIMsgFilterList; +interface nsIMsgRetentionSettings; +interface nsIMsgDownloadSettings; +interface nsISpamSettings; +interface nsIMsgFilterPlugin; +interface nsIUrlListener; +interface nsIMsgDBHdr; +interface nsIFile; +interface nsIURI; +interface nsIMsgPluggableStore; + +/* + * Interface for incoming mail/news host + * this is the base interface for all mail server types (imap, pop, nntp, etc) + * often you will want to add extra interfaces that give you server-specific + * attributes and methods. + */ +[scriptable, uuid(aa9a3389-9dac-41f1-9ec5-18287cfaa47c)] +interface nsIMsgIncomingServer : nsISupports { + + /** + * internal pref key - guaranteed to be unique across all servers + */ + attribute ACString key; + + /** + * A unique identifier for this server that can be used for the same + * server synced across multiple profiles. Auto-generated on first use. + */ + attribute AUTF8String UID; + + /** + * pretty name - should be "userid on hostname" + * if the pref is not set + */ + attribute AString prettyName; + + /** + * helper function to construct the pretty name in a server type + * specific way - e.g., mail for foo@test.com, news on news.mozilla.org + */ + readonly attribute AString constructedPrettyName; + + /** + * hostname of the server + */ + attribute AUTF8String hostName; + + /* port of the server */ + attribute long port; + + /** + * userid to log into the server + */ + attribute AUTF8String username; + + /** + * protocol type, i.e. "pop3", "imap", "nntp", "none", etc + * used to construct URLs + */ + attribute ACString type; + + /** + * The CLIENTID to use for this server. + * @see https://tools.ietf.org/html/draft-yu-imap-client-id-01 + */ + attribute ACString clientid; + + /** + * Whether the CLIENTID feature above is enabled. + */ + attribute boolean clientidEnabled; + + /** + * The proper instance of nsIMsgProtocolInfo corresponding to this server type. + */ + readonly attribute nsIMsgProtocolInfo protocolInfo; + + readonly attribute AString accountManagerChrome; + + /** + * The schema for the local mail store, such as "mailbox", "imap", or "news" + * used to construct URIs. The contractID for the nsIMsgMessageService + * implementation that will manage access to messages associated with this + * server is constructed using this type. + */ + readonly attribute ACString localStoreType; + + /** + * The schema for the nsIMsgDatabase implementation, such as "mailbox" or + * "imap", that will be used to construct the database instance used by + * message folders associated with this server. + */ + readonly attribute ACString localDatabaseType; + + // Perform specific tasks (reset flags, remove files, etc) for account user/server name changes. + void onUserOrHostNameChanged(in AUTF8String oldName, in AUTF8String newName, + in bool hostnameChanged); + + /// cleartext utf16 version of the password + attribute AString password; + + /** + * Attempts to get the password first from the password manager, if that + * fails it will attempt to get it from the user if aMsgWindow is supplied. + * + * @param aPromptString The text of the prompt if the user is prompted for + * password. + * @param aPromptTitle The title of the prompt if the user is prompted. + * @return The obtained password. Could be an empty password. + * + * @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 getPasswordWithUI(in AString aPromptString, in AString aPromptTitle); + + /* forget the password in memory and in single signon database */ + void forgetPassword(); + + /** + * Forget the password in memory which is cached for the session. + * + * @param modifyLogin Only relevant for nsImapIncomingServer override. When + * true and authentication method is oauth2, the password + * and user authenticated flag are not cleared. + */ + void forgetSessionPassword(in boolean modifyLogin); + + /* should we download whole messages when biff goes off? */ + attribute boolean downloadOnBiff; + + /* should we biff the server? */ + attribute boolean doBiff; + + /* how often to biff */ + attribute long biffMinutes; + + /* current biff state */ + attribute unsigned long biffState; + + /* are we running a url as a result of biff going off? (different from user clicking get msg) */ + attribute boolean performingBiff; + + /* the on-disk path to message storage for this server */ + attribute nsIFile localPath; + + /// message store to use for the folders under this server. + readonly attribute nsIMsgPluggableStore msgStore; + + /* the RDF URI for the root mail folder */ + readonly attribute AUTF8String serverURI; + + /* the root folder for this server, even if server is deferred */ + attribute nsIMsgFolder rootFolder; + + /* root folder for this account + - if account is deferred, root folder of deferred-to account */ + readonly attribute nsIMsgFolder rootMsgFolder; + + /* are we already getting new Messages on the current server.. + This is used to help us prevent multiple get new msg commands from + going off at the same time. */ + attribute boolean serverBusy; + + /** + * Is the server using a secure channel (SSL or STARTTLS). + */ + readonly attribute boolean isSecure; + + /** + * Authentication mechanism. + * + * @see nsMsgAuthMethod (in MailNewsTypes2.idl) + * Same as "mail.server...authMethod" pref + */ + attribute nsMsgAuthMethodValue authMethod; + + /** + * Whether to SSL or STARTTLS or not + * + * @see nsMsgSocketType (in MailNewsTypes2.idl) + * Same as "mail.server...socketType" pref + */ + attribute nsMsgSocketTypeValue socketType; + + /* empty trash on exit */ + attribute boolean emptyTrashOnExit; + + /** + * Get the server's list of filters. + * + * This SHOULD be the same filter list as the root folder's, if the server + * supports per-folder filters. Furthermore, this list SHOULD be used for all + * incoming messages. + * + * Since the returned nsIMsgFilterList is mutable, it is not necessary to call + * setFilterList after the filters have been changed. + * + * @param aMsgWindow @ref msgwindow "The standard message window" + * @return The list of filters. + */ + nsIMsgFilterList getFilterList(in nsIMsgWindow aMsgWindow); + + /** + * Set the server's list of filters. + * + * Note that this does not persist the filter list. To change the contents + * of the existing filters, use getFilterList and mutate the values as + * appropriate. + * + * @param aFilterList The new list of filters. + */ + void setFilterList(in nsIMsgFilterList aFilterList); + + /** + * Get user editable filter list. This does not have to be the same as + * the filterlist above, typically depending on the users preferences. + * The filters in this list are not processed, but only to be edited by + * the user. + * @see getFilterList + * + * @param aMsgWindow @ref msgwindow "The standard message window" + * @return The list of filters. + */ + nsIMsgFilterList getEditableFilterList(in nsIMsgWindow aMsgWindow); + + /** + * Set user editable filter list. + * This does not persist the filterlist, @see setFilterList + * @see getEditableFilterList + * @see setFilterList + * + * @param aFilterList The new list of filters. + */ + void setEditableFilterList(in nsIMsgFilterList aFilterList); + + /* we use this to set the default local path. we use this when migrating prefs */ + void setDefaultLocalPath(in nsIFile aDefaultLocalPath); + + /** + * Verify that we can logon + * + * @param aUrlListener - gets called back with success or failure. + * @param aMsgWindow nsIMsgWindow to use for notification callbacks. + * @return - the url that we run. + */ + nsIURI verifyLogon(in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + /* do a biff */ + void performBiff(in nsIMsgWindow aMsgWindow); + + /* get new messages */ + void getNewMessages(in nsIMsgFolder aFolder, in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener); + /* this checks if a server needs a password to do biff */ + readonly attribute boolean serverRequiresPasswordForBiff; + + /* this gets called when the server is expanded in the folder pane */ + void performExpand(in nsIMsgWindow aMsgWindow); + + /* Write out all known folder data to folderCache */ + void writeToFolderCache(in nsIMsgFolderCache folderCache); + + /* close any server connections */ + void closeCachedConnections(); + + /* ... */ + void shutdown(); + + /** + * Get or set the value as determined by the preference tree. + * + * These methods MUST NOT fail if the preference is not set, and therefore + * they MUST have a default value. This default value is provided in practice + * by use of a default preference tree. The standard format for the pref + * branches are <tt>mail.server.<i>key</i>.</tt> for per-server preferences, + * such that the preference is <tt>mail.server.<i>key</i>.<i>attr</i></tt>. + * + * The attributes are passed in as strings for ease of access by the C++ + * consumers of this method. + * + * @param attr The value for which the preference should be accessed. + * @param value The value of the preference to set. + * @return The value of the preference. + * @{ + */ + boolean getBoolValue(in string attr); + void setBoolValue(in string attr, in boolean value); + + ACString getCharValue(in string attr); + void setCharValue(in string attr, in ACString value); + + AString getUnicharValue(in string attr); + void setUnicharValue(in string attr, in AString value); + + long getIntValue(in string attr); + void setIntValue(in string attr, in long value); + /** @} */ + + /** + * Get or set the value as determined by the preference tree. + * + * These methods MUST NOT fail if the preference is not set, and therefore + * they MUST have a default value. This default value is provided in practice + * by use of a default preference tree. The standard format for the pref + * branches are <tt>mail.server.<i>key</i>.</tt> for per-server preferences, + * such that the preference is <tt>mail.server.<i>key</i>.<i>attr</i></tt>. + * + * The attributes are passed in as strings for ease of access by the C++ + * consumers of this method. + * + * There are two preference names on here for legacy reasons, where the first + * is the name which will be using a (preferred) relative preference and the + * second a deprecated absolute preference. Implementations that do not have + * to worry about supporting legacy preferences can safely ignore this second + * parameter. Callers must still provide a valid value, though. + * + * @param relpref The name of the relative file preference. + * @param absref The name of the absolute file preference. + * @param aValue The value of the preference to set. + * @return The value of the preference. + * @{ + */ + nsIFile getFileValue(in string relpref, in string abspref); + void setFileValue(in string relpref, in string abspref, in nsIFile aValue); + /** @} */ + + /** + * this is really dangerous. this destroys all pref values + * do not call this unless you know what you're doing! + */ + void clearAllValues(); + + /** + * This is also very dangerous. This will low-level remove the files + * associated with this server on disk. It does not notify any listeners. + */ + void removeFiles(); + + attribute boolean valid; + + AString toString(); + + /* used for comparing nsIMsgIncomingServers */ + boolean equals(in nsIMsgIncomingServer server); + + /* Get Messages at startup */ + readonly attribute boolean downloadMessagesAtStartup; + + /* check to this if the server supports filters */ + attribute boolean canHaveFilters; + + /** + * can this server be removed from the account manager? for + * instance, local mail is not removable, but an imported folder is + */ + attribute boolean canDelete; + + attribute boolean loginAtStartUp; + + attribute boolean limitOfflineMessageSize; + attribute long maxMessageSize; + + attribute nsIMsgRetentionSettings retentionSettings; + + /* check if this server can be a default server */ + readonly attribute boolean canBeDefaultServer; + + /* check if this server allows search operations */ + readonly attribute boolean canSearchMessages; + + /* display startup page once per account per session */ + attribute boolean displayStartupPage; + attribute nsIMsgDownloadSettings downloadSettings; + + /* + * Offline support level. Support level can vary based on abilities + * and features each server can offer wrt to offline service. + * Here is the legend to determine the each support level details + * + * supportLevel == 0 --> no offline support (default) + * supportLevel == 10 --> regular offline feature support + * supportLevel == 20 --> extended offline feature support + * + * Each server can initialize itself to the support level if needed + * to override the default choice i.e., no offline support. + * + * POP3, None will default to 0. + * IMAP level 10 and NEWS with level 20. + * + */ + attribute long offlineSupportLevel; + + /* create pretty name for migrated accounts */ + AString generatePrettyNameForMigration(); + + /* does this server have disk space settings? */ + readonly attribute boolean supportsDiskSpace; + + /** + * Hide this server/account from the UI - used for smart mailboxes. + * The server can be retrieved from the account manager by name using the + * various Find methods, but nsIMsgAccountManager's GetAccounts and + * GetAllServers methods won't return the server/account. + */ + attribute boolean hidden; + + /** + * If the server supports Fcc/Sent/etc, default prefs can point to + * the server. Otherwise, copies and folders prefs should point to + * Local Folders. + * + * By default this value is set to true via global pref 'allows_specialfolders_usage' + * (mailnews.js). For Nntp, the value is overridden to be false. + * If ISPs want to modify this value, they should do that in their rdf file + * by using this attribute. Please look at mozilla/mailnews/base/ispdata/aol.rdf for + * usage example. + */ + attribute boolean defaultCopiesAndFoldersPrefsToServer; + + /* can this server allows sub folder creation */ + attribute boolean canCreateFoldersOnServer; + + /* can this server allows message filing ? */ + attribute boolean canFileMessagesOnServer; + + /* can this server allow compacting folders ? */ + readonly attribute boolean canCompactFoldersOnServer; + + /* can this server allow undo delete ? */ + readonly attribute boolean canUndoDeleteOnServer; + + /* used for setting up the filter UI */ + readonly attribute nsMsgSearchScopeValue filterScope; + + /* used for setting up the search UI */ + readonly attribute nsMsgSearchScopeValue searchScope; + + /** + * If the password for the server is available either via authentication + * in the current session or from password manager stored entries, return + * false. Otherwise, return true. If password is obtained from password + * manager, set the password member variable. + */ + readonly attribute boolean passwordPromptRequired; + + /** + * for mail, this configures both the MDN filter, and the server-side + * spam filter filters, if needed. + * + * If we have set up to filter return receipts into + * our Sent folder, this utility method creates + * a filter to do that, and adds it to our filterList + * if it doesn't exist. If it does, it will enable it. + * + * this is not used by news filters (yet). + */ + void configureTemporaryFilters(in nsIMsgFilterList filterList); + + /** + * If Sent folder pref is changed we need to clear the temporary + * return receipt filter so that the new return receipt filter can + * be recreated (by ConfigureTemporaryReturnReceiptsFilter()). + */ + void clearTemporaryReturnReceiptsFilter(); + + /** + * spam settings + */ + readonly attribute nsISpamSettings spamSettings; + readonly attribute nsIMsgFilterPlugin spamFilterPlugin; + + nsIMsgFolder getMsgFolderFromURI(in nsIMsgFolder aFolderResource, in AUTF8String aURI); + + /// Indicates if any other server has deferred storage to this account. + readonly attribute boolean isDeferredTo; + + const long keepDups = 0; + const long deleteDups = 1; + const long moveDupsToTrash = 2; + const long markDupsRead = 3; + + attribute long incomingDuplicateAction; + + // check if new hdr is a duplicate of a recently arrived header + boolean isNewHdrDuplicate(in nsIMsgDBHdr aNewHdr); + + /** + * Set a boolean to force an inherited propertyName to return empty instead + * of inheriting from a parent folder, server, or the global + * + * @param propertyName The name of the property + * @param aForcePropertyEmpty true if an empty inherited property should be returned + */ + void setForcePropertyEmpty(in string propertyName, in boolean aForcePropertyEmpty); + + /** + * Get a boolean to force an inherited propertyName to return empty instead + * of inheriting from a parent folder, server, or the global + * + * @param propertyName The name of the property + * + * @return true if an empty inherited property should be returned + */ + boolean getForcePropertyEmpty(in string propertyName); + + /** + * Return the order in which this server type should appear in the folder pane. + * This sort order is a number between 100000000 and 900000000 so that RDF can + * use it as a string. + * The current return values are these: + * 0 = default account, 100000000 = mail accounts (POP3/IMAP4), + * 200000000 = Local Folders, 300000000 = IM accounts, + * 400000000 = RSS, 500000000 = News + * If a new server type is created a TB UI reviewer must decide its sort order. + */ + readonly attribute long sortOrder; +}; + +%{C++ +/* + * Following values for offline support have been used by + * various files. If you are modifying any of the values + * below, please do take care of the following files. + * - mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp + * - mozilla/mailnews/base/util/nsMsgIncomingServer.cpp + * - mozilla/mailnews/imap/src/nsImapIncomingServer.cpp + * - mozilla/mailnews/local/src/nsPop3IncomingServer.cpp + * - mozilla/mailnews/news/src/nsNntpIncomingServer.cpp + * - mozilla/mailnews/base/content/msgAccountCentral.js + * - mozilla/modules/libpref/src/init/mailnews.js + * - ns/modules/libpref/src/init/mailnews-ns.js + * - ns/mailnews/base/ispdata/aol.rdf + * - ns/mailnews/base/ispdata/nswebmail.rdf + */ +#define OFFLINE_SUPPORT_LEVEL_NONE 0 +#define OFFLINE_SUPPORT_LEVEL_REGULAR 10 +#define OFFLINE_SUPPORT_LEVEL_EXTENDED 20 +#define OFFLINE_SUPPORT_LEVEL_UNDEFINED -1 + +// Value when no port setting is found +#define PORT_NOT_SET -1 + +/* some useful macros to implement nsIMsgIncomingServer accessors */ +#define NS_IMPL_SERVERPREF_STR(_class, _postfix, _prefname) \ +NS_IMETHODIMP \ +_class::Get##_postfix(nsACString& retval) \ +{ \ + return GetCharValue(_prefname, retval); \ +} \ +NS_IMETHODIMP \ +_class::Set##_postfix(const nsACString& chvalue) \ +{ \ + return SetCharValue(_prefname, chvalue); \ +} + +#define NS_IMPL_SERVERPREF_BOOL(_class, _postfix, _prefname)\ +NS_IMETHODIMP \ +_class::Get##_postfix(bool *retval) \ +{ \ + return GetBoolValue(_prefname, retval); \ +} \ +NS_IMETHODIMP \ +_class::Set##_postfix(bool bvalue) \ +{ \ + return SetBoolValue(_prefname, bvalue); \ +} + +#define NS_IMPL_SERVERPREF_INT(_class, _postfix, _prefname)\ +NS_IMETHODIMP \ +_class::Get##_postfix(int32_t *retval) \ +{ \ + return GetIntValue(_prefname, retval); \ +} \ +NS_IMETHODIMP \ +_class::Set##_postfix(int32_t ivalue) \ +{ \ + return SetIntValue(_prefname, ivalue); \ +} + +%} diff --git a/comm/mailnews/base/public/nsIMsgMailNewsUrl.idl b/comm/mailnews/base/public/nsIMsgMailNewsUrl.idl new file mode 100644 index 0000000000..290760c6f0 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgMailNewsUrl.idl @@ -0,0 +1,211 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" +#include "nsIURL.idl" + +interface nsIFile; +interface nsIUrlListener; +interface nsIMsgStatusFeedback; +interface nsIMsgIncomingServer; +interface nsIMsgWindow; +interface nsILoadGroup; +interface nsIMsgSearchSession; +interface nsICacheEntry; +interface nsIMimeHeaders; +interface nsIStreamListener; +interface nsIMsgFolder; +interface nsIMsgDBHdr; +interface nsIDocShell; +interface nsITransportSecurityInfo; + +[scriptable, builtinclass, uuid(995455ba-5bb4-4643-8d70-2b877a2e1320)] +interface nsIMsgMailNewsUrl : nsIURL { + [noscript,notxpcom,nostdcall] + nsresult setFileNameInternal(in ACString aFileName); + + [noscript,notxpcom,nostdcall] + nsresult setSpecInternal(in ACString aSpec); + + [noscript,notxpcom,nostdcall] + nsresult setPortInternal(in long aPort); + + [noscript,notxpcom,nostdcall] + nsresult setQueryInternal(in ACString aQuery); + + [noscript,notxpcom,nostdcall] + nsresult setUsernameInternal(in ACString aUsername); + + /////////////////////////////////////////////////////////////////////////////// + // Eventually we'd like to push this type of functionality up into nsIURI. + // The idea is to allow the "application" (the part of the code which wants to + // run a url in order to perform some action) to register itself as a listener + // on url. As a url listener, the app will be informed when the url begins to run + // and when the url is finished. + //////////////////////////////////////////////////////////////////////////////// + void RegisterListener(in nsIUrlListener aUrlListener); + void UnRegisterListener(in nsIUrlListener aUrlListener); + + readonly attribute nsIURI baseURI; + + // if you really want to know what the current state of the url is (running or not + // running) you should look into becoming a urlListener... + void SetUrlState(in boolean runningUrl, in nsresult aStatusCode); + void GetUrlState(out boolean runningUrl); + + readonly attribute nsIMsgIncomingServer server; + + /** + * Transport-level security information (if any), in the case of a security + * error having occurred. + * This value should be considered undefined if an NSS error has not + * occurred. Read it as: "the secInfo that was being used when a failure + * occurred", not: "the secInfo that failed". + * Seems a bit ugly adding more state here, but the idea is that a + * nsIUrlListener.OnStopRunningUrl() needs to be able to access a bad + * certificate, so as to have the option of adding an exemption (See + * Bug 1590473). + */ + attribute nsITransportSecurityInfo failedSecInfo; + + /** + * The folder associated with this url. + * + * @exception NS_ERROR_FAILURE May be thrown if the url does not + * relate to a folder, e.g. standalone + * .eml messages. + */ + attribute nsIMsgFolder folder; + + attribute nsIMsgStatusFeedback statusFeedback; + + /** + * The maximum progress for this URL. This might be a count, or it might + * be a number of bytes. A value of -1 indicates that this is unknown. + */ + attribute long long maxProgress; + + attribute nsIMsgWindow msgWindow; + + // current mime headers if reading message + attribute nsIMimeHeaders mimeHeaders; + + // the load group is computed from the msgWindow + readonly attribute nsILoadGroup loadGroup; + + // search session, if we're running a search. + attribute nsIMsgSearchSession searchSession; + attribute boolean updatingFolder; + attribute boolean msgIsInLocalCache; + attribute boolean suppressErrorMsgs; // used to avoid displaying biff error messages + + /** + * Set after an error occurred. + * It is not translated and contains no parameters. + * It is unique to each different kind of error, i.e. the same + * error has the same code, but a different error has a different code. + * This allows to recover from specific errors programmatically, + * or to keep error statistics. + * If the error comes from a server, the implementor should make + * efforts to pass on comparable server error identifiers and include + * them here, e.g. as suffixes. Example: "imap-sasl-S474", where-as "S474" + * comes from the server annd "imap-sasl-" is the prefix for where the + * server reports appears. + */ + attribute ACString errorCode; + /** + * Set after an error occurred. + * An error message that can be displayed directly + * to the end user without further processing. + * It must have been translated. + * It may contain contain values as part of the message. + */ + attribute AString errorMessage; + + /** + * To be used in error situations, e.g. to give the URI to an error page + * that describes the problem. + */ + attribute AUTF8String seeOtherURI; + + attribute nsICacheEntry memCacheEntry; + + const unsigned long eCopy = 0; + const unsigned long eMove = 1; + const unsigned long eDisplay = 2; + boolean IsUrlType(in unsigned long type); + nsIStreamListener getSaveAsListener(in boolean addDummyEnvelope, in nsIFile aFile); + + /// Returns true if the URI is for a message (e.g., imap-message://) + readonly attribute boolean isMessageUri; + + /** + * Loads the URI in a docshell. This will give priority to loading the + * URI in the passed-in docshell. If it can't be loaded there + * however, the URL dispatcher will go through its normal process of content + * loading. + * + * @param docshell The docshell that will consume the load. + * + * @param aLoadFlags Flags to modify load behaviour. Flags are defined in + * nsIWebNavigation. Normally only LOAD_FLAGS_NONE or + * LOAD_FLAGS_IS_LINK is needed, but there are eleven + * other allowed sets of flags. See nsDocShellLoadTypes.h + */ + void loadURI(in nsIDocShell docshell, + in unsigned long aLoadFlags); + +}; + +////////////////////////////////////////////////////////////////////////////////// +// This is a very small interface which I'm grouping with the mailnewsUrl interface. +// Several url types (mailbox, imap, nntp) have similar properties because they can +// represent mail messages. For instance, these urls can be have URI +// equivalents which represent a message. +// We want to provide the app the ability to get the URI for the +// url. This URI to URL mapping doesn't exist for all mailnews urls...hence I'm +// grouping it into a separate interface... +////////////////////////////////////////////////////////////////////////////////// + +[scriptable, uuid(388a37ec-2e1a-4a4f-9d8b-189bedf1bda2)] +interface nsIMsgMessageUrl : nsISupports { + // get and set the RDF URI associated with the url. Note, not all urls have + // had uri's set on them so be prepared to handle cases where this string is empty. + attribute AUTF8String uri; + // used by imap, pop and nntp in order to implement save message to disk + attribute nsIFile messageFile; + attribute boolean AddDummyEnvelope; + attribute boolean canonicalLineEnding; + attribute AUTF8String originalSpec; + + // This is used when creating a principal for the URL with a "normalized" spec + // that doesn't contain all the bits in the query part that mailnews URLs have. + // We need this to implement nsIURIWithSpecialOrigin, since mailnews URLs + // have ORIGIN_IS_FULL_SPEC. + readonly attribute AUTF8String normalizedSpec; + + /** + * A message db header for that message. + * + * @note This attribute is not guaranteed to be set, so callers that + * actually require an nsIMsgDBHdr will need to use the uri attribute + * on this interface to get the appropriate nsIMsgMessageService and + * then get the header from there. + */ + readonly attribute nsIMsgDBHdr messageHeader; +}; + +////////////////////////////////////////////////////////////////////////////////// +// This is a very small interface which I'm grouping with the mailnewsUrl interface. +// I want to isolate out all the I18N specific information that may be associated with +// any given mailnews url. This gives I18N their own "sandbox" of routines they can add +// and tweak as they see fit. For now it contains mostly charset information. +////////////////////////////////////////////////////////////////////////////////// + +[scriptable, uuid(D71E0785-2862-11d4-98C1-001083010E9B)] +interface nsIMsgI18NUrl : nsISupports { + // when true the user wants us to auto-detect the character set. + attribute boolean autodetectCharset; +}; diff --git a/comm/mailnews/base/public/nsIMsgMailSession.idl b/comm/mailnews/base/public/nsIMsgMailSession.idl new file mode 100644 index 0000000000..d11929edab --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgMailSession.idl @@ -0,0 +1,78 @@ +/* -*- 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" + +/* + * The mail session is a replacement for the old 4.x MSG_Master object. It + * contains mail session generic information such as the account manager, etc + * I'm starting this off as an empty interface and as people feel they need to + * add more information to it, they can. I think this is a better approach + * than trying to port over the old MSG_Master in its entirety as that had a + * lot of cruft in it.... + */ + +#include "nsIFolderListener.idl" + +interface nsIFile; +interface nsIMsgWindow; +interface nsIMsgUserFeedbackListener; +interface nsIMsgMailNewsUrl; + +[scriptable, uuid(577ead34-553e-4cd6-b484-76ff6662082d)] +interface nsIMsgMailSession : nsISupports { + void Shutdown(); + + /** + * Adds a listener to be notified when folders update. + * + * @param aListener The listener to add. + * @param aNotifyFlags A combination of flags detailing on which operations + * to notify the listener. See nsIFolderListener.idl for + * details. + */ + void AddFolderListener(in nsIFolderListener aListener, + in folderListenerNotifyFlagValue aNotifyFlags); + /** + * Removes a listener from the folder notification list. + * + * @param aListener The listener to remove. + */ + void RemoveFolderListener(in nsIFolderListener aListener); + + /** + * Adds a listener to be notified of alert or prompt style feedback that + * should go to the user. + * + * @param aListener The listener to add. + */ + void addUserFeedbackListener(in nsIMsgUserFeedbackListener aListener); + + /** + * Removes a user feedback listener. + * + * @param aListener The listener to remove. + */ + void removeUserFeedbackListener(in nsIMsgUserFeedbackListener aListener); + + /** + * Call to alert the listeners of the message. If there are no listeners, + * or the listeners do not handle the alert, then this function will present + * the user with a modal dialog if aMsgWindow isn't null. + * + * @param aMessage The localized message string to alert. + * @param aUrl Optional mailnews url which is relevant to the operation + * which caused the alert to be generated. + */ + void alertUser(in AString aMessage, [optional] in nsIMsgMailNewsUrl aUrl); + + readonly attribute nsIMsgWindow topmostMsgWindow; + void AddMsgWindow(in nsIMsgWindow msgWindow); + void RemoveMsgWindow(in nsIMsgWindow msgWindow); + boolean IsFolderOpenInWindow(in nsIMsgFolder folder); + + AUTF8String ConvertMsgURIToMsgURL(in AUTF8String aURI, in nsIMsgWindow aMsgWindow); + nsIFile getDataFilesDir(in string dirName); +}; diff --git a/comm/mailnews/base/public/nsIMsgMdnGenerator.idl b/comm/mailnews/base/public/nsIMsgMdnGenerator.idl new file mode 100644 index 0000000000..0da7475f8c --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgMdnGenerator.idl @@ -0,0 +1,70 @@ +/* -*- 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 nsIMsgWindow; +interface nsIMsgFolder; +interface nsIMimeHeaders; + +typedef long EDisposeType; +typedef long ReceiptHdrType; +typedef long MDNIncorporateType; + +[scriptable, uuid(440EA3DE-DACA-4886-9875-84E6CD7D7927)] +interface nsIMsgMdnGenerator : nsISupports +{ + const EDisposeType eDisplayed = 0; + const EDisposeType eDispatched = 1; + const EDisposeType eProcessed = 2; + const EDisposeType eDeleted = 3; + const EDisposeType eDenied = 4; + const EDisposeType eFailed = 5; + + const ReceiptHdrType eDntType = 0; + const ReceiptHdrType eRrtType = 1; + const ReceiptHdrType eDntRrtType = 2; + + const MDNIncorporateType eIncorporateInbox = 0; + const MDNIncorporateType eIncorporateSent = 1; + + /** + * Prepare the sending of a mdn reply, and checks the prefs whether a + * reply should be send. Might send the message automatically if the + * prefs say it should. + * @param eType One of EDisposeType above, indicating the action that led + * to sending the mdn reply + * @param aWindow The window the message was displayed in, acting as parent + * for any (error) dialogs + * @param folder The folder the message is in + * @param key the message key + * @param headers the message headers + * @param autoAction true if the request action led to sending the mdn + * reply was an automatic action, false if it was user initiated + * @returns true if the user needs to be asked for permission + * false in other cases (whether the message was sent or denied) + */ + boolean process(in EDisposeType eType, in nsIMsgWindow aWindow, + in nsIMsgFolder folder, in nsMsgKey key, + in nsIMimeHeaders headers, in boolean autoAction); + + /** + * Must be called when the user was asked for permission and agreed to + * sending the mdn reply. + * May only be called when |process| returned |true|. Behaviour is + * unspecified in other cases + */ + void userAgreed(); + + /** + * Must be called when the user was asked for permission and declined to + * send the mdn reply. + * Will mark the message so that the user won't be asked next time. + * May only be called when |process| returned |true|. Behaviour is + * unspecified in other cases. + */ + void userDeclined(); +}; diff --git a/comm/mailnews/base/public/nsIMsgMessageService.idl b/comm/mailnews/base/public/nsIMsgMessageService.idl new file mode 100644 index 0000000000..93d9902e63 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgMessageService.idl @@ -0,0 +1,226 @@ +/* -*- 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" +#include "MailNewsTypes2.idl" +interface nsIURI; +interface nsIUrlListener; +interface nsIStreamListener; +interface nsIMsgWindow; +interface nsIFile; +interface nsIMsgFolder; +interface nsIMsgSearchSession; +interface nsIMsgDBHdr; +interface nsIStreamConverter; +interface nsICacheEntry; + +%{C++ +#include "MailNewsTypes.h" +%} + +/** + * nsIMsgMessageService provides higher-level, UI-oriented calls for + * dealing with messages in a protocol-agnostic way. + * Things the user would recognise as actions they initiated. + * This covers things like displaying messages, copying them, saving them + * to disk, saving attachments... + */ +[scriptable, uuid(3aa7080a-73ac-4394-9636-fc00e182319b)] +interface nsIMsgMessageService : nsISupports { + + /** + * If you want a handle on the running task, pass in a valid nsIURI + * ptr. You can later interrupt this action by asking the netlib + * service manager to interrupt the url you are given back. + * Remember to release aURL when you are done with it. Pass nullptr + * in for aURL if you don't care about the returned URL. + */ + + /** + * Pass in the URI for the message you want to have copied. + * + * @param aSrcURI + * @param aCopyListener already knows about the destination folder. + * @param aMoveMessage TRUE if you want the message to be moved. + * FALSE leaves it as just a copy. + * @param aUrlListener + * @param aMsgWindow + */ + void copyMessage(in AUTF8String aSrcURI, in nsIStreamListener aCopyListener, in boolean aMoveMessage, + in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow); + + /** + * Copy multiple messages at a time + * + * @param keys + * @param srcFolder + * @param aCopyListener + * @param aMoveMessage + * @param aUrlListener + * @param aMsgWindow + * @returns URI that's run to perform the copy + */ + nsIURI CopyMessages(in Array<nsMsgKey> aKeys, + in nsIMsgFolder srcFolder, + in nsIStreamListener aCopyListener, + in boolean aMoveMessage, + in nsIUrlListener aUrlListener, + in nsIMsgWindow aMsgWindow); + + /** + * When you want a message displayed.... this loads it into the consumer. + * + * @param aMessageURI Is a uri representing the message to display. + * @param aDisplayConsumer Is (for now) an nsIDocShell which we'll use to load + * the message into. + * XXXbz Should it be an nsIWebNavigation or something? + * @param aMsgWindow + * @param aUrlListener + * @param aAutodetectCharset (optional) if the characterset should be auto-detected. + */ + void loadMessage(in AUTF8String aMessageURI, + in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener, + in boolean aAutodetectCharset); + + /** + * When you want to spool a message out to a file on disk. + * This is an asynch operation of course. You must pass in a + * url listener in order to figure out when the operation is done. + * + * @param aMessageURI The uri representing the message to spool out to disk. + * @param aFile The file you want the message saved to + * @param aGenerateDummyEnvelope Usually FALSE. Set to TRUE if you want the msg + * appended at the end of the file. + * @param aUrlListener + * @param aURL + * @param canonicalLineEnding + * @param aMsgWindow + */ + void SaveMessageToDisk(in AUTF8String aMessageURI, in nsIFile aFile, + in boolean aGenerateDummyEnvelope, + in nsIUrlListener aUrlListener, out nsIURI aURL, + in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow); + + /** + * When you have a uri and you would like to convert that + * to a url which can be run through necko, you can use this method. + * the Uri MUST refer to a message and not a folder! + * + * @param aMessageURI A message uri to convert. + * @param aMsgWindow + * + * @return a URL which can be run through necko + */ + nsIURI getUrlForUri(in AUTF8String aMessageURI, [optional] in nsIMsgWindow aMsgWindow); + + /** + * + * + * @param aSearchSession + * @param aMsgWindow + * @param aMsgFolder + * @param aSearchUri + */ + void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aMsgFolder, in AUTF8String aSearchUri); + + /** + * This method streams a message to the passed in consumer. If aConvertData is true, it + * will create a stream converter from message rfc822 to star/star. It will also tack + * aAdditionalHeader onto the url (e.g., "header=filter"). + * + * @param aMessageURI uri of message to stream + * @param aConsumer generally, a stream listener listening to the message + * @param aMsgWindow msgWindow for give progress and status feedback + * @param aUrlListener gets notified when url starts and stops + * @param aConvertData should we create a stream converter? + * @param aAdditionalHeader added to URI, e.g., "header=filter" + * @param aLocalOnly whether data should be retrieved only from local caches + * If streaming over the network is required and this is true, then + * an exception is thrown. This defaults to false. + * + * @note If we're offline, then even if aLocalOnly is false, we won't stream over the + * network + * + * @return the URL that gets run + */ + nsIURI streamMessage(in AUTF8String aMessageURI, in nsISupports aConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener, + in boolean aConvertData, + in ACString aAdditionalHeader, + [optional] in boolean aLocalOnly); + + /** + * This method streams a message's headers to the passed in consumer. + * This is for consumers who want a particular header but don't + * want to stream the whole message. + * + * @param aMessageURI uri of message whose headers we are to stream + * @param aConsumer a stream listener listening to the message + headers. + * @param aUrlListener gets notified when url starts and stops, if we run a url. + * @param aLocalOnly whether data should be retrieved only from local caches + * If streaming over the network is required and this is true, then + * an exception is thrown. This defaults to false. + * + * @note If we're offline, then even if aLocalOnly is false, we won't stream over the + * network + * + * @return the URL that gets run, if any. + */ + nsIURI streamHeaders(in AUTF8String aMessageURI, in nsIStreamListener aConsumer, + in nsIUrlListener aUrlListener, + [optional] in boolean aLocalOnly); + + /** + * Determines whether a message is in the memory cache. Local folders + * don't implement this. + * The URL needs to address a message, not a message part, all query + * qualifiers will be stripped before looking up the entry in the cache. + * + * @param aUrl The URL of the message, possibly with an appropriate command in it + * @param aFolder The folder this message is in + * + * @return TRUE if the message is in mem cache; FALSE if it is not. + */ + boolean isMsgInMemCache(in nsIURI aUrl, + in nsIMsgFolder aFolder); + + /** + * now the the message datasource is going away + * we need away to go from message uri to go nsIMsgDBHdr + * + * @param uri A message uri to get nsIMsgDBHdr for. + * + * @return nsIMsgDBHdr for specified uri or null if failed. + */ + nsIMsgDBHdr messageURIToMsgHdr(in AUTF8String uri); +}; + +/** + * Some mail protocols (like imap) allow you to fetch individual mime parts. We use this interface + * to represent message services whose protocols support this. To use this interface, you should get + * the message service then QI for this interface. If it's present, then can fetch a mime part. + */ +[scriptable, uuid(3728C255-480C-11d4-98D0-001083010E9B)] +interface nsIMsgMessageFetchPartService : nsISupports +{ + /** + * Used to fetch an individual mime part + * + * @param aURI url representing the message + * @param aMessageURI RDF URI including the part to fetch + * @param aDisplayConsumer + * @param aMsgWindow + * @param aUrlListener + * + * @return + */ + nsIURI fetchMimePart(in nsIURI aURI, in AUTF8String aMessageUri, in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener); +}; diff --git a/comm/mailnews/base/public/nsIMsgOfflineManager.idl b/comm/mailnews/base/public/nsIMsgOfflineManager.idl new file mode 100644 index 0000000000..282af2d2b5 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgOfflineManager.idl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +// this is a service -there's only one Offline Manager, because you can only do one operation at a time +// (go online or offline). + +interface nsIMsgWindow; + +[scriptable, uuid(5e885fec-09b0-11d5-a5bf-0060b0fc04b7)] +interface nsIMsgOfflineManager : nsISupports +{ + attribute nsIMsgWindow window; // should be a progress window. + attribute boolean inProgress; // an online->offine or online->offline operation in progress. + // the offline menu should be disabled. + void goOnline(in boolean sendUnsentMessages, in boolean playbackOfflineImapOperations, in nsIMsgWindow aMsgWindow); + void synchronizeForOffline(in boolean downloadNews, in boolean downloadMail, in boolean sendUnsentMessages, + in boolean goOfflineWhenDone, in nsIMsgWindow aMsgWindow); +}; diff --git a/comm/mailnews/base/public/nsIMsgPluggableStore.idl b/comm/mailnews/base/public/nsIMsgPluggableStore.idl new file mode 100644 index 0000000000..5273d6f0a6 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgPluggableStore.idl @@ -0,0 +1,335 @@ +/* -*- 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" + +interface nsIMsgFolder; +interface nsIMsgCopyServiceListener; +interface nsIMsgDBHdr; +interface nsIMsgWindow; +interface nsIOutputStream; +interface nsIInputStream; +interface nsIUrlListener; +interface nsIMsgDatabase; +interface nsITransaction; + +[scriptable, uuid(F732CE58-E540-4dc4-B803-9456056EBEFC)] + +/** + * Pluggable message store interface. Each incoming server can have a different + * message store. + * All methods are synchronous unless otherwise specified. + */ +interface nsIMsgPluggableStore : nsISupports { + /** + * Examines the store and adds subfolders for the existing folders in the + * profile directory. aParentFolder->AddSubfolder is the normal way + * to register the subfolders. This method is expected to be synchronous. + * This shouldn't be confused with server folder discovery, which is allowed + * to be asynchronous. + * + * @param aParentFolder folder whose existing children we want to discover. + * This will be the root folder for the server object. + * @param aDeep true if we should discover all descendents. Would we ever + * not want to do this? + */ + + void discoverSubFolders(in nsIMsgFolder aParentFolder, in boolean aDeep); + /** + * Creates storage for a new, empty folder. + * + * @param aParent parent folder + * @param aFolderName leaf name of folder. + * @return newly created folder. + * @exception NS_MSG_FOLDER_EXISTS If the child exists. + * @exception NS_MSG_CANT_CREATE_FOLDER for other errors. + */ + nsIMsgFolder createFolder(in nsIMsgFolder aParent, in AString aFolderName); + + /** + * Delete storage for a folder and its subfolders, if any. + * This is a real delete, not a move to the trash folder. + * + * @param aFolder folder to delete + */ + void deleteFolder(in nsIMsgFolder aFolder); + + /** + * Rename storage for an existing folder. + * + * @param aFolder folder to rename + * @param aNewName name to give new folder + * @return the renamed folder object + */ + nsIMsgFolder renameFolder(in nsIMsgFolder aFolder, in AString aNewName); + + /** + * Tells if the store has the requested amount of space available in the + * specified folder. + * + * @param aFolder folder we want to add messages to. + * @param aSpaceRequested How many bytes we're trying to add to the store. + * + * The function returns an exception if there is not enough space to + * indicate the reason of the shortage: + * NS_ERROR_FILE_TOO_BIG = the store cannot grow further due to internal limits + * NS_ERROR_FILE_NO_DEVICE_SPACE = there is not enough space on the disk + */ + boolean hasSpaceAvailable(in nsIMsgFolder aFolder, + in long long aSpaceRequested); + + /** + * Move/Copy a folder to a new parent folder. This method is asynchronous. + * The store needs to use the aListener to notify the core code of the + * completion of the operation. And it must send the appropriate + * nsIMsgFolderNotificationService notifications. + * + * @param aSrcFolder folder to move/copy + * @param aDstFolder parent dest folder + * @param aIsMoveFolder true if move, false if copy. If move, source folder + * is deleted when copy completes. + * @param aMsgWindow used to display progress, may be null + * @param aListener - used to get notification when copy is done. + * @param aNewName Optional new name for the target folder. + * If rename is not needed, set this to empty string. + */ + void copyFolder(in nsIMsgFolder aSrcFolder, in nsIMsgFolder aDstFolder, + in boolean aIsMoveFolder, in nsIMsgWindow aMsgWindow, + in nsIMsgCopyServiceListener aListener, + in AString aNewName); + + /** + * Get an output stream for a message in a folder. + * + * @param aFolder folder to create a message output stream for. + * @param aNewHdr If aNewHdr is set on input, then this is probably for + * offline storage of an existing message. If null, the + * this is a newly downloaded message and the store needs + * to create a new header for the new message. If the db + * is invalid, this can be null. But if the db is valid, + * the store should create a message header with the right + * message key, or whatever other property it needs to set to + * be able to retrieve the message contents later. If the store + * needs to base any of this on the contents of the message, + * it will need remember the message header and hook into + * the output stream somehow to alter the message header. + * + * @return The output stream to write to. The output stream will be positioned + * for writing (e.g., for berkeley mailbox, it will be at the end). + */ + nsIOutputStream getNewMsgOutputStream(in nsIMsgFolder aFolder, + inout nsIMsgDBHdr aNewHdr); + + + /** + * Called when the current message is discarded, e.g., it is moved + * to an other folder as a filter action, or is deleted because it's + * a duplicate. This gives the berkeley mailbox store a chance to simply + * truncate the Inbox w/o leaving a deleted message in the store. + * + * discardNewMessage closes aOutputStream always unless the passed stream + * is nullptr due to error processing.. + * (Clarification/Rationale in Bug 1121842, 1122698, 1242030) + * + * @param aOutputStream stream we were writing the message to be discarded to + * @param aNewHdr header of message to discard + */ + void discardNewMessage(in nsIOutputStream aOutputStream, + in nsIMsgDBHdr aNewHdr); + + /** + * Must be called by code that calls getNewMsgOutputStream to finish + * the process of storing a new message, if the new msg has not been + * discarded. Could/should this be combined with discardNewMessage? + * + * finishNewMessage closes aOutputStream always unless the passed stream + * is nullptr due to error processing. + * (Clarification/Rationale in Bug 1121842, 1122698, 1242030) + * + * @param aOutputStream stream we were writing the message to. + * @param aNewHdr header of message finished. + */ + void finishNewMessage(in nsIOutputStream aOutputStream, + in nsIMsgDBHdr aNewHdr); + + /** + * Called by pop3 message filters when a newly downloaded message is being + * moved by an incoming filter. This is called before finishNewMessage, and + * it allows the store to optimize that case. + * + * @param aNewHdr msg hdr of message being moved. + * @param aDestFolder folder to move message to, in the same store. + * + * @return true if successful, false if the store doesn't want to optimize + * this. + * @exception If the moved failed. values TBD + */ + boolean moveNewlyDownloadedMessage(in nsIMsgDBHdr aNewHdr, + in nsIMsgFolder aDestFolder); + + /** + * Get an input stream that we can read the contents of a message from. + * + * @param aMsgFolder Folder containing the message + * @param aMsgToken token that identifies message. This is store-dependent, + * and must be set as a string property "storeToken" on the + * message hdr by the store when the message is added + * to the store. + */ + nsIInputStream getMsgInputStream(in nsIMsgFolder aFolder, + in ACString aMsgToken); + + /** + * This is a hack to expose to allow JsAccount folders to implement a + * working getLocalMsgStream(). + * It just provides a way to construct a SlicedInputStream from JS. + * It'll be removed once Bug 1733849 is complete. + * + * @param inStream The stream providing the data to be sliced. + * Should not be read after calling this function. + * @param start Where slice begins, from current position of inStream. + * @param length The size of the slice. + * + * @return A new input stream which produces the data slice when read from. + */ + nsIInputStream sliceStream(in nsIInputStream inStream, + in unsigned long long start, + in unsigned long length); + + /** + * Delete the passed in messages. These message should all be in the + * same folder. + * @param aHdrArray array of nsIMsgDBHdr's. + */ + void deleteMessages(in Array<nsIMsgDBHdr> aHdrArray); + + /** + * This allows the store to handle a msg move/copy if it wants. This lets + * it optimize move/copies within the same store. E.g., for maildir, a + * msg move mostly entails moving the file containing the message, and + * updating the db. + * If the store does the copy, it must return the appropriate undo action, + * which can be store dependent. And it must send the appropriate + * nsIMsgFolderNotificationService notifications. + * If the store does not perform the copy, it returns false and the caller + * has to handle the copy itself (by streaming messages). + * This function is synchronous. + * + * @param isMove true if this is a move, false if it is a copy. + * @param aHdrArray array of nsIMsgDBHdr's, all in the same folder + * @param aDstFolder folder to move/copy the messages to. + * @param aDstHdrs array of nsIMsgDBHdr's in the destination folder. + * @param[out,optional] aUndoAction transaction to provide undo, if + * the store does the copy itself. + * @return true if messages were copied, false if the core code should + * do the copy. + */ + boolean copyMessages(in boolean isMove, + in Array<nsIMsgDBHdr> aHdrArray, + in nsIMsgFolder aDstFolder, + out Array<nsIMsgDBHdr> aDstHdrs, + out nsITransaction aUndoAction); + + /** + * Does this store require compaction? For example, maildir doesn't require + * compaction at all. Berkeley mailbox does. A sqlite store probably doesn't. + * This is a static property of the store. It doesn't mean that any particular + * folder has space that can be reclaimed via compaction. Right now, the core + * code keeps track of the size of messages deleted, which it can use in + * conjunction with this store attribute. + */ + readonly attribute boolean supportsCompaction; + + /** + * Remove deleted messages from the store, reclaiming space. Some stores + * won't need to do anything here (e.g., maildir), and those stores + * should return false for needsCompaction. This operation is asynchronous, + * and the passed url listener should be called when the operation is done. + * + * @param aFolder folder whose storage is to be compacted + * @param aListener listener notified when compaction is done. + * @param aMsgWindow window to display progress/status in. + */ + void compactFolder(in nsIMsgFolder aFolder, in nsIUrlListener aListener, + in nsIMsgWindow aMsgWindow); + + /** + * Is the summary file for the passed folder valid? For Berkeley Mailboxes, + * for local mail folders, this checks the timestamp and size of the local + * mail folder against values stored in the db. For other stores, this may + * be a noop, though other stores could certainly become invalid. For + * Berkeley Mailboxes, this is to deal with the case of other apps altering + * mailboxes from outside mailnews code, and this is certainly possible + * with other stores. + * + * @param aFolder Folder to check if summary is valid for. + * @param aDB DB to check validity of. + * + * @return return true if the summary file is valid, false otherwise. + */ + boolean isSummaryFileValid(in nsIMsgFolder aFolder, in nsIMsgDatabase aDB); + + /** + * Marks the summary file for aFolder as valid or invalid. This method + * may not be required, since it's really used by Berkeley Mailbox code + * to fix the timestamp and size for a folder. + * + * @param aFolder folder whose summary file should be marked (in)valid. + * @param aDB db to mark valid (may not be the folder's db in odd cases + * like folder compaction. + * @param aValid whether to mark it valid or invalid. + */ + void setSummaryFileValid(in nsIMsgFolder aFolder, in nsIMsgDatabase aDB, + in boolean aValid); + + /** + * Rebuild the index from information in the store. This involves creating + * a new nsIMsgDatabase for the folder, adding the information for all the + * messages in the store, and then copying the new msg database over the + * existing database. For Berkeley mailbox, we try to maintain meta data + * stored in the existing database when possible, and other stores should do + * the same. Ideally, I would figure out a way of making that easy. That + * might entail reworking the rebuild index process into one where the store + * would iterate over the messages, and stream each message through the + * message parser, and the common code would handle maintaining the + * meta data. But the berkeley mailbox code needs to do some parsing because + * it doesn't know how big the message is (i.e., the stream can't simply be + * a file stream). + * This operation is asynchronous, + * and the passed url listener should be called when the operation is done. + * + * @param aFolder folder whose storage is to be compacted + * @param aMsgDB db to put parsed headers in. + * @param aMsgWindow msgWindow to use for progress updates. + * @param aListener listener notified when the index is rebuilt. + */ + void rebuildIndex(in nsIMsgFolder aFolder, in nsIMsgDatabase aMsgDB, + in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener); + + /** + * Sets/Clears the passed flags on the passed messages. + * @param aHdrArray array of nsIMsgDBHdr's + * @param aFlags flags to set/clear + * @param aSet true to set the flag(s), false to clear. + */ + void changeFlags(in Array<nsIMsgDBHdr> aHdrArray, in unsigned long aFlags, + in boolean aSet); + /** + *Sets/Clears the passed keywords on the passed messages. + * @param aHdrArray array of nsIMsgDBHdr's + * @param aKeywords keywords to set/clear + * @param aAdd true to add the keyword(s), false to remove. + */ + void changeKeywords(in Array<nsIMsgDBHdr> aHdrArray, in ACString aKeywords, + in boolean aAdd); + + /** + * Identifies a specific type of store. Please use this only for legacy + * bug fixes, and not as a method to change behavior! + * + * Typical values: "mbox", "maildir" + */ + readonly attribute ACString storeType; +}; diff --git a/comm/mailnews/base/public/nsIMsgProgress.idl b/comm/mailnews/base/public/nsIMsgProgress.idl new file mode 100644 index 0000000000..4e370d090c --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgProgress.idl @@ -0,0 +1,38 @@ +/* -*- 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/. */ +#include "nsISupports.idl" +#include "domstubs.idl" +#include "nsIPrompt.idl" +#include "nsIWebProgressListener.idl" + +interface mozIDOMWindowProxy; +interface nsIMsgWindow; + +[scriptable, uuid(6d6fe91d-7f9a-4552-9737-9f74b0e75538)] +interface nsIMsgProgress: nsIWebProgressListener { + + /** + * Open the progress dialog, you can specify parameters through an xpcom object + */ + void openProgressDialog(in mozIDOMWindowProxy parent, + in nsIMsgWindow aMsgWindow, + in string dialogURL, + in boolean inDisplayModal, + in nsISupports parameters); + + /* Close the progress dialog */ + void closeProgressDialog(in boolean forceClose); + + /* Register a Web Progress Listener */ + void registerListener(in nsIWebProgressListener listener); + + /* Unregister a Web Progress Listener */ + void unregisterListener(in nsIWebProgressListener listener); + + /* Indicated if the user asked to cancel the current process */ + attribute boolean processCanceledByUser; + + attribute nsIMsgWindow msgWindow; +}; diff --git a/comm/mailnews/base/public/nsIMsgProtocolHandler.idl b/comm/mailnews/base/public/nsIMsgProtocolHandler.idl new file mode 100644 index 0000000000..a526104676 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgProtocolHandler.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +interface nsIURI; + +[scriptable, uuid(4e9e4a43-343a-4309-a88b-08c5f37f5965)] +interface nsIMsgProtocolHandler : nsISupports { + nsIURI newURI(in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI); +}; diff --git a/comm/mailnews/base/public/nsIMsgProtocolInfo.idl b/comm/mailnews/base/public/nsIMsgProtocolInfo.idl new file mode 100644 index 0000000000..7a505673e0 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgProtocolInfo.idl @@ -0,0 +1,97 @@ +/* -*- 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 nsIFile; + +%{C++ +#define NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX \ + "@mozilla.org/messenger/protocol/info;1?type=" +%} + +[scriptable, uuid(9428b5f5-8b12-493c-aae2-18296c2877b1)] +interface nsIMsgProtocolInfo : nsISupports +{ + /** + * the default path to store local data for this type of + * server. Each server is usually in a subdirectory below this + */ + attribute nsIFile defaultLocalPath; + + /** + * the IID of the protocol-specific interface for this server + * usually used from JS to dynamically get server-specific attributes + */ + readonly attribute nsIIDPtr serverIID; + + /** + * does this server type require a username? + * for instance, news does not but IMAP/POP do + */ + readonly attribute boolean requiresUsername; + + /** + * if the pretty name of the server should + * just be the e-mail address. Otherwise it usually + * ends up being something like "news on hostname" + */ + readonly attribute boolean preflightPrettyNameWithEmailAddress; + + /** + * can this type of server be removed from the account manager? + * for instance, local mail is not removable + */ + readonly attribute boolean canDelete; + + /** + * can this type of server log in at startup? + */ + readonly attribute boolean canLoginAtStartUp; + + /** + * can you duplicate this server? + * for instance, local mail is unique and should not be duplicated. + */ + readonly attribute boolean canDuplicate; + + /* the default port + This is similar to nsIProtocolHanderl.defaultPort, + but for architectural reasons, there is a mail-specific interface to this. + When the input param isSecure is set to true, for all supported protocols, + the secure port value is returned. If isSecure is set to false the default + port value is returned */ + long getDefaultServerPort(in boolean isSecure); + + /** + * An attribute that tell us whether on not we can + * get messages for the given server type + * this is poorly named right now. + * it's really is there an inbox for this type? + * XXX todo, rename this. + */ + readonly attribute boolean canGetMessages; + + /** + * do messages arrive for this server + * if they do, we can use our junk controls on it. + */ + readonly attribute boolean canGetIncomingMessages; + + /** + * do biff by default? + */ + readonly attribute boolean defaultDoBiff; + + /** + * do we need to show compose message link in the AccountCentral page ? + */ + readonly attribute boolean showComposeMsgLink; + + /** + * Will new folders be created asynchronously? + */ + readonly attribute boolean foldersCreatedAsync; +}; diff --git a/comm/mailnews/base/public/nsIMsgPurgeService.idl b/comm/mailnews/base/public/nsIMsgPurgeService.idl new file mode 100644 index 0000000000..a914d41525 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgPurgeService.idl @@ -0,0 +1,13 @@ +/* -*- 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" + +[scriptable, uuid(c73294b2-b619-4915-b0e8-314d4215e08d)] +interface nsIMsgPurgeService : nsISupports { + + void init(); + void shutdown(); +}; diff --git a/comm/mailnews/base/public/nsIMsgShutdown.idl b/comm/mailnews/base/public/nsIMsgShutdown.idl new file mode 100644 index 0000000000..419e5219a5 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgShutdown.idl @@ -0,0 +1,67 @@ +/* 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 nsIUrlListener; +interface nsIMsgWindow; +interface nsIWebProgressListener; + +[scriptable, uuid(D1B43428-B631-4629-B691-AB0E01A2DB4B)] +interface nsIMsgShutdownTask : nsISupports +{ + /** + * Inform the caller whether or not the task needs to be run. This method + * gives the task the flexibility to cancel running a task on shutdown + * if nothing needs to be run. + */ + readonly attribute boolean needsToRunTask; + + /** + * At shutdown-time, this function will be called to all registered implementors. + * Shutdown will be temporarily postponed until |OnStopRequest()| has been called + * on the passed in url-listener. + * @param inUrlListener The URL listener to report events to. + * @param inMsgWindow The current message window to allow for posing dialogs. + * @return If the shutdown URL was run or not. If the URL is running, the task + * will be responsible for notifying |inUrlListener| when the task is completed. + */ + boolean doShutdownTask(in nsIUrlListener inUrlListener, in nsIMsgWindow inMsgWindow); + + /** + * Get the displayable name of the current task. This textual information will be + * shown to the user so they know what shutdown task is being performed. + * @return The name of the current task being performed. + */ + AString getCurrentTaskName(); +}; + +[scriptable, uuid(483C8ABB-ECF9-48A3-A394-2C604B603BD5)] +interface nsIMsgShutdownService : nsISupports +{ + /** + * Get the number of tasks that will need to be processed at shutdown time. + * @return The number of shutdown tasks to do. + */ + long getNumTasks(); + + /** + * Start the shutdown tasks. + */ + void startShutdownTasks(); + + /** + * Tell the service to stop running tasks and go ahead and shutdown the application. + */ + void cancelShutdownTasks(); + + /** + * Set the shutdown listener. + */ + void setShutdownListener(in nsIWebProgressListener inListener); + + /** + * Set the status text of the shutdown progress dialog. + */ + void setStatusText(in AString inStatusString); +}; diff --git a/comm/mailnews/base/public/nsIMsgStatusFeedback.idl b/comm/mailnews/base/public/nsIMsgStatusFeedback.idl new file mode 100644 index 0000000000..2aedd4713b --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgStatusFeedback.idl @@ -0,0 +1,18 @@ +/* -*- 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" + +[scriptable, uuid(AACBFA34-8D29-4A08-9283-A8E5B3AB067F)] +interface nsIMsgStatusFeedback : nsISupports { + void showStatusString(in AString aStatus); + void startMeteors(); + void stopMeteors(); + void showProgress(in long aPercent); + void setStatusString(in AString aStatus); // will be displayed until next user action + + /* aStatusFeedback: a wrapped JS status feedback object */ + void setWrappedStatusFeedback(in nsIMsgStatusFeedback aStatusFeedback); +}; diff --git a/comm/mailnews/base/public/nsIMsgTagService.idl b/comm/mailnews/base/public/nsIMsgTagService.idl new file mode 100644 index 0000000000..0317b64960 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgTagService.idl @@ -0,0 +1,67 @@ +/* -*- 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" + +/* + * Keys are the internal representation of tags, and use a limited range of + * characters, basically the characters allowed in imap keywords, which are + * alphanumeric characters, but don't include spaces. Keys are stored on + * the imap server, in local mail messages, and in summary files. + * + * Tags are the user visible representation of keys, and are full unicode + * strings. Tags should allow any unicode character. + * + * This service will do the mapping between keys and tags. When a tag + * is added, we'll need to "compute" the corresponding key to use. This + * will probably entail replacing illegal ascii characters (' ', '/', etc) + * with '_' and then converting to imap mod utf7. We'll then need to make + * sure that no other keyword has the same value since that algorithm + * doesn't guarantee a unique mapping. + * + * Tags are sorted internally by 'importance' by their ordinal strings (which by + * default are equal to a tag's key and thus only stored if different). + * The alphanumerically 'smallest' string is called the 'most important' one and + * comes first in any sorted array. The remainder follows in ascending order. + */ + +[scriptable, uuid(84d593a3-5d8a-45e6-96e2-9189acd422e1)] +interface nsIMsgTag : nsISupports { + readonly attribute ACString key; // distinct tag identifier + readonly attribute AString tag; // human readable tag name + readonly attribute ACString color; // tag color + readonly attribute ACString ordinal; // custom sort string (usually empty) +}; + +[scriptable, uuid(97360ce3-0fba-4f1c-8214-af7bdc6f8587)] +interface nsIMsgTagService : nsISupports { + // create new tag by deriving the key from the tag + void addTag(in AString tag, in ACString color, in ACString ordinal); + // create/update tag with known key + void addTagForKey(in ACString key, in AString tag, in ACString color, in ACString ordinal); + // get the key representation of a given tag + ACString getKeyForTag(in AString tag); + // get the first key by ordinal order + ACString getTopKey(in ACString keyList); + // support functions for single tag aspects + AString getTagForKey(in ACString key); // look up the tag for a key. + void setTagForKey(in ACString key, in AString tag); // this can be used to "rename" a tag + ACString getColorForKey(in ACString key); + AString getSelectorForKey(in ACString key); // return wide string to avoid conversion + void setColorForKey(in ACString key, in ACString color); + ACString getOrdinalForKey(in ACString key); + void setOrdinalForKey(in ACString key, in ACString ordinal); + // delete a tag from the list of known tags (but not from any messages) + void deleteKey(in ACString key); + // get all known tags + Array<nsIMsgTag> getAllTags(); + /* + * Determines if the token in aKey corresponds to a current valid tag + * + * @param aKey The string to test + * @return True if aKey is a current token + */ + boolean isValidKey(in ACString aKey); +}; diff --git a/comm/mailnews/base/public/nsIMsgThread.idl b/comm/mailnews/base/public/nsIMsgThread.idl new file mode 100644 index 0000000000..91cb995c84 --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgThread.idl @@ -0,0 +1,35 @@ +/* -*- 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" +#include "MailNewsTypes2.idl" + +interface nsIMsgEnumerator; +interface nsIMsgDBHdr; +interface nsIDBChangeAnnouncer; + +[scriptable, uuid(84052876-90e9-4e21-ad38-13e2bb751d8f)] +interface nsIMsgThread : nsISupports { + attribute nsMsgKey threadKey; + attribute unsigned long flags; + attribute ACString subject; + attribute unsigned long newestMsgDate; + readonly attribute unsigned long numChildren; + readonly attribute unsigned long numUnreadChildren; + + void addChild(in nsIMsgDBHdr child, in nsIMsgDBHdr inReplyTo, in boolean threadInThread, in nsIDBChangeAnnouncer announcer); + nsMsgKey getChildKeyAt(in unsigned long index); + nsIMsgDBHdr getChild(in nsMsgKey msgKey); + nsIMsgDBHdr getChildHdrAt(in unsigned long index); + nsIMsgDBHdr getRootHdr(); + void removeChildAt(in unsigned long index); + void removeChildHdr(in nsIMsgDBHdr child, in nsIDBChangeAnnouncer announcer); + + void markChildRead(in boolean bRead); + + nsIMsgDBHdr getFirstUnreadChild(); + + nsIMsgEnumerator enumerateMessages(in nsMsgKey parent); +}; diff --git a/comm/mailnews/base/public/nsIMsgUserFeedbackListener.idl b/comm/mailnews/base/public/nsIMsgUserFeedbackListener.idl new file mode 100644 index 0000000000..f798c4b86c --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgUserFeedbackListener.idl @@ -0,0 +1,28 @@ +/* -*- 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 nsIMsgMailNewsUrl; + +/** + * Implement this interface to subscribe to errors and warnings passed out via + * nsIMsgMailSession. + */ +[scriptable, uuid(5e909ffa-77fe-4ce3-bf3c-06c54596d03d)] +interface nsIMsgUserFeedbackListener : nsISupports { + /** + * Called when an alert from a protocol level implementation is generated. + * + * @param aMessage The localized message string to alert. + * @param aUrl Optional mailnews url which is relevant to the operation + * which caused the alert to be generated. + * @return True if you serviced the alert and it does not need + * to be prompted to the user separately. + * Note: The caller won't prompt if msgWindow in aUrl is + * null, regardless of the value returned. + */ + boolean onAlert(in AString aMessage, [optional] in nsIMsgMailNewsUrl aUrl); +}; diff --git a/comm/mailnews/base/public/nsIMsgWindow.idl b/comm/mailnews/base/public/nsIMsgWindow.idl new file mode 100644 index 0000000000..2cbae8e23f --- /dev/null +++ b/comm/mailnews/base/public/nsIMsgWindow.idl @@ -0,0 +1,64 @@ +/* -*- 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 nsIMsgStatusFeedback; +interface nsIMsgFolder; +interface nsITransactionManager; +interface nsIDocShell; +interface mozIDOMWindowProxy; +interface nsIPrompt; +interface nsIInterfaceRequestor; +interface nsIAuthPrompt; +interface nsIPrincipal; + +[scriptable, uuid(a846fe48-4022-4296-a1c4-1dcd7eaecfe5)] +interface nsIMsgWindow : nsISupports { + attribute nsIMsgStatusFeedback statusFeedback; + attribute nsITransactionManager transactionManager; + attribute nsIMsgFolder openFolder; + + /** + * @note Setting this attribute has various side effects, including + * wiring up this object as the parent nsIURIContentListener for the + * passed-in docshell as well as setting the message content policy service + * to listen for OnLocationChange notifications. + */ + attribute nsIDocShell rootDocShell; + + /** + * @note Small helper function used to optimize our use of a weak reference + * on the message window docshell. Under no circumstances should you be + * holding on to the docshell returned here outside the scope of your routine. + */ + readonly attribute nsIDocShell messageWindowDocShell; + + /** + * These are currently used to set notification callbacks on + * protocol channels to handle things like bad cert exceptions. + */ + attribute nsIInterfaceRequestor notificationCallbacks; + + /** + Has a running url been stopped? If you care about checking + this flag, you need to clear it before you start your operation since + there's no convenient place to clear it. + */ + attribute boolean stopped; + + attribute mozIDOMWindowProxy domWindow; + + void StopUrls(); + + /** + when the msg window is being unloaded from the content window, + we can use this notification to force a flush on anything the + msg window hangs on too. For some reason xpconnect is still hanging + onto the msg window even though all of our objects have let go of it + this forces a release... + */ + void closeWindow(); +}; diff --git a/comm/mailnews/base/public/nsISpamSettings.idl b/comm/mailnews/base/public/nsISpamSettings.idl new file mode 100644 index 0000000000..96c81c6c08 --- /dev/null +++ b/comm/mailnews/base/public/nsISpamSettings.idl @@ -0,0 +1,97 @@ +/* -*- 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 nsIOutputStream; +interface nsIMsgIncomingServer; +interface nsIMsgDBHdr; +interface nsIFile; + +[scriptable, uuid(1772BE95-FDA9-4dfd-A663-8AF92C1E3024)] +interface nsISpamSettings: nsISupports { + /** + * 0 for nothing, 100 for highest + */ + attribute long level; + + attribute boolean moveOnSpam; + readonly attribute boolean markAsReadOnSpam; + + /** + * Most consumers will just use spamFolderURI rather than accessing any of + * target attributes directly. + */ + attribute long moveTargetMode; + const long MOVE_TARGET_MODE_ACCOUNT = 0; + const long MOVE_TARGET_MODE_FOLDER = 1; + // Despite their name the following are URIs. + attribute AUTF8String actionTargetAccount; + attribute AUTF8String actionTargetFolder; + + /** + * built from moveTargetMode, actionTargetAccount, actionTargetFolder + */ + readonly attribute AUTF8String spamFolderURI; + + attribute boolean purge; + /** + * interval, in days + */ + attribute long purgeInterval; + + attribute boolean useWhiteList; + attribute AUTF8String whiteListAbURI; + + /** + * Should we do something when the user manually marks a message as junk? + */ + readonly attribute boolean manualMark; + + /** + * With manualMark true, which action (move to the Junk folder, or delete) + * should we take when the user marks a message as junk. + */ + readonly attribute long manualMarkMode; + const long MANUAL_MARK_MODE_MOVE = 0; + const long MANUAL_MARK_MODE_DELETE = 1; + + /** + * integrate with server-side spam detection programs + */ + attribute boolean useServerFilter; + attribute ACString serverFilterName; + readonly attribute nsIFile serverFilterFile; + const long TRUST_POSITIVES = 1; + const long TRUST_NEGATIVES = 2; + attribute long serverFilterTrustFlags; + + // for logging + readonly attribute boolean loggingEnabled; + attribute nsIOutputStream logStream; + void logJunkHit(in nsIMsgDBHdr aMsgHdr, in boolean aMoveMessage); + void logJunkString(in string aLogText); + void clone(in nsISpamSettings aSpamSettings); + + // aServer -> spam settings are associated with a particular server + void initialize(in nsIMsgIncomingServer aServer); + + /** + * check if junk processing for a message should be bypassed + * + * Typically this is determined by comparing message to: address + * to a whitelist of known good addresses or domains. + * + * @param aMsgHdr database header representing the message. + * + * @return true if this message is whitelisted, and junk + * processing should be bypassed + * + * false otherwise (including in case of error) + */ + boolean checkWhiteList(in nsIMsgDBHdr aMsgHdr); + +}; diff --git a/comm/mailnews/base/public/nsIStatusBarBiffManager.idl b/comm/mailnews/base/public/nsIStatusBarBiffManager.idl new file mode 100644 index 0000000000..88dc4d7b40 --- /dev/null +++ b/comm/mailnews/base/public/nsIStatusBarBiffManager.idl @@ -0,0 +1,13 @@ +/* -*- 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 "nsIMsgFolder.idl" +#include "nsIFolderListener.idl" + +[scriptable, uuid(20b81f2b-ea81-4baa-b378-c5e6d3dc94e5)] +interface nsIStatusBarBiffManager : nsIFolderListener { + // see nsIMsgFolder for definition and constants + readonly attribute nsMsgBiffState biffState; +}; diff --git a/comm/mailnews/base/public/nsIStopwatch.idl b/comm/mailnews/base/public/nsIStopwatch.idl new file mode 100644 index 0000000000..6e40ace070 --- /dev/null +++ b/comm/mailnews/base/public/nsIStopwatch.idl @@ -0,0 +1,44 @@ +/* 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" + +/** + * Simple stopwatch mechanism for determining the amount of wall-clock time and + * CPU time (user + system) that has elapsed. It is not fancy. It is either + * running or it is not. If you want coherent cpu and real time values, then + * you had better stop it first. It does not keep counting when stopped, + * although one could add a resumeRetroactive or something to accomplish that. + */ +[scriptable, uuid(7a671d6e-d48f-4a4f-b87e-644815a5e381)] +interface nsIStopwatch : nsISupports { + /** + * Start the stopwatch; all counters are reset to zero. If you want to + * keep the already accumulated values, use resume instead. + */ + void start(); + + /** + * Stop the stopwatch. + */ + void stop(); + + /** + * Resume the stopwatch without clearing the existing counters. Any time + * already accumulated on cpuTime/realTime will be kept. + */ + void resume(); + + /** + * The total CPU time (user + system) in seconds accumulated between calls to + * start/resume and stop. You have to stop the stopwatch to cause this value + * to update. + */ + readonly attribute double cpuTimeSeconds; + /** + * The total wall clock time in seconds accumulated between calls to + * start/resume and stop. You have to stop the stopwatch to cause this value + * to update. + */ + readonly attribute double realTimeSeconds; +}; diff --git a/comm/mailnews/base/public/nsISubscribableServer.idl b/comm/mailnews/base/public/nsISubscribableServer.idl new file mode 100644 index 0000000000..70b0d980db --- /dev/null +++ b/comm/mailnews/base/public/nsISubscribableServer.idl @@ -0,0 +1,74 @@ +/* -*- Mode: IDL; 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/. */ + +#include "nsISupports.idl" + +interface nsIMsgWindow; +interface nsIMsgIncomingServer; +interface nsITreeView; +interface nsIUTF8StringEnumerator; + +/** + * A listener to receive notification of the subscribable folders of a server. + */ +[scriptable, uuid(f337b84a-1dd1-11b2-97c7-fb8b2e3f2280)] +interface nsISubscribeListener : nsISupports { + /** + * The server has finished finding all folders to subscribe to. + */ + void OnDonePopulating(); +}; + +[scriptable, uuid(14b8597a-755b-4e93-b364-e0903801e6ea)] +interface nsISubscribableServer : nsISupports { + attribute nsISubscribeListener subscribeListener; + attribute char delimiter; + + void startPopulating(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in boolean getOnlyNew); + void startPopulatingWithUri(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in AUTF8String uri); + void stopPopulating(in nsIMsgWindow aMsgWindow); + + // return true if state changed, false otherwise + boolean setState(in AUTF8String path, in boolean state); + + void subscribeCleanup(); + + void subscribe(in wstring name); + void unsubscribe(in wstring name); + + void commitSubscribeChanges(); + + // other stuff + void setIncomingServer(in nsIMsgIncomingServer server); + void addTo(in AUTF8String aName, in boolean addAsSubscribed, + in boolean aSubscribable, in boolean aChangeIfExists); + void setAsSubscribed(in AUTF8String path); + void updateSubscribed(); + void setShowFullName(in boolean showFullName); + + // if path is null, use the root + boolean hasChildren(in AUTF8String path); + // if path is null, use the root + boolean isSubscribed(in AUTF8String path); + // if path is null, use the root + boolean isSubscribable(in AUTF8String path); + // if path is null, use the root + AString getLeafName(in AUTF8String path); + + /** + * Returns the children uris underneath the specified uri (path). + * + * @param aPath The server's uri; If this is null or empty, then the + * root server uri will be used. + */ + Array<AUTF8String> getChildURIs(in AUTF8String aPath); + // if path is null, use the root + AUTF8String getFirstChildURI(in AUTF8String path); + + // for searching + void setSearchValue(in AString searchValue); + readonly attribute boolean supportsSubscribeSearch; + readonly attribute nsITreeView folderView; +}; diff --git a/comm/mailnews/base/public/nsIUrlListener.idl b/comm/mailnews/base/public/nsIUrlListener.idl new file mode 100644 index 0000000000..93df30b6cd --- /dev/null +++ b/comm/mailnews/base/public/nsIUrlListener.idl @@ -0,0 +1,32 @@ +/* -*- 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" + +interface nsIURI; + +%{C++ +#include "nsIURL.h" +%} + +/// General interface that signify URL processing. +[scriptable, uuid(47618220-D008-11d2-8069-006008128C4E)] +interface nsIUrlListener : nsISupports { + /** + * Called to signify the beginning of an URL processing. + * + * @param url URL being processed. + */ + void OnStartRunningUrl(in nsIURI url); + + /** + * Called to signify the end of an URL processing. + * This call is always preceded by a call to OnStartRunningUrl. + * + * @param url URL being processed. + * @param aExitCode A result code of URL processing. + */ + void OnStopRunningUrl(in nsIURI url, in nsresult aExitCode); +}; diff --git a/comm/mailnews/base/public/nsIUserInfo.idl b/comm/mailnews/base/public/nsIUserInfo.idl new file mode 100644 index 0000000000..c8e6fef78d --- /dev/null +++ b/comm/mailnews/base/public/nsIUserInfo.idl @@ -0,0 +1,32 @@ +/* -*- 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" + +/** + * These are things the system may know about the current user. + */ +[scriptable, uuid(6c1034f0-1dd2-11b2-aa14-e6657ed7bb0b)] +interface nsIUserInfo : nsISupports +{ + readonly attribute AString fullname; + + readonly attribute AString emailAddress; + + readonly attribute AString username; + + readonly attribute AString domain; +}; + +%{C++ + +// 14c13684-1dd2-11b2-9463-bb10ba742554 +#define NS_USERINFO_CID \ +{ 0x14c13684, 0x1dd2, 0x11b2, \ + {0x94, 0x63, 0xbb, 0x10, 0xba, 0x74, 0x25, 0x54}} + +#define NS_USERINFO_CONTRACTID "@mozilla.org/userinfo;1" + +%} diff --git a/comm/mailnews/base/public/nsMsgFolderFlags.idl b/comm/mailnews/base/public/nsMsgFolderFlags.idl new file mode 100644 index 0000000000..a36fe002e4 --- /dev/null +++ b/comm/mailnews/base/public/nsMsgFolderFlags.idl @@ -0,0 +1,117 @@ +/*-*- 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" + +// This must be limited to unsigned long (uint32_t, no uint64_t) +// as long as nsIMsgFolder exposes the 'flags' property which contains +// all the flags values. The callers are used to do +// (folder.flags & nsMsgFolderFlags.<flagname>) in Javascript +// which cuts the value to 32bit only. See bug 813459. +typedef unsigned long nsMsgFolderFlagType; + +/// Flags about a folder or a newsgroup. +[scriptable,uuid(440cd0fc-b4b3-4a0f-a492-92fbe7920588)] +interface nsMsgFolderFlags : nsISupports { + /** + * @name Folder Type Flags + * These flags define the type of folder. Exactly one will be set. + * @{ + */ + /// This folder is a newsgroup folder. + const nsMsgFolderFlagType Newsgroup = 0x00000001; + /// Used to be for a folder that is a news server (NewsHost). + const nsMsgFolderFlagType Unused3 = 0x00000002; + /// This folder is a mail folder. + const nsMsgFolderFlagType Mail = 0x00000004; + /** @} */ + + /** Whether this is a directory: NewsHosts are always directories; + * NewsGroups can be directories if we are in ``show all groups'' mode; + * Mail folders will have this bit if they are really directories, not files. + * (Note that directories may have zero children.) + */ + const nsMsgFolderFlagType Directory = 0x00000008; + /** Whether the children of this folder are currently hidden in the listing. + * This will only be present if the nsMsgFolderFlags::Directory bit is on. + */ + const nsMsgFolderFlagType Elided = 0x00000010; + /// Whether this is a virtual search folder + const nsMsgFolderFlagType Virtual = 0x00000020; + + /** @name News Folder Flags + * These flags only occur in folders which have + * the nsMsgFolderFlags::Newsgroup bit set, and do + * not have the nsMsgFolderFlags::Directory or + * nsMsgFolderFlags::Elided bits set. + * @{ + */ + /// Used to be for folders representing a subscribed newsgroup (Subscribed). + const nsMsgFolderFlagType Unused5 = 0x00000040; + /// Used to be for new newsgroups added by the `Check New Groups' command. + const nsMsgFolderFlagType Unused2 = 0x00000080; + /** @} */ + + /** @name Mail Folder Flags + * These flags only occur in folders which have + * the nsMsgFolderFlags::Mail bit set, and do + * not have the nsMsgFolderFlags::Directory or + * nsMsgFolderFlags::Elided bits set. + * @{ + */ + /// Whether this is the trash folder. + const nsMsgFolderFlagType Trash = 0x00000100; + /// Whether this is a folder that sent mail gets delivered to. + const nsMsgFolderFlagType SentMail = 0x00000200; + /// Whether this is the folder in which unfinished, unsent messages are saved for later editing. + const nsMsgFolderFlagType Drafts = 0x00000400; + /// Whether this is the folder in which messages are queued for later delivery. + const nsMsgFolderFlagType Queue = 0x00000800; + /// Whether this is the primary inbox folder. + const nsMsgFolderFlagType Inbox = 0x00001000; + /// Whether this folder on online IMAP + const nsMsgFolderFlagType ImapBox = 0x00002000; + /// Whether this is an archive folder + const nsMsgFolderFlagType Archive = 0x00004000; + /// This used to be used for virtual newsgroups + const nsMsgFolderFlagType Unused1 = 0x00008000; + /// Used to be for categories + const nsMsgFolderFlagType Unused4 = 0x00010000; + /// Used to be for new msgs in a folder + const nsMsgFolderFlagType Unused7 = 0x00020000; + /// Used to be for a folder that is an IMAP server (ImapServer) + const nsMsgFolderFlagType Unused6 = 0x00040000; + /// This folder is an IMAP personal folder + const nsMsgFolderFlagType ImapPersonal = 0x00080000; + /// This folder is an IMAP public folder + const nsMsgFolderFlagType ImapPublic = 0x00100000; + /// This folder is another user's IMAP folder. Think of it like a folder that someone would share. + const nsMsgFolderFlagType ImapOtherUser = 0x00200000; + /// Whether this is the template folder + const nsMsgFolderFlagType Templates = 0x00400000; + /// This folder is one of your personal folders that is shared with other users + const nsMsgFolderFlagType PersonalShared = 0x00800000; + /// This folder is an IMAP \\Noselect folder + const nsMsgFolderFlagType ImapNoselect = 0x01000000; + /// This folder created offline (this is never set in current code, + /// but it is still checked for and obeyed if found on a folder. + const nsMsgFolderFlagType CreatedOffline = 0x02000000; + /// This imap folder cannot have children :-( + const nsMsgFolderFlagType ImapNoinferiors = 0x04000000; + /// This folder configured for offline use + const nsMsgFolderFlagType Offline = 0x08000000; + /// This folder has offline events to play back + const nsMsgFolderFlagType OfflineEvents = 0x10000000; + /// This folder is checked for new messages + const nsMsgFolderFlagType CheckNew = 0x20000000; + /// This folder is for spam messages + const nsMsgFolderFlagType Junk = 0x40000000; + /// This folder is in favorites view + const nsMsgFolderFlagType Favorite = 0x80000000; + /// Special-use folders + const nsMsgFolderFlagType SpecialUse = Inbox|Drafts|Trash|SentMail| + Templates|Junk|Archive|Queue; + /** @} */ +}; diff --git a/comm/mailnews/base/public/nsMsgGroupnameFlags.h b/comm/mailnews/base/public/nsMsgGroupnameFlags.h new file mode 100644 index 0000000000..11056807ab --- /dev/null +++ b/comm/mailnews/base/public/nsMsgGroupnameFlags.h @@ -0,0 +1,48 @@ +/* -*- 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/. */ + +#ifndef _msgGroupnameFlags_h_ +#define _msgGroupnameFlags_h_ + +/* Flags in the subscribe pane (used inside of MSG_GroupNameLine). Where + the flags overlap with the nsMsgFolderFlags flags, it has the same value, + to reduce the chance of someone using the wrong constant. */ + +/* Whether the children of this group are currently hidden in the listing. + This will only be present if it has any children. */ +#define MSG_GROUPNAME_FLAG_ELIDED 0x0010 + +/* Whether this folder represents a moderated newsgroup. */ +#define MSG_GROUPNAME_FLAG_MODERATED 0x0020 + +/* Whether this folder represents a subscribed newsgroup. */ +#define MSG_GROUPNAME_FLAG_SUBSCRIBED 0x0040 + +/* A newsgroup which has just been added by the `Check New Groups` command. */ +#define MSG_GROUPNAME_FLAG_NEW_GROUP 0x0080 + +/* Whether there are children of this group. Whether those children are visible + in this list is determined by the above "ELIDED" flag. Setting this to the + same value as an nsMsgFolderFlags IMAP server, since an IMAP _server_ will + never appear in the subscribe pane. */ +#define MSG_GROUPNAME_FLAG_HASCHILDREN 0x40000 + +/* folder is an IMAP personal folder */ +#define MSG_GROUPNAME_FLAG_IMAP_PERSONAL 0x80000 + +/* folder is an IMAP public folder */ +#define MSG_GROUPNAME_FLAG_IMAP_PUBLIC 0x100000 + +/* folder is another user's IMAP folder */ +#define MSG_GROUPNAME_FLAG_IMAP_OTHER_USER 0x200000 + +/* A \NoSelect IMAP folder */ +#define MSG_GROUPNAME_FLAG_IMAP_NOSELECT 0x400000 + +/* whether or not this folder is one of your personal folders that is shared + with other users */ +#define MSG_GROUPNAME_FLAG_PERSONAL_SHARED 0x800000 + +#endif diff --git a/comm/mailnews/base/public/nsMsgHeaderMasks.h b/comm/mailnews/base/public/nsMsgHeaderMasks.h new file mode 100644 index 0000000000..6de0194096 --- /dev/null +++ b/comm/mailnews/base/public/nsMsgHeaderMasks.h @@ -0,0 +1,53 @@ +/* -*- 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/. */ + +#ifndef _msgHeaderMasks_h_ +#define _msgHeaderMasks_h_ +// clang-format off + +DO NOT USE ANYMORE!!! +/* This set enumerates the header fields which may be displayed in the + message composition window. + */ +#define MSG_FROM_HEADER_MASK 0x00000001 +#define MSG_REPLY_TO_HEADER_MASK 0x00000002 +#define MSG_TO_HEADER_MASK 0x00000004 +#define MSG_CC_HEADER_MASK 0x00000008 +#define MSG_BCC_HEADER_MASK 0x00000010 +#define MSG_FCC_HEADER_MASK 0x00000020 +#define MSG_NEWSGROUPS_HEADER_MASK 0x00000040 +#define MSG_FOLLOWUP_TO_HEADER_MASK 0x00000080 +#define MSG_SUBJECT_HEADER_MASK 0x00000100 +#define MSG_ATTACHMENTS_HEADER_MASK 0x00000200 + +/* These next four are typically not ever displayed in the UI, but are still + stored and used internally. */ +#define MSG_ORGANIZATION_HEADER_MASK 0x00000400 +#define MSG_REFERENCES_HEADER_MASK 0x00000800 +#define MSG_OTHERRANDOMHEADERS_HEADER_MASK 0x00001000 +#define MSG_NEWSPOSTURL_HEADER_MASK 0x00002000 + +#define MSG_PRIORITY_HEADER_MASK 0x00004000 +//#define MSG_NEWS_FCC_HEADER_MASK 0x00008000 +//#define MSG_MESSAGE_ENCODING_HEADER_MASK 0x00010000 +#define MSG_CHARACTER_SET_HEADER_MASK 0x00008000 +#define MSG_MESSAGE_ID_HEADER_MASK 0x00010000 +//#define MSG_NEWS_BCC_HEADER_MASK 0x00080000 + +/* This is also not exposed to the UI; it's used internally to help remember + whether the original message had an HTML portion that we can quote. */ +//#define MSG_HTML_PART_HEADER_MASK 0x00100000 + +/* The "body=" pseudo-header (as in "mailto:me?body=hi+there") */ +//#define MSG_DEFAULTBODY_HEADER_MASK 0x00200000 + +#define MSG_X_TEMPLATE_HEADER_MASK 0x00020000 + +#define MSG_FCC2_HEADER_MASK 0x00400000 + +/* IMAP folders for posting */ +//#define MSG_IMAP_FOLDER_HEADER_MASK 0x02000000 +// clang-format on +#endif diff --git a/comm/mailnews/base/public/nsMsgLocalFolderHdrs.h b/comm/mailnews/base/public/nsMsgLocalFolderHdrs.h new file mode 100644 index 0000000000..bc794567f8 --- /dev/null +++ b/comm/mailnews/base/public/nsMsgLocalFolderHdrs.h @@ -0,0 +1,47 @@ +/* -*- 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 _nsMsgLocalFolderHdrs_H +#define _nsMsgLocalFolderHdrs_H +// clang-format off + +/* The Netscape-specific header fields that we use for storing our + various bits of state in mail folders. + */ +#define X_MOZILLA_STATUS "X-Mozilla-Status" +#define X_MOZILLA_STATUS_FORMAT X_MOZILLA_STATUS ": %4.4x" +#define X_MOZILLA_STATUS_LEN /*1234567890123456*/ 16 + +#define X_MOZILLA_STATUS2 "X-Mozilla-Status2" +#define X_MOZILLA_STATUS2_FORMAT X_MOZILLA_STATUS2 ": %8.8x" +#define X_MOZILLA_STATUS2_LEN /*12345678901234567*/ 17 + +#define X_MOZILLA_DRAFT_INFO "X-Mozilla-Draft-Info" +#define X_MOZILLA_DRAFT_INFO_LEN /*12345678901234567890*/ 20 + +#define X_MOZILLA_NEWSHOST "X-Mozilla-News-Host" +#define X_MOZILLA_NEWSHOST_LEN /*1234567890123456789*/ 19 + +#define X_UIDL "X-UIDL" +#define X_UIDL_LEN /*123456*/ 6 + +#define CONTENT_LENGTH "Content-Length" +#define CONTENT_LENGTH_LEN /*12345678901234*/ 14 + +/* Provide a common means of detecting empty lines in a message. i.e. to detect the end of headers among other things...*/ +#define EMPTY_MESSAGE_LINE(buf) (buf[0] == '\r' || buf[0] == '\n' || buf[0] == '\0') + + +// The default data for the X-Mozilla-Keys header. 80 spaces, room to set +// a bunch of keywords before we have to rewrite the rest of the message. +#define X_MOZILLA_KEYWORDS_BLANK " " +#define X_MOZILLA_KEYWORDS_BLANK_LEN 80 + +/* blank filled header to store keyword/tags in the mailbox */ +#define X_MOZILLA_KEYWORDS "X-Mozilla-Keys: " X_MOZILLA_KEYWORDS_BLANK MSG_LINEBREAK +#define X_MOZILLA_KEYWORDS_LEN (sizeof(X_MOZILLA_KEYWORDS) - 1) + +// clang-format on +#endif diff --git a/comm/mailnews/base/public/nsMsgMessageFlags.idl b/comm/mailnews/base/public/nsMsgMessageFlags.idl new file mode 100644 index 0000000000..2dac966b12 --- /dev/null +++ b/comm/mailnews/base/public/nsMsgMessageFlags.idl @@ -0,0 +1,183 @@ +/* -*- 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" + +typedef unsigned long nsMsgMessageFlagType; + +/// Flags about a single message. +[scriptable,uuid(1ea3acdb-7b9f-4e35-9513-76e0a0cc6baa)] +interface nsMsgMessageFlags : nsISupports +{ + /// This message has been read + const nsMsgMessageFlagType Read = 0x00000001; + + /// A reply to this message has been successfully sent + const nsMsgMessageFlagType Replied = 0x00000002; + + /// This message has been flagged + const nsMsgMessageFlagType Marked = 0x00000004; + + /** + * This message has already gone, but the folder hasn't been compacted yet. + * Since actually removing a message from a folder is a semi-expensive + * operation, we tend to delay it; messages with this bit set will be removed + * the next time folder compaction is done. Once this bit is set, it never + * gets un-set. + */ + const nsMsgMessageFlagType Expunged = 0x00000008; + + /** + * The subject of this message has "Re:" on the front. The folder summary + * uniquifies all of the strings in it, and to help this, any string which + * begins with "Re:" has that stripped first. This bit is then set, so that + * when presenting the message, we know to put it back (since the "Re:" is + * not itself stored in the file.) + */ + const nsMsgMessageFlagType HasRe = 0x00000010; + + /// The children of this sub-thread are folded in the display + const nsMsgMessageFlagType Elided = 0x00000020; + + /// The message is a feed, originally downloaded in a server.type=rss account + const nsMsgMessageFlagType FeedMsg = 0x00000040; + + /// This news article or IMAP message is present in the disk cache + const nsMsgMessageFlagType Offline = 0x00000080; + + /// This thread is being watched + const nsMsgMessageFlagType Watched = 0x00000100; + + /// This message's sender has been authenticated when sending this message + const nsMsgMessageFlagType SenderAuthed = 0x00000200; + + /** + * This message's body is only the first ten or so of the message, and we + * need to add a link to let the user download the rest of it from the POP + * server. + */ + const nsMsgMessageFlagType Partial = 0x00000400; + + /** + * This message is queued for delivery. This only ever gets set on messages + * in the queue folder, but is used to protect against the case of other + * messages having made their way in there somehow -- if some other program + * put a message in the queue, we don't want to later deliver it! + */ + const nsMsgMessageFlagType Queued = 0x00000800; + + /// This message has been forwarded + const nsMsgMessageFlagType Forwarded = 0x00001000; + + /// This message has been redirected + const nsMsgMessageFlagType Redirected = 0x00002000; + + /** + * These are used to remember the message priority in the mozilla status + * flags, so we can regenerate a priority after a rule (or user) has changed + * it. They are not returned in MSG_MessageLine.flags, just in mozilla-status, + * so if you need more non-persistent flags, you could share these bits. But + * it would be wrong. + */ + const nsMsgMessageFlagType Priorities = 0x0000E000; + + /// This message is new since the last time the folder was closed + const nsMsgMessageFlagType New = 0x00010000; + + /// This thread has been ignored + const nsMsgMessageFlagType Ignored = 0x00040000; + + /// This IMAP message has been marked deleted on the server + const nsMsgMessageFlagType IMAPDeleted = 0x00200000; + + /** + * This message has requested to send a message delivery notification to its + * sender + */ + const nsMsgMessageFlagType MDNReportNeeded = 0x00400000; + + /** + * A message delivery notification has been sent for this message. No more + * reports should be sent. + */ + const nsMsgMessageFlagType MDNReportSent = 0x00800000; + + /// This message is a template + const nsMsgMessageFlagType Template = 0x01000000; + + // 0x8000000 is MSG_VIEW_FLAG_ISTHREAD, do not use. + + /// This message has files attached to it + const nsMsgMessageFlagType Attachment = 0x10000000; + + // 0x20000000 is MSG_VIEW_FLAG_DUMMY, do not use. + // 0x40000000 is MSG_VIEW_FLAG_HASCHILDREN, do not use. + + /** + * These are used to remember the message labels in the mozilla status2 + * flags. so we can regenerate a priority after a rule (or user) has changed + * it. They are not returned in nsMsgHdr.flags, just in mozilla-status2, so + * if you need more non-persistent flags, you could share these bits. But it + * would be wrong. + */ + const nsMsgMessageFlagType Labels = 0x0E000000; + + // We're trying to reserve the high byte of the flags for view flags, so, + // don't add flags to the high byte if possible. + + /// The list of all message flags to not write to disk + const nsMsgMessageFlagType RuntimeOnly = Elided; +}; + +typedef unsigned long nsMsgProcessingFlagType; + +/** + * Definitions of processing flags. These flags are not saved to the database. + * They are used to define states for message processing. Any changes + * to these flags need to be supported in the key sets in nsMsgDBFolder + */ +[scriptable,uuid(1f7d642b-de2a-45f0-a27f-9c9ce0b741d8)] +interface nsMsgProcessingFlags : nsISupports +{ + /// This message needs junk classification + const nsMsgProcessingFlagType ClassifyJunk = 0x00000001; + + /// This message needs traits classification + const nsMsgProcessingFlagType ClassifyTraits = 0x00000002; + + /// This message has completed any needed traits classification + const nsMsgProcessingFlagType TraitsDone = 0x00000004; + + /// This message has completed any needed postPlugin filtering + const nsMsgProcessingFlagType FiltersDone = 0x00000008; + + /// This message has a move scheduled by filters + const nsMsgProcessingFlagType FilterToMove = 0x00000010; + + /** + * This message is new to the folder and has yet to be reported via the + * msgsClassified notification. This flag is required because the previously + * used mechanism relied on the database's list of new messages and its + * concept of 'new' is overloaded and has user-visible ramifications. This + * led to messages potentially being considered multiple times. + * + * Unfortunately none of the Done processing flags above are suitable for our + * needs because they are not consistently applied and basically constitute + * memory leaks (which makes the not consistently applied thing a good + * thing.) + * + * I suspect we cannot reliably convert the Done flags above to our use case + * either because of the situation where the user quits the program after the + * messages are added but before the messages are processed. Since the + * processing flags are suppression flags, assuming the 'new' status is + * persisted to the next time we are run, then this would represent a + * change in behaviour. I would need to exactly understand the new semantics + * to know for sure though. + */ + const nsMsgProcessingFlagType NotReportedClassified = 0x00000020; + + /// Number of processing flags + const nsMsgProcessingFlagType NumberOfFlags = 6; +}; |