diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-06 23:39:47 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-06 23:39:47 +0100 |
commit | 642032029f65e9dc0d38fbb6d35ef656c73a292c (patch) | |
tree | 78a22bd12d679ab532db490d631ee69fa085aec1 /mailnews/base/public | |
parent | 50ef259a2df60d020ccb02d76dc5aa4835ee319e (diff) | |
parent | 2529b2edece0a0ed86553d1e73eef13c3848bf64 (diff) | |
download | UXP-642032029f65e9dc0d38fbb6d35ef656c73a292c.tar UXP-642032029f65e9dc0d38fbb6d35ef656c73a292c.tar.gz UXP-642032029f65e9dc0d38fbb6d35ef656c73a292c.tar.lz UXP-642032029f65e9dc0d38fbb6d35ef656c73a292c.tar.xz UXP-642032029f65e9dc0d38fbb6d35ef656c73a292c.zip |
Merge branch 'master' into release
Diffstat (limited to 'mailnews/base/public')
65 files changed, 7131 insertions, 0 deletions
diff --git a/mailnews/base/public/MailNewsTypes.h b/mailnews/base/public/MailNewsTypes.h new file mode 100644 index 000000000..d16e3f3af --- /dev/null +++ b/mailnews/base/public/MailNewsTypes.h @@ -0,0 +1,39 @@ +/* -*- 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/mailnews/base/public/MailNewsTypes2.idl b/mailnews/base/public/MailNewsTypes2.idl new file mode 100644 index 000000000..5c6d922cc --- /dev/null +++ b/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/. */ + +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 { + 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 { + /// 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 { + // 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 unsigned long nsMsgLabelValue; + +typedef long nsMsgViewSortOrderValue; +typedef long nsMsgViewSortTypeValue; +typedef long nsMsgViewTypeValue; +typedef long nsMsgViewFlagsTypeValue; diff --git a/mailnews/base/public/moz.build b/mailnews/base/public/moz.build new file mode 100644 index 000000000..e38c223e4 --- /dev/null +++ b/mailnews/base/public/moz.build @@ -0,0 +1,77 @@ +# 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/. + +if CONFIG['MOZ_MAILNEWS_OAUTH2']: + XPIDL_SOURCES += ['msgIOAuth2Module.idl'] + +XPIDL_SOURCES += [ + 'MailNewsTypes2.idl', + 'mozINewMailListener.idl', + 'mozINewMailNotificationService.idl', + 'nsICopyMessageListener.idl', + 'nsICopyMsgStreamListener.idl', + 'nsIFolderListener.idl', + 'nsIFolderLookupService.idl', + 'nsIIncomingServerListener.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', + 'nsIMsgFolder.idl', + 'nsIMsgFolderCache.idl', + 'nsIMsgFolderCacheElement.idl', + 'nsIMsgFolderCompactor.idl', + 'nsIMsgFolderListener.idl', + 'nsIMsgFolderNotificationService.idl', + 'nsIMsgHdr.idl', + 'nsIMsgIdentity.idl', + 'nsIMsgIncomingServer.idl', + 'nsIMsgKeyArray.idl', + 'nsIMsgMailNewsUrl.idl', + 'nsIMsgMailSession.idl', + 'nsIMsgMdnGenerator.idl', + 'nsIMsgMessageService.idl', + 'nsIMsgOfflineManager.idl', + 'nsIMsgPluggableStore.idl', + 'nsIMsgPrintEngine.idl', + 'nsIMsgProgress.idl', + 'nsIMsgProtocolInfo.idl', + 'nsIMsgPurgeService.idl', + 'nsIMsgRDFDataSource.idl', + 'nsIMsgShutdown.idl', + 'nsIMsgStatusFeedback.idl', + 'nsIMsgTagService.idl', + 'nsIMsgThread.idl', + 'nsIMsgUserFeedbackListener.idl', + 'nsIMsgWindow.idl', + 'nsISpamSettings.idl', + 'nsIStatusBarBiffManager.idl', + 'nsIStopwatch.idl', + 'nsISubscribableServer.idl', + 'nsIUrlListener.idl', + 'nsMsgFolderFlags.idl', + 'nsMsgMessageFlags.idl', +] + +XPIDL_MODULE = 'msgbase' + +EXPORTS += [ + 'MailNewsTypes.h', + 'msgCore.h', + 'nsMsgBaseCID.h', + 'nsMsgHeaderMasks.h', + 'nsMsgLocalFolderHdrs.h', +] + diff --git a/mailnews/base/public/mozINewMailListener.idl b/mailnews/base/public/mozINewMailListener.idl new file mode 100644 index 000000000..467acb671 --- /dev/null +++ b/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/mailnews/base/public/mozINewMailNotificationService.idl b/mailnews/base/public/mozINewMailNotificationService.idl new file mode 100644 index 000000000..cdd049bcc --- /dev/null +++ b/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/mailnews/base/public/msgCore.h b/mailnews/base/public/msgCore.h new file mode 100644 index 000000000..d14ff6140 --- /dev/null +++ b/mailnews/base/public/msgCore.h @@ -0,0 +1,201 @@ +/* -*- 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 ".msf" + +/* + * The suffix we use for folder subdirectories. + */ +#define FOLDER_SUFFIX ".sbd" + +/* + * 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) +#define NS_MSG_CUSTOM_HEADERS_OVERFLOW NS_MSG_GENERATE_FAILURE(28) //when num of custom headers exceeds 50 +#define NS_MSG_INVALID_CUSTOM_HEADER NS_MSG_GENERATE_FAILURE(29) //when custom header has invalid characters (as per rfc 2822) + +#define NS_MSG_USER_NOT_AUTHENTICATED NS_MSG_GENERATE_FAILURE(30) // when local caches are password protect and user isn't auth + +#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/mailnews/base/public/msgIOAuth2Module.idl b/mailnews/base/public/msgIOAuth2Module.idl new file mode 100644 index 000000000..a24630e35 --- /dev/null +++ b/mailnews/base/public/msgIOAuth2Module.idl @@ -0,0 +1,59 @@ +/* -*- 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 bearer token to use. + 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); + + /** + * Return the base64-encoded string to send as the client initial response for + * SASL XOAUTH2. + */ + ACString buildXOAuth2String(); +}; + +%{C++ +#define MSGIOAUTH2MODULE_CONTRACTID "@mozilla.org/mail/oauth2-module;1" +%} diff --git a/mailnews/base/public/nsICopyMessageListener.idl b/mailnews/base/public/nsICopyMessageListener.idl new file mode 100644 index 000000000..f55c135bc --- /dev/null +++ b/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(in nsIMsgDBHdr message); + 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/mailnews/base/public/nsICopyMsgStreamListener.idl b/mailnews/base/public/nsICopyMsgStreamListener.idl new file mode 100644 index 000000000..8c3c4e080 --- /dev/null +++ b/mailnews/base/public/nsICopyMsgStreamListener.idl @@ -0,0 +1,18 @@ +/* -*- 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 "nsIMsgFolder.idl" +#include "nsICopyMessageListener.idl" + +[scriptable, uuid(7741DAEC-2125-11d3-8A90-0060B0FC04D2)] + +interface nsICopyMessageStreamListener: nsISupports +{ + void Init(in nsIMsgFolder srcFolder, in nsICopyMessageListener destination, in nsISupports listenerData); + void StartMessage(); + void EndMessage(in nsMsgKey key); + void EndCopy(in nsISupports url, in nsresult aStatus); +}; diff --git a/mailnews/base/public/nsIFolderListener.idl b/mailnews/base/public/nsIFolderListener.idl new file mode 100644 index 000000000..7448099eb --- /dev/null +++ b/mailnews/base/public/nsIFolderListener.idl @@ -0,0 +1,63 @@ +/* -*- 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 "nsIAtom.idl" + +interface nsIMsgFolder; +interface nsIMsgDBHdr; + +typedef unsigned long folderListenerNotifyFlagValue; + +[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)] +interface nsIFolderListener : nsISupports { + const folderListenerNotifyFlagValue added = 0x1; + void OnItemAdded(in nsIMsgFolder aParentItem, + in nsISupports aItem); + + const folderListenerNotifyFlagValue removed = 0x2; + void OnItemRemoved(in nsIMsgFolder aParentItem, + in nsISupports aItem); + + const folderListenerNotifyFlagValue propertyChanged = 0x4; + void OnItemPropertyChanged(in nsIMsgFolder aItem, + in nsIAtom aProperty, + in string aOldValue, + in string aNewValue); + + 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 OnItemIntPropertyChanged(in nsIMsgFolder aItem, + in nsIAtom aProperty, + in long long aOldValue, + in long long aNewValue); + + const folderListenerNotifyFlagValue boolPropertyChanged = 0x10; + void OnItemBoolPropertyChanged(in nsIMsgFolder aItem, + in nsIAtom aProperty, + in boolean aOldValue, + in boolean aNewValue); + + const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20; + void OnItemUnicharPropertyChanged(in nsIMsgFolder aItem, + in nsIAtom aProperty, + in wstring aOldValue, + in wstring aNewValue); + + const folderListenerNotifyFlagValue propertyFlagChanged = 0x40; + void OnItemPropertyFlagChanged(in nsIMsgDBHdr aItem, + in nsIAtom aProperty, + in unsigned long aOldFlag, + in unsigned long aNewFlag); + + const folderListenerNotifyFlagValue event = 0x80; + void OnItemEvent(in nsIMsgFolder aItem, in nsIAtom aEvent); + + const folderListenerNotifyFlagValue all = 0xFFFFFFFF; + + // void OnFolderLoaded(in nsIMsgFolder aFolder); + // void OnDeleteOrMoveMessagesCompleted(in nsIMsgFolder aFolder); +}; diff --git a/mailnews/base/public/nsIFolderLookupService.idl b/mailnews/base/public/nsIFolderLookupService.idl new file mode 100644 index 000000000..50894da91 --- /dev/null +++ b/mailnews/base/public/nsIFolderLookupService.idl @@ -0,0 +1,35 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIMsgFolder; + +/** + * 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 ACString aUrl); +}; + +%{C++ +#define NSIFLS_CONTRACTID "@mozilla.org/mail/folder-lookup;1" +%} diff --git a/mailnews/base/public/nsIIncomingServerListener.idl b/mailnews/base/public/nsIIncomingServerListener.idl new file mode 100644 index 000000000..807c903bd --- /dev/null +++ b/mailnews/base/public/nsIIncomingServerListener.idl @@ -0,0 +1,33 @@ +/* -*- 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/mailnews/base/public/nsIMapiRegistry.idl b/mailnews/base/public/nsIMapiRegistry.idl new file mode 100644 index 000000000..a14f62422 --- /dev/null +++ b/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 regsitered 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/mailnews/base/public/nsIMessenger.idl b/mailnews/base/public/nsIMessenger.idl new file mode 100644 index 000000000..fd6ecfc22 --- /dev/null +++ b/mailnews/base/public/nsIMessenger.idl @@ -0,0 +1,141 @@ +/* -*- 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 nsIDOMWindow; +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; + + void setDisplayCharset(in ACString aCharset); + + readonly attribute nsITransactionManager transactionManager; + + void setWindow(in mozIDOMWindowProxy ptr, in nsIMsgWindow msgWindow); + + void addMsgUrlToNavigateHistory(in ACString aURL); + void openURL(in ACString aURL); + + /** load a custom message by url, e.g load a attachment as a email + */ + void loadURL(in mozIDOMWindowProxy ptr, in ACString aURL); + + void launchExternalURL(in ACString aURL); + + boolean canUndo(); + boolean canRedo(); + unsigned long getUndoTransactionType(); + unsigned long getRedoTransactionType(); + void undo(in nsIMsgWindow msgWindow); + void redo(in nsIMsgWindow msgWindow); + void setDocumentCharset(in ACString characterSet); + /** + * 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 ACString 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 unsigned long count, + [array, size_is(count)] in wstring filenameArray, + [array, size_is(count)] in string messageUriArray); + + void openAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment); + void saveAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment); + void saveAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray, + [array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray, + [array, size_is(count)] in string messageUriArray); + + void saveAttachmentToFile(in nsIFile aFile, in ACString aUrl, in ACString aMessageUri, + in ACString 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 unsigned long aCount, + [array, size_is(aCount)] in string aContentTypeArray, + [array, size_is(aCount)] in string aUrlArray, + [array, size_is(aCount)] in string aDisplayNameArray, + [array, size_is(aCount)] in string aMessageUriArray, + in nsIUrlListener aListener); + + void detachAttachment(in string contentTpe, in string url, in string displayName, in string messageUri, in boolean saveFirst, [optional] in boolean withoutWarning); + void detachAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray, + [array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray, + [array, size_is(count)] in string 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 ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsIFile aDestFolder); + + readonly attribute ACString lastDisplayedMessageUri; + + nsIMsgMessageService messageServiceFromURI(in ACString aUri); + nsIMsgDBHdr msgHdrFromURI(in ACString aUri); + // For back forward history, we need a list of visited messages, + // and where we are in the list. + + // aPos is relative to the current history cursor - 1 is forward, -1 is back. + // Unfortunately, you must call this before navigating to this position, + // because calling this has the side effect of making us adjust our current + // history pos, and *not* adding the loaded message to the history queue. + ACString getMsgUriAtNavigatePos(in long aPos); + ACString getFolderUriAtNavigatePos(in long aPos); + attribute long navigatePos; + // If caller just wants the count and cur pos, they can pass in a null history pointer, which will be more efficient + // if they want a list suitable for display in a back/forward menu drop down, they should pass in a aHistory pointer, + // and they'll get returned an array with strings containing something like subject and sender of the message - + // other possible info is the folder containing the message, and the preview text, if available. + void getNavigateHistory(out unsigned long aCurPos, out unsigned long aCount, [array, size_is(aCount)] out string aHistory); + + AString formatFileSize(in unsigned long long aPos, [optional] in boolean aUseKB); +}; + diff --git a/mailnews/base/public/nsIMessengerMigrator.idl b/mailnews/base/public/nsIMessengerMigrator.idl new file mode 100644 index 000000000..2ae6b5372 --- /dev/null +++ b/mailnews/base/public/nsIMessengerMigrator.idl @@ -0,0 +1,15 @@ +/* -*- 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/mailnews/base/public/nsIMessengerOSIntegration.idl b/mailnews/base/public/nsIMessengerOSIntegration.idl new file mode 100644 index 000000000..06e694b98 --- /dev/null +++ b/mailnews/base/public/nsIMessengerOSIntegration.idl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +[scriptable, uuid(d9e45fee-1dd1-11b2-938c-9147855ed837)] +interface nsIMessengerOSIntegration : nsISupports { + // for now, nothing. it's up to the implementation to + // do all the work of registering itself as listeners + // all we guarantee is your service will be created + // when accounts are loaded by the account manager +}; diff --git a/mailnews/base/public/nsIMessengerWindowService.idl b/mailnews/base/public/nsIMessengerWindowService.idl new file mode 100644 index 000000000..78d1e3a44 --- /dev/null +++ b/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 { + /* aWindowType --> the type of window you want to create. i.e. "mail:3pane" + aFolderURI --> the folder resource you want pre-selected (if any) + aMsgKey --> a particular message you may want selected in that folder (if any) + */ + void openMessengerWindowWithUri(in string aWindowType, in string aFolderURI, in nsMsgKey aMsgKey); +}; + diff --git a/mailnews/base/public/nsIMsgAccount.idl b/mailnews/base/public/nsIMsgAccount.idl new file mode 100644 index 000000000..b4965087e --- /dev/null +++ b/mailnews/base/public/nsIMsgAccount.idl @@ -0,0 +1,88 @@ +/* -*- 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" + +interface nsIArray; + +/** + * 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 nsIArray 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/mailnews/base/public/nsIMsgAccountManager.idl b/mailnews/base/public/nsIMsgAccountManager.idl new file mode 100644 index 000000000..53ea2351e --- /dev/null +++ b/mailnews/base/public/nsIMsgAccountManager.idl @@ -0,0 +1,240 @@ +/* -*- 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 { + + 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(); + + /* + * 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", "movemail", "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 nsIArray accounts; + + /* list of all identities in all accounts + * array of nsIMsgIdentity + */ + readonly attribute nsIArray allIdentities; + + /* list of all servers in all accounts, except for hidden and IM servers + * array of nsIMsgIncomingServer + */ + readonly attribute nsIArray 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); + + /* + * search for the server with the given uri + * an analog to FindServer() + * The boolean flag selects whether we compare input against the + * 'realhostname' and 'realuserName' pref settings. + */ + nsIMsgIncomingServer + findServerByURI(in nsIURI aURI, in boolean aRealFlag); + + /* + * Same as FindServer() except it compares the input values against + * 'realhostname' and 'realuserName' pref settings. + */ + nsIMsgIncomingServer + findRealServer(in ACString userName, in ACString hostname, in ACString type, in long port ); + + /** + * 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 + */ + nsIArray 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 + */ + nsIArray 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(); + + /* load accounts 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(); + + void setSpecialFolders(); + + void loadVirtualFolders(); + + /* unload accounts frees all the account manager data structures */ + void UnloadAccounts(); + + 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 nsIAtom event); + 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 nsIArray 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 + */ + ACString folderUriForPath(in nsIFile aLocalPath); + + // Used to sort servers (accounts) for e.g. the folder pane + long getSortOrder(in nsIMsgIncomingServer server); +}; + +%{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.xul and chrome://messenger/locale/am-mdn.properties +}; diff --git a/mailnews/base/public/nsIMsgAsyncPrompter.idl b/mailnews/base/public/nsIMsgAsyncPrompter.idl new file mode 100644 index 000000000..5a59c4f39 --- /dev/null +++ b/mailnews/base/public/nsIMsgAsyncPrompter.idl @@ -0,0 +1,63 @@ +/* -*- 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 asynchoronous + * 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); +}; + +/** + * This is used in combination with nsIMsgAsyncPrompter. + */ +[scriptable, uuid(fb5307a3-39d0-462e-92c8-c5c288a2612f)] +interface nsIMsgAsyncPromptListener : nsISupports { + /** + * Called when the listener should do its prompt. The listener + * should not return until the prompt is complete. + * + * @return True if there is auth information available following the prompt, + * false otherwise. + */ + boolean onPromptStart(); + + /** + * 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/mailnews/base/public/nsIMsgBiffManager.idl b/mailnews/base/public/nsIMsgBiffManager.idl new file mode 100644 index 000000000..52c53d6fa --- /dev/null +++ b/mailnews/base/public/nsIMsgBiffManager.idl @@ -0,0 +1,19 @@ +/* -*- 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/mailnews/base/public/nsIMsgContentPolicy.idl b/mailnews/base/public/nsIMsgContentPolicy.idl new file mode 100644 index 000000000..f3c793854 --- /dev/null +++ b/mailnews/base/public/nsIMsgContentPolicy.idl @@ -0,0 +1,36 @@ +/* -*- 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/mailnews/base/public/nsIMsgCopyService.idl b/mailnews/base/public/nsIMsgCopyService.idl new file mode 100644 index 000000000..bbb935d16 --- /dev/null +++ b/mailnews/base/public/nsIMsgCopyService.idl @@ -0,0 +1,105 @@ +/* -*- 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; +interface nsIArray; + +[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 nsIArray messages, + in nsIMsgFolder dstFolder, + in boolean isMove, + in nsIMsgCopyServiceListener listener, + in nsIMsgWindow msgWindow, + in boolean allowUndo); + + /** + * Copies or moves existing folders do destination folder. + * + * @param folders The array of nsIMsgFolders 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 CopyFolders(in nsIArray folders, + 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/mailnews/base/public/nsIMsgCopyServiceListener.idl b/mailnews/base/public/nsIMsgCopyServiceListener.idl new file mode 100644 index 000000000..2d775e280 --- /dev/null +++ b/mailnews/base/public/nsIMsgCopyServiceListener.idl @@ -0,0 +1,56 @@ +/* -*- 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 taylored specifically + * for nsIMsgCopyService::CopyFileMessage() when saveing 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 taylored + * 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 comman to retrieve the key of + * newly created message. Message ID generated by the compose gurantee 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/mailnews/base/public/nsIMsgCustomColumnHandler.idl b/mailnews/base/public/nsIMsgCustomColumnHandler.idl new file mode 100644 index 000000000..87c67f869 --- /dev/null +++ b/mailnews/base/public/nsIMsgCustomColumnHandler.idl @@ -0,0 +1,42 @@ +/* -*- 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/mailnews/base/public/nsIMsgDBView.idl b/mailnews/base/public/nsIMsgDBView.idl new file mode 100644 index 000000000..2d64c547f --- /dev/null +++ b/mailnews/base/public/nsIMsgDBView.idl @@ -0,0 +1,527 @@ +/* -*- 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 nsIMsgDatabase; +interface nsIMsgSearchSession; +interface nsIMutableArray; +interface nsISimpleEnumerator; +interface nsIMsgCustomColumnHandler; + +typedef long nsMsgViewNotificationCodeValue; +typedef long nsMsgViewCommandCheckStateValue; +typedef long nsMsgViewCommandTypeValue; +typedef long nsMsgNavigationTypeValue; + +[scriptable, uuid(682a18be-fd18-11d4-a5be-0060b0fc04b7)] +interface nsMsgViewSortOrder +{ + const nsMsgViewSortOrderValue none = 0; + const nsMsgViewSortOrderValue ascending = 1; + const nsMsgViewSortOrderValue descending = 2; +}; + +[scriptable, uuid(f28a1cdf-06c3-4e98-8f66-f49991670071)] +interface nsMsgViewType { + 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 +{ + /** + * 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 +{ + 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 +{ + 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 chaged. + */ + const nsMsgViewNotificationCodeValue scramble = 3; + /* Everything changed. Probably means we resorted the folder. We are still working + with the same set of items, or at least have some overlap, but all the indices are + invalid. The "where" and "num" parameters are unused. + */ + 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. + */ + const nsMsgViewNotificationCodeValue totalContentChanged = 5; + /* Introduced for the address book to support virtual list views. The total number of + entries on the LDAP directory has changed and the FE must update its scrollbar. The + "num" parameter contains the total number of entries on the LDAP server. + */ + const nsMsgViewNotificationCodeValue newTopIndex = 6; + /* Introduced for the address book to support virtual list views. The virtual list view + cache data has changed and the FE view may be out of date. The view should be updated + so that the first/top index in the view is the index in the "where" parameter. The + scrollbar should be updated to match the new position. + */ + +}; + +[scriptable, uuid(4ec9248e-0108-11d5-a5be-0060b0fc04b7)] +interface nsMsgViewCommandCheckState +{ + const nsMsgViewCommandCheckStateValue notUsed = 0; + const nsMsgViewCommandCheckStateValue checked = 1; + const nsMsgViewCommandCheckStateValue unchecked = 2; +}; + +[scriptable, uuid(ad36e6cc-0109-11d5-a5be-0060b0fc04b7)] +interface nsMsgViewCommandType +{ + 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 +{ + 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; +}; + + +[scriptable, uuid(fe8a2326-4dd0-11e5-8b8a-206a8aa7a25c)] +interface nsIMsgDBView : nsISupports +{ + void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count); + void openWithHdrs(in nsISimpleEnumerator 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); + + 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); + + /** + * Indicates if navigation of the passed motion type is valid. + */ + boolean navigateStatus(in nsMsgNavigationTypeValue motion); + + 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 + ACString 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. + */ + void getSelectedMsgHdrs([optional] out unsigned long count, + [retval, array, size_is(count)] + out nsIMsgDBHdr headers); + + [deprecated] nsIMutableArray getMsgHdrsForSelection(); + + void getURIsForSelection(out unsigned long count, [retval, array, size_is(count)] out string uris); + void getIndicesForSelection(out unsigned long count, [retval, array, size_is(count)] out nsMsgViewIndex indices); + + readonly attribute ACString URIForFirstSelectedMessage; + readonly attribute nsIMsgDBHdr hdrForFirstSelectedMessage; + void loadMessageByMsgKey(in nsMsgKey aMsgKey); + void loadMessageByViewIndex(in nsMsgViewIndex aIndex); + void loadMessageByUrl(in string aUrl); + void reloadMessage(); + void reloadMessageWithAllParts(); + + /** + * 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); + 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 wstring aColumnName); +}; + +/* 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 specifc 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(); +}; diff --git a/mailnews/base/public/nsIMsgFolder.idl b/mailnews/base/public/nsIMsgFolder.idl new file mode 100644 index 000000000..72beeb154 --- /dev/null +++ b/mailnews/base/public/nsIMsgFolder.idl @@ -0,0 +1,853 @@ +/* -*- 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 "nsISimpleEnumerator.idl" + +interface nsIMsgDBHdr; +interface nsIMsgWindow; +interface nsIMsgDatabase; +interface nsIDBFolderInfo; +interface nsIMsgFilterList; +interface nsIFile; +interface nsIOutputStream; +interface nsIInputStream; +interface nsIFile; +interface nsIMsgIdentity; +interface nsIMsgThread; +interface nsIArray; +interface nsIMutableArray; +interface nsIMsgPluggableStore; + +typedef long nsMsgBiffState; + +// enumerated type for determining if a message has been replied to, forwarded, etc. +typedef long nsMsgDispositionState; + +[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. + + /// Returns an enumerator containing the messages within the current database. + readonly attribute nsISimpleEnumerator messages; + + void startFolderLoading(); + void endFolderLoading(); + + /* get new headers for db */ + void updateFolder(in nsIMsgWindow aWindow); + + readonly attribute AString prettiestName; + + /** + * URL for this folder + */ + readonly attribute ACString 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 + * appopriate. + * + * @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); + + void Delete (); + + void deleteSubFolders(in nsIArray folders, in nsIMsgWindow msgWindow); + void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage, + in nsIMsgWindow msgWindow); + void recursiveDelete(in boolean deleteStorage, in nsIMsgWindow msgWindow); + + /** + * 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. For IMAP folders configured for offline use, + * it will also compact the offline store, and the completed notification + * will occur when the Expunge is finished, not the offline store compaction. + * + * @param aListener Notified of completion, can be null. + * @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/ + * Optionally compact their offline stores as well (imap/news) + * + * @param aListener Notified of completion, can be null. + * @param aMsgWindow For progress/status, can be null. + * @param aCompactOfflineAlso This controls whether we compact all + * offline stores as well. + */ + void compactAll(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow, + in boolean aCompactOfflineAlso); + + void compactAllOfflineStores(in nsIUrlListener aListener, + in nsIMsgWindow aMsgWindow, + in nsIArray aOfflineFolderArray); + + void emptyTrash(in nsIMsgWindow aMsgWindow, 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. + */ + nsIArray getFoldersWithFlags(in unsigned long flags); + + /** + * Lists the folders that have the specified flag set. + * + * @param flags The flag(s) to check for. + * @param folders The array in which to append the found folder(s). + */ + void listFoldersWithFlags(in unsigned long flags, + in nsIMutableArray folders); + + /** + * 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); + + ACString 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 nsIArray messages, + in nsIMsgWindow msgWindow, + in boolean deleteStorage, in boolean isMove, + in nsIMsgCopyServiceListener listener, in boolean allowUndo); + + void copyMessages(in nsIMsgFolder srcFolder, in nsIArray 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 (i.e. panacea.dat) + */ + void writeToFolderCache(in nsIMsgFolderCache folderCache, in boolean deep); + + /** + * the charset of this folder + */ + attribute ACString charset; + attribute boolean charsetOverride; + 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 ACString baseMessageURI; + ACString generateMessageURI(in nsMsgKey msgKey); + + const nsMsgDispositionState nsMsgDispositionState_None = -1; + const nsMsgDispositionState nsMsgDispositionState_Replied = 0; + const nsMsgDispositionState nsMsgDispositionState_Forwarded = 1; + void addMessageDispositionState(in nsIMsgDBHdr aMessage, + in nsMsgDispositionState aDispositionFlag); + + void markMessagesRead(in nsIArray messages, in boolean markRead); + void markAllMessagesRead(in nsIMsgWindow aMsgWindow); + void markMessagesFlagged(in nsIArray messages, in boolean markFlagged); + void markThreadRead(in nsIMsgThread thread); + void setLabelForMessages(in nsIArray messages, in nsMsgLabelValue label); + /** + * 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; + + /// 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 input stream to read the offline contents of an imap or news + * message. + * + * @param aMsgKey key of message to get input stream for. + * @param[out] aOffset filled in with the offset into the stream of the message. + * @param[out] aSize filled in with the size of the message in the offline store. + * + * @returns input stream to read the message from. + */ + nsIInputStream getOfflineFileStream(in nsMsgKey aMsgKey, + out long long aOffset, + out unsigned long aSize); + + /** + * Get the folder where the msg could be present. + * @param msgKey key of the msg for which we are trying to get the folder; + * @returns aMsgFolder required folder; + * + */ + nsIMsgFolder GetOfflineMsgFolder(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); + + /** + * 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. + * @param[out] aReusable set to true if the stream can be re-used, in which + case the caller might not want to close it. + * @returns an input stream to read the message from + */ + nsIInputStream getMsgInputStream(in nsIMsgDBHdr aHdr, out boolean aReusable); + + void DownloadMessagesForOffline(in nsIArray messages, + in nsIMsgWindow window); + nsIMsgFolder getChildWithURI(in ACString 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, + in boolean dbBatching); + 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(); + long compareSortKeys(in nsIMsgFolder msgFolder); + /** + * Returns a sort key that can be used to sort a list of folders. + * + * Prefer nsIMsgFolder::compareSortKeys over this function. + */ + void getSortKey(out unsigned long length, [array, size_is(length), retval] out octet key); + + 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; + + ACString getStringProperty(in string propertyName); + void setStringProperty(in string propertyName, in ACString propertyValue); + + /* does not persist across sessions */ + attribute nsMsgKey lastMessageLoaded; + + /* old nsIFolder properties and methods */ + readonly attribute ACString URI; + attribute AString name; + attribute AString prettyName; + readonly attribute AString abbreviatedName; + + attribute nsIMsgFolder parent; + + /** + * Returns an enumerator containing a list of nsIMsgFolder items that are + * subfolders of the instance this is called on. + */ + readonly attribute nsISimpleEnumerator 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); + void NotifyPropertyChanged(in nsIAtom property, + in ACString oldValue, + in ACString newValue); + void NotifyIntPropertyChanged(in nsIAtom property, + in long long oldValue, + in long long newValue); + void NotifyBoolPropertyChanged(in nsIAtom property, + in boolean oldValue, + in boolean newValue); + void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, + in nsIAtom property, + in unsigned long oldValue, + in unsigned long newValue); + void NotifyUnicharPropertyChanged(in nsIAtom property, + in AString oldValue, + in AString newValue); + + void NotifyItemAdded(in nsISupports item); + void NotifyItemRemoved(in nsISupports item); + + void NotifyFolderEvent(in nsIAtom event); + + // void NotifyFolderLoaded(); + // void NotifyDeleteOrMoveMessagesCompleted(in nsIMsgFolder folder); + + // Gets all descendants, not just first level children. + readonly attribute nsIArray descendants; + /* + * Lists all the folders that are subfolders of the current folder, + * all levels of children. + * + * @param aDescendants The array in which to append the found folder(s). + */ + void ListDescendants(in nsIMutableArray aDescendants); + void Shutdown(in boolean shutdownChildren); + + readonly attribute boolean inVFEditSearchScope; + void setInVFEditSearchScope(in boolean aSearchThisFolder, in boolean aSetOnSubFolders); + void copyDataToOutputStreamForAppend(in nsIInputStream aIStream, + in long aLength, in nsIOutputStream outputStream); + void copyDataDone(); + void setJunkScoreForMessages(in nsIArray 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 aNumKeys number of keys to fetch + * @param aLocalOnly whether to fetch msgs from server (imap msgs might + * be in memory cache from junk filter) + * @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([array, size_is (aNumKeys)] in nsMsgKey aKeysToFetch, + in unsigned long aNumKeys, in boolean aLocalOnly, + 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 nsIArray aMessages, in ACString aKeywords); + void removeKeywordsFromMessages(in nsIArray 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/mailnews/base/public/nsIMsgFolderCache.idl b/mailnews/base/public/nsIMsgFolderCache.idl new file mode 100644 index 000000000..8b3497085 --- /dev/null +++ b/mailnews/base/public/nsIMsgFolderCache.idl @@ -0,0 +1,21 @@ +/* -*- 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; + +[scriptable, uuid(78C2B6A2-E29F-44de-9543-10DBB51E245C)] +interface nsIMsgFolderCache : nsISupports +{ + void Init(in nsIFile aFile); + nsIMsgFolderCacheElement GetCacheElement(in ACString key, in boolean createIfMissing); + void clear(); + void close(); + void commit(in boolean compress); + void removeElement(in ACString key); +}; diff --git a/mailnews/base/public/nsIMsgFolderCacheElement.idl b/mailnews/base/public/nsIMsgFolderCacheElement.idl new file mode 100644 index 000000000..fa158befa --- /dev/null +++ b/mailnews/base/public/nsIMsgFolderCacheElement.idl @@ -0,0 +1,19 @@ +/* -*- 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(c7392b12-f68a-46b2-af5e-d47350bb17c3)] +interface nsIMsgFolderCacheElement : nsISupports +{ + attribute ACString key; + ACString getStringProperty(in string propertyName); + long getInt32Property(in string propertyName); + long long getInt64Property(in string propertyName); + void setStringProperty(in string propertyName, in ACString propertyValue); + void setInt32Property(in string propertyName, in long propertyValue); + void setInt64Property(in string propertyName, in long long propertyValue); +}; diff --git a/mailnews/base/public/nsIMsgFolderCompactor.idl b/mailnews/base/public/nsIMsgFolderCompactor.idl new file mode 100644 index 000000000..66fc27854 --- /dev/null +++ b/mailnews/base/public/nsIMsgFolderCompactor.idl @@ -0,0 +1,46 @@ +/* -*- 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; +interface nsIArray; + +[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 given folder, or its offline store (imap/news only) + * + * @param aFolder The folder to compact + * @param aOfflineStore Just compact the offline store? + * @param aListener Notified of completion, can be null. + * @param aMsgWindow Used for progress/status, can be null + */ + void compact(in nsIMsgFolder aFolder, in boolean aOfflineStore, + in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow); + + /** + * Compact the passed in array of folders, and the passed in offline stores. + * + * @param aArrayOfFoldersToCompact The folders to compact. + * @param aOfflineFolderArray Folders whose offline stores we + * should compact, can be null. + * @param aListener Notified of completion, can be null. + * @param aMsgWindow Used for progress/status, can be null + */ + void compactFolders(in nsIArray aArrayOfFoldersToCompact, + in nsIArray aOfflineFolderArray, + in nsIUrlListener aListener, + in nsIMsgWindow aMsgWindow); +}; diff --git a/mailnews/base/public/nsIMsgFolderListener.idl b/mailnews/base/public/nsIMsgFolderListener.idl new file mode 100644 index 000000000..de557b846 --- /dev/null +++ b/mailnews/base/public/nsIMsgFolderListener.idl @@ -0,0 +1,212 @@ +/* -*- 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 nsIArray; + +/** + * 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 nsIArray aMsgs, in boolean aJunkProcessed, + in boolean aTraitProcessed); + + /** + * 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 nsIArray 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 nsIArray aSrcMsgs, + in nsIMsgFolder aDestFolder, + in nsIArray 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); + + /** + * 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); + + /** + * Notified when a particular event takes place for an item. + * + * Current uses by event string: + * + * - FolderCompactStart: 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. aItem is the folder. + * - FolderCompactFinish: nsIMsgFolderCompactor has completed compaction of + * the folder. This notification will be generated immediately prior to + * the nsIFolderListener::itemEvent() notification with a + * "CompactCompleted" atom. At this point, the folder semaphore has been + * released and the database has been committed. aItem is the folder. + * + * - FolderReindexTriggered: 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 OnItemEvent(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. + * + * - JunkStatusChanged: 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 + * notification may be promoted to an explicit callback function at some + * point. 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. aItem is an nsIArray of + * messages, aData is either a "junk" or "notjunk" atom if all of the + * messages have the same state. + * + * - UnincorporatedMessageMoved: A messages received via POP was moved + * by a "before junk" rule. + * + * @param aItem The item the event takes place on + * @param aEvent String describing the event + * @param aData Data relevant to the event + */ + void itemEvent(in nsISupports aItem, in ACString aEvent, in nsISupports aData); +}; diff --git a/mailnews/base/public/nsIMsgFolderNotificationService.idl b/mailnews/base/public/nsIMsgFolderNotificationService.idl new file mode 100644 index 000000000..0318a1107 --- /dev/null +++ b/mailnews/base/public/nsIMsgFolderNotificationService.idl @@ -0,0 +1,98 @@ +/* -*- 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; +interface nsIArray; + +typedef unsigned long msgFolderListenerFlag; + +[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::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::itemEvent notification + const msgFolderListenerFlag itemEvent = 0x1000000; + + /// 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 nsIArray aMsgs, + in boolean aJunkProcessed, + in boolean aTraitProcessed); + void notifyMsgsDeleted(in nsIArray aMsgs); + void notifyMsgsMoveCopyCompleted(in boolean aMove, + in nsIArray aSrcMsgs, + in nsIMsgFolder aDestFolder, + in nsIArray 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); + // 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); + + // extensibility hook + void notifyItemEvent(in nsISupports aItem, + in ACString aEvent, + in nsISupports aData); +}; diff --git a/mailnews/base/public/nsIMsgHdr.idl b/mailnews/base/public/nsIMsgHdr.idl new file mode 100644 index 000000000..977695c10 --- /dev/null +++ b/mailnews/base/public/nsIMsgHdr.idl @@ -0,0 +1,104 @@ +/* -*- 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 +{ + /* general property routines - I think this can retrieve any + header in the db */ + AString getProperty(in string propertyName); + void setProperty(in string propertyName, in AString propertyStr); + void setStringProperty(in string propertyName, in string propertyValue); + string 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; + void setPriorityString(in string 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 */ + attribute unsigned long messageSize; + attribute unsigned long lineCount; + attribute unsigned long statusOffset; + /** + * 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; + 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 string subject; + attribute string recipients; + + /* anything below here still has to be fixed */ + void setReferences(in string references); + readonly attribute unsigned short numReferences; + ACString getStringReference(in long refNum); + + readonly attribute AString mime2DecodedAuthor; + readonly attribute AString mime2DecodedSubject; + readonly attribute AString mime2DecodedRecipients; + + void getAuthorCollationKey(out unsigned long aCount, + [array, size_is(aCount)] out octet aKey); + void getSubjectCollationKey(out unsigned long aCount, + [array, size_is(aCount)] out octet aKey); + void getRecipientsCollationKey(out unsigned long aCount, + [array, size_is(aCount)] out octet aKey); + + attribute string Charset; + /** + * Returns the effective character set for the message (@ref Charset). + * If there is no specific set defined for the message or the + * characterSetOverride option is turned on for the folder it will return + * the effective character set of the folder instead. + */ + readonly attribute ACString effectiveCharset; + attribute nsMsgLabelValue label; + attribute string accountKey; + readonly attribute nsIMsgFolder folder; + + /// Enumerator for names of all database properties in the header. + readonly attribute nsIUTF8StringEnumerator propertyEnumerator; +}; +/* *******************************************************************************/ + diff --git a/mailnews/base/public/nsIMsgIdentity.idl b/mailnews/base/public/nsIMsgIdentity.idl new file mode 100644 index 000000000..88298bd04 --- /dev/null +++ b/mailnews/base/public/nsIMsgIdentity.idl @@ -0,0 +1,250 @@ +/* -*- 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; + + /** + * 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; + + /** + * 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 ACString 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 compatability. 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 ACString draftFolder; + attribute ACString archiveFolder; + attribute ACString 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; + + /* 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/mailnews/base/public/nsIMsgIncomingServer.idl b/mailnews/base/public/nsIMsgIncomingServer.idl new file mode 100644 index 000000000..a4349257d --- /dev/null +++ b/mailnews/base/public/nsIMsgIncomingServer.idl @@ -0,0 +1,590 @@ +/* -*- 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; + + /** + * 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 ACString hostName; + + /** + * real hostname of the server (if server name is changed it's stored here) + */ + attribute ACString realHostName; + + /* port of the server */ + attribute long port; + + /** + * userid to log into the server + */ + attribute ACString username; + + /** + * real username of the server (if username is changed it's stored here) + */ + attribute ACString realUsername; + + /** + * protocol type, i.e. "pop3", "imap", "nntp", "none", etc + * used to construct URLs + */ + attribute ACString type; + + /** + * 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 ACString oldName, in ACString newName, + in bool hostnameChanged); + + /* cleartext version of the password */ + attribute ACString 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. + * @param aMsgWindow A message window to associate the prompt with. + * @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. + */ + ACString getPasswordWithUI(in AString aPromptString, in AString aPromptTitle, + in nsIMsgWindow aMsgWindow); + + /* forget the password in memory and in single signon database */ + void forgetPassword(); + + /* forget the password in memory which is cached for the session */ + void forgetSessionPassword(); + + /* 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 ACString 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 + * appopriate. + * + * @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 panacea.dat */ + 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(); + + void displayOfflineMsg(in nsIMsgWindow aWindow); + + /* 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; + + /* check if this server allows canEmptyTrashOnExit operations */ + readonly attribute boolean canEmptyTrashOnExit; + + /* 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 and Movemail 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 ACString 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/mailnews/base/public/nsIMsgKeyArray.idl b/mailnews/base/public/nsIMsgKeyArray.idl new file mode 100644 index 000000000..183195440 --- /dev/null +++ b/mailnews/base/public/nsIMsgKeyArray.idl @@ -0,0 +1,54 @@ +/* -*- 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/. */ + + +/** + * This interface wraps an nsTArray<nsMsgKey> so that we can pass arrays + * back and forth between c++ and js (or via xpconnect generally). + */ + +#include "nsISupports.idl" +#include "MailNewsTypes2.idl" + +[scriptable, uuid(4aa3ed2e-5bb1-40b3-ad03-2f1cfef386c4)] +interface nsIMsgKeyArray : nsISupports { + /** + * Get the key at the specified 0-based array index. + * + * @param aIndex 0-based index. + * @returns key at the specified index. + */ + nsMsgKey getKeyAt(in long aIndex); + + readonly attribute unsigned long length; + + void setCapacity(in unsigned long aCapacity); + /** + * Adds a key to the end of the array + * @param key to append to the array. + */ + void appendElement(in nsMsgKey aMsgKey); + + /** + * Inserts a key into a previously sorted array + * @param key to insert into the array. + */ + void insertElementSorted(in nsMsgKey aMsgKey); + + /** + * Sort the array by key. + */ + void sort(); + + /** + * Retrieves the entire array in such a way that xpconnect can easily + * create a js array of the keys. + * + * @returns array of the keys + */ + void getArray(out unsigned long aCount, + [array, size_is(aCount)] out nsMsgKey aKeys); +}; + diff --git a/mailnews/base/public/nsIMsgMailNewsUrl.idl b/mailnews/base/public/nsIMsgMailNewsUrl.idl new file mode 100644 index 000000000..e0ce7f07d --- /dev/null +++ b/mailnews/base/public/nsIMsgMailNewsUrl.idl @@ -0,0 +1,201 @@ +/* -*- 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 nsIMsgHeaderSink; +interface nsIMsgDBHdr; +interface nsIDocShellLoadInfo; +interface nsIDocShell; + +[scriptable, uuid(995455ba-5bb4-4643-8d70-2b877a2e1320)] +interface nsIMsgMailNewsUrl : nsIURL { + /////////////////////////////////////////////////////////////////////////////// + // 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); + + // These are used by cloneInternal to determine the disposition of the uri + // ref when cloning. They should match the RefHandlingEnum enums defined, + // for example, in nsStandardURI.h but are not strictly required to do so. + + /// Ignore the ref field, replacing with blank. + const unsigned long IGNORE_REF = 0; + + /// Keep the existing ref field. + const unsigned long HONOR_REF = 1; + + /// Replace the ref field with a new value. + const unsigned long REPLACE_REF = 2; + + /** + * The general clone method that other clone methods use. + * + * This class should NOT be called except from classes that override + * a base class. + * + * @param aRefHandlingMode one of the Ref constants defined above. + * @param aNewRef the new reference, if needed. + * @return a cloned version of the current object. + */ + nsIURI cloneInternal(in unsigned long aRefHandlingMode, in AUTF8String aNewRef); + + readonly attribute nsIMsgIncomingServer server; + + /** + * 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 + + 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); + + // typically the header sink is tied to the nsIMsgWindow, but in certain circumstances, a consumer + // may chose to provide its own header sink for this url + attribute nsIMsgHeaderSink msgHeaderSink; + + /// 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 loadInfo This is the extended load info for this load. This + * most often will be null, but if you need to do + * additional setup for this load you can get a loadInfo + * object by calling createLoadInfo. Once you have this + * object you can set the needed properties on it and + * then pass it to loadURI. + * + * @param aLoadFlags Flags to modify load behaviour. Flags are defined in + * nsIWebNavigation. Note that using flags outside + * LOAD_FLAGS_MASK is only allowed if passing in a + * non-null loadInfo. And even some of those might not + * be allowed. Use at your own risk. See nsIDocShell.idl + */ + void loadURI(in nsIDocShell docshell, + in nsIDocShellLoadInfo loadInfo, + 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 string 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 string originalSpec; + + // This is used when creating a principal for the URL. + readonly attribute AUTF8String principalSpec; + + /** + * 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. + */ + 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 { + + /** + * the charset associated with a folder for this url. + * + * @exception NS_ERROR_FAILURE May be thrown if the url does not + * relate to a folder, e.g. standalone + * .eml messages. + */ + readonly attribute string folderCharset; + readonly attribute boolean folderCharsetOverride; + // the charsetOverRide is a charset the user may have specified via the menu for + // a particular message + attribute string charsetOverRide; +}; diff --git a/mailnews/base/public/nsIMsgMailSession.idl b/mailnews/base/public/nsIMsgMailSession.idl new file mode 100644 index 000000000..ca3fe8a6e --- /dev/null +++ b/mailnews/base/public/nsIMsgMailSession.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" + +/* + * 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); + + string ConvertMsgURIToMsgURL(in string aURI, in nsIMsgWindow aMsgWindow); + nsIFile getDataFilesDir(in string dirName); +}; + diff --git a/mailnews/base/public/nsIMsgMdnGenerator.idl b/mailnews/base/public/nsIMsgMdnGenerator.idl new file mode 100644 index 000000000..277975e71 --- /dev/null +++ b/mailnews/base/public/nsIMsgMdnGenerator.idl @@ -0,0 +1,81 @@ +/* -*- 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; + +%{C++ +#define NS_MSGMDNGENERATOR_CONTRACTID \ + "@mozilla.org/messenger-mdn/generator;1" + +#define NS_MSGMDNGENERATOR_CID \ +{ /* ec917b13-8f73-4d4d-9146-d7f7aafe9076 */ \ + 0xec917b13, 0x8f73, 0x4d4d, \ + { 0x91, 0x46, 0xd7, 0xf7, 0xaa, 0xfe, 0x90, 0x76 }} +%} + +[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/mailnews/base/public/nsIMsgMessageService.idl b/mailnews/base/public/nsIMsgMessageService.idl new file mode 100644 index 000000000..38a2e2821 --- /dev/null +++ b/mailnews/base/public/nsIMsgMessageService.idl @@ -0,0 +1,259 @@ +/* -*- 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" +%} + +[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 + * @param aURL + */ + void CopyMessage(in string aSrcURI, in nsIStreamListener aCopyListener, in boolean aMoveMessage, + in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow, out nsIURI aURL); + + /** + * 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 unsigned long aNumKeys, + [array, size_is (aNumKeys)] in nsMsgKey aKeys, + in nsIMsgFolder srcFolder, + in nsIStreamListener aCopyListener, + in boolean aMoveMessage, + in nsIUrlListener aUrlListener, + in nsIMsgWindow aMsgWindow); + + + /** + * When you want a message displayed.... + * + * @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 aCharsetOverride (optional) character set over ride to force the message to use. + * @param aURL + */ + void DisplayMessage(in string aMessageURI, + in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener, + in string aCharsetOverride, + out nsIURI aURL); + + /** + * When you want an attachment downloaded + * + * @param aContentType We need to know the content type of the attachment + * @param aFileName The name of the attachment. + * @param aUrl String representation of the original url associated with the msg. + * @param aMessageUri RDF resource that describes the message + * @param aDisplayConsumer + * @param aMsgWindow Message window + * @param aUrlListener + */ + void openAttachment(in string aContentType, + in string aFileName, + in string aUrl, + in string aMessageUri, + in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener); + + /** + * 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 string 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 aURL URL which can be run through necko. + * @param aMsgWindow + */ + void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow); + + /** + * When you want a message displayed in a format that is suitable for printing.... + * + * @param aMessageURI A uri representing the message to display. + * @param aDisplayConsumer is (for now) a nsIDocShell which we'll use to load + * the message into. + * XXXbz should it be an nsIWebNavigation? + * @param aMsgWindow + * @param aUrlListener + * @param aURL + */ + void DisplayMessageForPrinting(in string aMessageURI, in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener, + out nsIURI aURL); + + /** + * + * + * @param aSearchSession + * @param aMsgWindow + * @param aMsgFolder + * @param aSearchUri + */ + void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in nsIMsgFolder aMsgFolder, in string 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 string 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 string 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 string 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 string aMessageUri, in nsISupports aDisplayConsumer, + in nsIMsgWindow aMsgWindow, + in nsIUrlListener aUrlListener); +}; diff --git a/mailnews/base/public/nsIMsgOfflineManager.idl b/mailnews/base/public/nsIMsgOfflineManager.idl new file mode 100644 index 000000000..983075f2c --- /dev/null +++ b/mailnews/base/public/nsIMsgOfflineManager.idl @@ -0,0 +1,23 @@ +/* -*- 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/mailnews/base/public/nsIMsgPluggableStore.idl b/mailnews/base/public/nsIMsgPluggableStore.idl new file mode 100644 index 000000000..12713b236 --- /dev/null +++ b/mailnews/base/public/nsIMsgPluggableStore.idl @@ -0,0 +1,330 @@ +/* -*- 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 nsIFile; +interface nsIMsgFolder; +interface nsIMsgCopyServiceListener; +interface nsIMsgDBHdr; +interface nsIMsgWindow; +interface nsIOutputStream; +interface nsIInputStream; +interface nsIArray; +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_DISK_FULL = 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. + * @param aReusable set to true on output if the caller can reuse the + * stream for multiple messages, e.g., mbox format. + * This means the caller will likely get the same stream + * back on multiple calls to this method, and shouldn't + * close the stream in between calls if they want reuse. + * + * @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, + out boolean aReusable); + + /** + * 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. + * + * @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? + * + * @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. + * If the input stream is reusable, and the caller is going to ask + * for input streams for other messages in the folder, then the caller + * should not close the stream until it is done with its messages. + * + * @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. + * @param aOffset offset in the returned stream of the message. + * @param[optional] aHdr msgHdr to use in case storeToken is not set. This is + * for upgrade from existing profiles. + * @param[optional] aReusable Is the returned stream re-usable for other + * messages' input streams? + */ + nsIInputStream getMsgInputStream(in nsIMsgFolder aFolder, + in ACString aMsgToken, + out long long aOffset, + [optional] in nsIMsgDBHdr aHdr, + [optional] out boolean aReusable); + + /** + * Delete the passed in messages. These message should all be in the + * same folder. + * @param aHdrArray array of nsIMsgDBHdr's. + */ + void deleteMessages(in nsIArray 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 not want to implement this, the core + * code will use getMsgInputStream on the source message, + * getNewMsgOutputStream for the dest message, and stream the input to + * the output. This operation can be asynchronous. + * 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. + * + * @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 aListener listener to notify of copy status. + * @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 nsIArray aHdrArray, + in nsIMsgFolder aDstFolder, + in nsIMsgCopyServiceListener aListener, + out nsIArray 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 nsIArray 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 nsIArray 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/mailnews/base/public/nsIMsgPrintEngine.idl b/mailnews/base/public/nsIMsgPrintEngine.idl new file mode 100644 index 000000000..725471eed --- /dev/null +++ b/mailnews/base/public/nsIMsgPrintEngine.idl @@ -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/. */ + +#include "nsrootidl.idl" +#include "nsIMsgStatusFeedback.idl" + +interface mozIDOMWindowProxy; +interface nsIPrintSettings; +interface nsIObserver; + +[scriptable, uuid(9bdd0812-dd48-4f04-87a9-74dcfc3abadc)] +interface nsIMsgPrintEngine : nsISupports { + /** + * Print/PrintPreview Msg Type + */ + const short MNAB_START = 0; + const short MNAB_PRINT_MSG = 0; + const short MNAB_PRINTPREVIEW_MSG = 1; + const short MNAB_PRINT_AB_CARD = 2; + const short MNAB_PRINTPREVIEW_AB_CARD = 3; + const short MNAB_PRINT_ADDRBOOK = 4; + const short MNAB_PRINTPREVIEW_ADDRBOOK = 5; + const short MNAB_END = 6; + + void setWindow(in mozIDOMWindowProxy ptr); + void setParentWindow(in mozIDOMWindowProxy ptr); + void showWindow(in boolean aShow); + void setStatusFeedback(in nsIMsgStatusFeedback feedback); + void setPrintURICount(in int32_t aCount); + void addPrintURI(in wstring aURI); + void startPrintOperation(in nsIPrintSettings aPS); + void setStartupPPObserver(in nsIObserver startupPPObs); + void setMsgType(in long aMsgType); + + attribute boolean doPrintPreview; + +}; + diff --git a/mailnews/base/public/nsIMsgProgress.idl b/mailnews/base/public/nsIMsgProgress.idl new file mode 100644 index 000000000..79994c093 --- /dev/null +++ b/mailnews/base/public/nsIMsgProgress.idl @@ -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/. */ +#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/mailnews/base/public/nsIMsgProtocolInfo.idl b/mailnews/base/public/nsIMsgProtocolInfo.idl new file mode 100644 index 000000000..0913d93bd --- /dev/null +++ b/mailnews/base/public/nsIMsgProtocolInfo.idl @@ -0,0 +1,99 @@ +/* -*- 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/mailnews/base/public/nsIMsgPurgeService.idl b/mailnews/base/public/nsIMsgPurgeService.idl new file mode 100644 index 000000000..e418444de --- /dev/null +++ b/mailnews/base/public/nsIMsgPurgeService.idl @@ -0,0 +1,14 @@ +/* -*- 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/mailnews/base/public/nsIMsgRDFDataSource.idl b/mailnews/base/public/nsIMsgRDFDataSource.idl new file mode 100644 index 000000000..3b2a185cf --- /dev/null +++ b/mailnews/base/public/nsIMsgRDFDataSource.idl @@ -0,0 +1,16 @@ +/* -*- 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 "nsIMsgWindow.idl" + +[scriptable, uuid(BB460DFE-8BF0-11d3-8AFE-0060B0FC04D2)] + +/* Interface used to access functions particular to mailnews datasources */ + +interface nsIMsgRDFDataSource : nsISupports +{ + attribute nsIMsgWindow window; +}; diff --git a/mailnews/base/public/nsIMsgShutdown.idl b/mailnews/base/public/nsIMsgShutdown.idl new file mode 100644 index 000000000..1750f8ba8 --- /dev/null +++ b/mailnews/base/public/nsIMsgShutdown.idl @@ -0,0 +1,69 @@ +/* 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 wheter 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/mailnews/base/public/nsIMsgStatusFeedback.idl b/mailnews/base/public/nsIMsgStatusFeedback.idl new file mode 100644 index 000000000..2f637e619 --- /dev/null +++ b/mailnews/base/public/nsIMsgStatusFeedback.idl @@ -0,0 +1,19 @@ +/* -*- 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/mailnews/base/public/nsIMsgTagService.idl b/mailnews/base/public/nsIMsgTagService.idl new file mode 100644 index 000000000..b666c3b62 --- /dev/null +++ b/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); + 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 + void getAllTags(out unsigned long count, + [retval, array, size_is(count)] out nsIMsgTag tagArray); + /* + * 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/mailnews/base/public/nsIMsgThread.idl b/mailnews/base/public/nsIMsgThread.idl new file mode 100644 index 000000000..9af6b2dc9 --- /dev/null +++ b/mailnews/base/public/nsIMsgThread.idl @@ -0,0 +1,36 @@ +/* -*- 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 "nsISimpleEnumerator.idl" +#include "MailNewsTypes2.idl" + +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(out long index); + void removeChildAt(in unsigned long index); + void removeChildHdr(in nsIMsgDBHdr child, in nsIDBChangeAnnouncer announcer); + + void markChildRead(in boolean bRead); + + nsIMsgDBHdr getFirstUnreadChild(); + + nsISimpleEnumerator enumerateMessages(in nsMsgKey parent); +}; diff --git a/mailnews/base/public/nsIMsgUserFeedbackListener.idl b/mailnews/base/public/nsIMsgUserFeedbackListener.idl new file mode 100644 index 000000000..f798c4b86 --- /dev/null +++ b/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/mailnews/base/public/nsIMsgWindow.idl b/mailnews/base/public/nsIMsgWindow.idl new file mode 100644 index 000000000..00673732b --- /dev/null +++ b/mailnews/base/public/nsIMsgWindow.idl @@ -0,0 +1,98 @@ +/* -*- 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 nsIMsgHeaderSink; +interface nsIPrompt; +interface nsIInterfaceRequestor; +interface nsIAuthPrompt; + +[scriptable, uuid(7B8F4A65-CFC4-4b3f-BF5C-152AA8D5CD10)] +interface nsIMsgWindowCommands : nsISupports { + void selectFolder(in ACString folderUri); + void selectMessage(in ACString messageUri); + void clearMsgPane(); +}; + +[scriptable, uuid(a846fe48-4022-4296-a1c4-1dcd7eaecfe5)] +interface nsIMsgWindow : nsISupports { + attribute nsIMsgStatusFeedback statusFeedback; + attribute nsIMsgWindowCommands windowCommands; + attribute nsIMsgHeaderSink msgHeaderSink; + 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; + + /** + * Returns the auth prompt associated with the window. This will only return + * a value if the rootDocShell has been set. + */ + readonly attribute nsIAuthPrompt authPrompt; + + /** + * These are currently used to set notification callbacks on + * protocol channels to handle things like bad cert exceptions. + */ + attribute nsIInterfaceRequestor notificationCallbacks; + + void displayHTMLInMessagePane(in AString title, in AString body, in boolean clearMsgHdr); + + readonly attribute nsIPrompt promptDialog; + attribute ACString mailCharacterSet; + + /** + Remember the message's charaset was overridden, so it can be inherited (e.g for quoting). + */ + attribute boolean charsetOverride; + + /** + 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(); +}; + +[scriptable, uuid(FFBC8B13-243F-4cd9-92D0-01636CDA425E)] +interface nsIMsgWindowTest : nsISupports { + /** + * For testing only, allow setting a few read-only attributes + */ + void setPromptDialog(in nsIPrompt promptDialog); + void setAuthPrompt(in nsIAuthPrompt authPrompt); +}; diff --git a/mailnews/base/public/nsIMsgWindowData.idl b/mailnews/base/public/nsIMsgWindowData.idl new file mode 100644 index 000000000..78b965fd9 --- /dev/null +++ b/mailnews/base/public/nsIMsgWindowData.idl @@ -0,0 +1,23 @@ +/* -*- 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 "nsIMsgStatusFeedback.idl" +#include "nsIMessageView.idl" + +interface nsITransactionManager; + +/* + * This interface can be used to set data specific to a window. + */ + + +[scriptable, uuid(BD85A416-5433-11d3-8AC5-0060B0FC04D2)] +interface nsIMsgWindowData : nsISupports { + + attribute nsIMsgStatusFeedback statusFeedback; + attribute nsITransactionManager transactionManager; + attribute nsIMessageView messageView; +};
\ No newline at end of file diff --git a/mailnews/base/public/nsISpamSettings.idl b/mailnews/base/public/nsISpamSettings.idl new file mode 100644 index 000000000..2c6e2a092 --- /dev/null +++ b/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; + attribute string actionTargetAccount; + attribute string actionTargetFolder; + + /** + * built from moveTargetMode, actionTargetAccount, actionTargetFolder + */ + readonly attribute string spamFolderURI; + + attribute boolean purge; + /** + * interval, in days + */ + attribute long purgeInterval; + + attribute boolean useWhiteList; + attribute string 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/mailnews/base/public/nsIStatusBarBiffManager.idl b/mailnews/base/public/nsIStatusBarBiffManager.idl new file mode 100644 index 000000000..88dc4d7b4 --- /dev/null +++ b/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/mailnews/base/public/nsIStopwatch.idl b/mailnews/base/public/nsIStopwatch.idl new file mode 100644 index 000000000..6e40ace07 --- /dev/null +++ b/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/mailnews/base/public/nsISubscribableServer.idl b/mailnews/base/public/nsISubscribableServer.idl new file mode 100644 index 000000000..5d1f71b03 --- /dev/null +++ b/mailnews/base/public/nsISubscribableServer.idl @@ -0,0 +1,76 @@ +/* -*- 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 nsIRDFResource; +interface nsIRDFNode; +interface nsISimpleEnumerator; + +[scriptable, uuid(61a08c3a-1dd2-11b2-b64f-c4b2de1cf129)] +interface nsISubscribeDataSource : nsISupports { + readonly attribute boolean hasObservers; + void NotifyObservers(in nsIRDFResource subject, in nsIRDFResource property, in nsIRDFNode object, in boolean isAssert, in boolean isChange); +}; + +[scriptable, uuid(f337b84a-1dd1-11b2-97c7-fb8b2e3f2280)] +interface nsISubscribeListener : nsISupports { + 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 string 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 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. + * @return Enumerator containing the children. + */ + nsISimpleEnumerator getChildren(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; +}; + diff --git a/mailnews/base/public/nsIUrlListener.idl b/mailnews/base/public/nsIUrlListener.idl new file mode 100644 index 000000000..93df30b6c --- /dev/null +++ b/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/mailnews/base/public/nsMsgBaseCID.h b/mailnews/base/public/nsMsgBaseCID.h new file mode 100644 index 000000000..efdfcbb71 --- /dev/null +++ b/mailnews/base/public/nsMsgBaseCID.h @@ -0,0 +1,536 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsMessageBaseCID_h__ +#define nsMessageBaseCID_h__ + +#include "nsISupports.h" +#include "nsIFactory.h" +#include "nsIComponentManager.h" + +// +// nsMsgFolderDataSource +// +#define NS_MAILNEWSFOLDERDATASOURCE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "mailnewsfolders" + +#define NS_MAILNEWSFOLDERDATASOURCE_CID \ +{ /* 2B8ED4A4-F684-11d2-8A5D-0060B0FC04D2 */ \ + 0x2b8ed4a4, \ + 0xf684, \ + 0x11d2, \ + {0x8a, 0x5d, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2} \ +} + +#define NS_MAILNEWSUNREADFOLDERDATASOURCE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "mailnewsunreadfolders" + +#define NS_MAILNEWSUNREADFOLDERDATASOURCE_CID \ +{ /* 39b6b638-5b9d-45aa-b645-77fe56bbddb7 */ \ + 0x39b6b638, \ + 0x5b9d, \ + 0x45aa, \ + {0xb6, 0x45, 0x77, 0xfe, 0x56, 0xbb, 0xdd, 0xb7} \ +} + +#define NS_MAILNEWSFAVORITEFOLDERDATASOURCE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "mailnewsfavefolders" + +#define NS_MAILNEWSFAVORITEFOLDERDATASOURCE_CID \ +{ /* dfdedc28-1b0c-4b7a-bbff-c98808034242 */ \ + 0xdfdedc28, \ + 0x1b0c, \ + 0x4b7a, \ + {0xbb, 0xff, 0xc9, 0x88, 0x08, 0x03, 0x42, 0x42} \ +} + +#define NS_MAILNEWSRECENTFOLDERDATASOURCE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "mailnewsrecentfolders" + +#define NS_MAILNEWSRECENTFOLDERDATASOURCE_CID \ +{ /* 64921b82-24bb-4473-ada9-dc89426129a6 */ \ + 0x64921b82, \ + 0x24bb, \ + 0x4473, \ + {0xad, 0xa9, 0xdc, 0x89, 0x42, 0x61, 0x29, 0xa6} \ +} + +// +// nsMsgAccountManager +// +#define NS_MSGACCOUNTMANAGER_CONTRACTID \ + "@mozilla.org/messenger/account-manager;1" + +#define NS_MSGACCOUNTMANAGER_CID \ +{ /* D2876E50-E62C-11d2-B7FC-00805F05FFA5 */ \ + 0xd2876e50, 0xe62c, 0x11d2, \ + {0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }} + + +// +// nsMsgIdentity +// +#define NS_MSGIDENTITY_CONTRACTID \ + "@mozilla.org/messenger/identity;1" + +#define NS_MSGIDENTITY_CID \ +{ /* 8fbf6ac0-ebcc-11d2-b7fc-00805f05ffa5 */ \ + 0x8fbf6ac0, 0xebcc, 0x11d2, \ + {0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }} + +// +// nsMsgIncomingServer +#define NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX \ + "@mozilla.org/messenger/server;1?type=" + +#define NS_MSGINCOMINGSERVER_CONTRACTID \ + NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "generic" + +/* {66e5ff08-5126-11d3-9711-006008948010} */ +#define NS_MSGINCOMINGSERVER_CID \ + {0x66e5ff08, 0x5126, 0x11d3, \ + {0x97, 0x11, 0x00, 0x60, 0x08, 0x94, 0x80, 0x10}} + + +// +// nsMsgAccount +// +#define NS_MSGACCOUNT_CONTRACTID \ + "@mozilla.org/messenger/account;1" + +#define NS_MSGACCOUNT_CID \ +{ /* 68b25510-e641-11d2-b7fc-00805f05ffa5 */ \ + 0x68b25510, 0xe641, 0x11d2, \ + {0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }} + +// +// nsMsgFilterService +// +#define NS_MSGFILTERSERVICE_CONTRACTID \ + "@mozilla.org/messenger/services/filters;1" + +#define NS_MSGFILTERSERVICE_CID \ +{ 0x5cbb0700, 0x04bc, 0x11d3, \ + { 0xa5, 0x0a, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 } } + + +// +// nsMsgSearchSession +// +/* e9a7cd70-0303-11d3-a50a-0060b0fc04b7 */ +#define NS_MSGSEARCHSESSION_CID \ +{ 0xe9a7cd70, 0x0303, 0x11d3, \ + { 0xa5, 0x0a, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 } } + +#define NS_MSGSEARCHSESSION_CONTRACTID \ + "@mozilla.org/messenger/searchSession;1" + +/* E1DA397D-FDC5-4b23-A6FE-D46A034D80B3 */ +#define NS_MSGSEARCHTERM_CID \ +{ 0xe1da397d, 0xfdc5, 0x4b23, \ + { 0xa6, 0xfe, 0xd4, 0x6a, 0x3, 0x4d, 0x80, 0xb3 } } + +#define NS_MSGSEARCHTERM_CONTRACTID \ + "@mozilla.org/messenger/searchTerm;1" + +// +// nsMsgSearchValidityManager +// +/* 1510faee-ad1a-4194-8039-33de32d5a882 */ +#define NS_MSGSEARCHVALIDITYMANAGER_CID \ + {0x1510faee, 0xad1a, 0x4194, \ + { 0x80, 0x39, 0x33, 0xde, 0x32, 0xd5, 0xa8, 0x82 }} + +#define NS_MSGSEARCHVALIDITYMANAGER_CONTRACTID \ + "@mozilla.org/mail/search/validityManager;1" + +// +// nsMsgMailSession +// +#define NS_MSGMAILSESSION_CONTRACTID \ + "@mozilla.org/messenger/services/session;1" + +/* D5124441-D59E-11d2-806A-006008128C4E */ +#define NS_MSGMAILSESSION_CID \ +{ 0xd5124441, 0xd59e, 0x11d2, \ + { 0x80, 0x6a, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e } } + +// +// nsMsgBiffManager +// +#define NS_MSGBIFFMANAGER_CONTRACTID \ + "@mozilla.org/messenger/biffManager;1" + +/* 4A374E7E-190F-11d3-8A88-0060B0FC04D2 */ +#define NS_MSGBIFFMANAGER_CID \ +{ 0x4a374e7e, 0x190f, 0x11d3, \ + { 0x8a, 0x88, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2 } } + + +// +// nsMsgPurgeService +// +#define NS_MSGPURGESERVICE_CONTRACTID \ + "@mozilla.org/messenger/purgeService;1" + +/* a687b474-afd8-418f-8ad9-f362202ae9a9 */ +#define NS_MSGPURGESERVICE_CID \ +{ 0xa687b474, 0xafd8, 0x418f, \ + { 0x8a, 0xd9, 0xf3, 0x62, 0x20, 0x2a, 0xe9, 0xa9 } } + +// +// nsStatusBarBiffManager +// +#define NS_STATUSBARBIFFMANAGER_CONTRACTID \ + "@mozilla.org/messenger/statusBarBiffManager;1" + +/* 7f9a9fb0-4161-11d4-9876-00c04fa0d2a6 */ +#define NS_STATUSBARBIFFMANAGER_CID \ +{ 0x7f9a9fb0, 0x4161, 0x11d4, \ + {0x98, 0x76, 0x00, 0xc0, 0x4f, 0xa0, 0xd2, 0xa6} } + +// +// nsCopyMessageStreamListener +// +#define NS_COPYMESSAGESTREAMLISTENER_CONTRACTID \ + "@mozilla.org/messenger/copymessagestreamlistener;1" + +#define NS_COPYMESSAGESTREAMLISTENER_CID \ +{ 0x7741daed, 0x2125, 0x11d3, \ + { 0x8a, 0x90, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2 } } + +// +// nsMsgCopyService +// +#define NS_MSGCOPYSERVICE_CONTRACTID \ + "@mozilla.org/messenger/messagecopyservice;1" + +/* c766e666-29bd-11d3-afb3-001083002da8 */ +#define NS_MSGCOPYSERVICE_CID \ +{ 0xc766e666, 0x29bd, 0x11d3, \ + { 0xaf, 0xb3, 0x00, 0x10, 0x83, 0x00, 0x2d, 0xa8 } } + +#define NS_MSGFOLDERCACHE_CONTRACTID \ + "@mozilla.org/messenger/msgFolderCache;1" + +/* bcdca970-3b22-11d3-8d76-00805f8a6617 */ +#define NS_MSGFOLDERCACHE_CID \ +{ 0xbcdca970, 0x3b22, 0x11d3, \ + { 0x8d, 0x76, 0x00, 0x80, 0xf5, 0x8a, 0x66, 0x17 } } + +// +// nsMessengerBootstrap +// +#define NS_MESSENGERBOOTSTRAP_CONTRACTID \ + "@mozilla.org/appshell/component/messenger;1" +#define NS_MAILOPTIONSTARTUPHANDLER_CONTRACTID \ + "@mozilla.org/commandlinehandler/general-startup;1?type=options" +#define NS_MESSENGERWINDOWSERVICE_CONTRACTID \ + "@mozilla.org/messenger/windowservice;1" +#define NS_MESSENGERWINDOWSERVICE_CID \ +{ 0xa01b6724, 0x1dd1, 0x11b2, \ + {0xaa, 0xb9, 0x82,0xf2, 0x4c,0x59, 0x5f, 0x41} } + +// +// nsMessenger +// +#define NS_MESSENGER_CONTRACTID \ + "@mozilla.org/messenger;1" + +// +// nsMsgStatusFeedback +// +#define NS_MSGSTATUSFEEDBACK_CONTRACTID \ + "@mozilla.org/messenger/statusfeedback;1" + +/* B1AA0820-D04B-11d2-8069-006008128C4E */ +#define NS_MSGSTATUSFEEDBACK_CID \ +{ 0xbd85a417, 0x5433, 0x11d3, \ + {0x8a, 0xc5, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2} } + +// +// nsMsgKeyArray +// +#define NS_MSGKEYARRAY_CONTRACTID \ + "@mozilla.org/messenger/msgkeyarray;1" + +/* 86989d1d-c8a1-4e8e-aae6-d0dabcacd8c2 */ +#define NS_MSGKEYARRAY_CID \ +{ 0x86989d1d, 0xc8a1, 0x4e8e, \ + {0xaa, 0xe6, 0xd0, 0xda, 0xbc, 0xac, 0xd8, 0xc2 }} + +// +//nsMsgWindow +// +#define NS_MSGWINDOW_CONTRACTID \ + "@mozilla.org/messenger/msgwindow;1" + +/* BB460DFF-8BF0-11d3-8AFE-0060B0FC04D2*/ +#define NS_MSGWINDOW_CID \ +{ 0xbb460dff, 0x8bf0, 0x11d3, \ + { 0x8a, 0xfe, 0x0, 0x60, 0xb0, 0xfc, 0x4, 0xd2}} + +// +// Print Engine... +// +#define NS_MSGPRINTENGINE_CONTRACTID \ + "@mozilla.org/messenger/msgPrintEngine;1" + +#define NS_MSG_PRINTENGINE_CID \ + { /* 91FD6B19-E0BC-11d3-8F97-000064657374 */ \ + 0x91fd6b19, 0xe0bc, 0x11d3, \ + { 0x8f, 0x97, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } + +// +// nsMsgServiceProviderService +// +#define NS_MSGSERVICEPROVIDERSERVICE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "ispdefaults" + +/* 10998cef-d7f2-4772-b7db-bd097454984c */ +#define NS_MSGSERVICEPROVIDERSERVICE_CID \ +{ 0x10998cef, 0xd7f2, 0x4772, \ + { 0xb7, 0xdb, 0xbd, 0x09, 0x74, 0x54, 0x98, 0x4c}} + +#define NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID \ + "@mozilla.org/messenger/msglogonredirector;1" + +#define NS_MSGLOGONREDIRECTORSERVICE_CID \ +{0x0d7456ae, 0xe28a, 0x11d3, \ + {0xa5, 0x60, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7}} + +// +// nsSubscribableServer +// +#define NS_SUBSCRIBABLESERVER_CONTRACTID \ + "@mozilla.org/messenger/subscribableserver;1" + +#define NS_SUBSCRIBABLESERVER_CID \ +{0x8510876a, 0x1dd2, 0x11b2, \ + {0x82, 0x53, 0x91, 0xf7, 0x1b, 0x34, 0x8a, 0x25}} + +// +// nsSubscribeDataSource +// +#define NS_SUBSCRIBEDATASOURCE_CONTRACTID \ + NS_RDF_DATASOURCE_CONTRACTID_PREFIX "subscribe" + +/* 00e89c82-1dd2-11b2-9a1c-e75995d7d595 */ +#define NS_SUBSCRIBEDATASOURCE_CID \ +{ 0x00e89c82, 0x1dd2, 0x11b2, \ + { 0x9a, 0x1c, 0xe7, 0x59, 0x95, 0xd7, 0xd5, 0x95}} + +#define NS_MSGLOCALFOLDERCOMPACTOR_CONTRACTID \ + "@mozilla.org/messenger/localfoldercompactor;1" + +/* 7d1d315c-e5c6-11d4-a5b7-0060b0fc04b7 */ +#define NS_MSGLOCALFOLDERCOMPACTOR_CID \ + {0x7d1d315c, 0xe5c6, 0x11d4, \ + {0xa5, 0xb7, 0x00,0x60, 0xb0, 0xfc, 0x04, 0xb7 }} + +#define NS_MSGOFFLINESTORECOMPACTOR_CONTRACTID \ + "@mozilla.org/messenger/offlinestorecompactor;1" + +/* 2db43d16-e5c8-11d4-a5b7-0060b0fc04b7 */ +#define NS_MSG_OFFLINESTORECOMPACTOR_CID \ + {0x2db43d16, 0xe5c8, 0x11d4, \ + {0xa5, 0xb7, 0x00,0x60, 0xb0, 0xfc, 0x04, 0xb7 }} + +// +// nsMsgDBView +// +#define NS_MSGDBVIEW_CONTRACTID_PREFIX \ + "@mozilla.org/messenger/msgdbview;1?type=" + +#define NS_MSGTHREADEDDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "threaded" + +#define NS_MSGTHREADSWITHUNREADDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "threadswithunread" + +#define NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "watchedthreadswithunread" + +#define NS_MSGSEARCHDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "search" + +#define NS_MSGQUICKSEARCHDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "quicksearch" + +#define NS_MSGXFVFDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "xfvf" + +#define NS_MSGGROUPDBVIEW_CONTRACTID \ + NS_MSGDBVIEW_CONTRACTID_PREFIX "group" + +/* 52f860e0-1dd2-11b2-aa72-bb751981bd00 */ +#define NS_MSGTHREADEDDBVIEW_CID \ + {0x52f860e0, 0x1dd2, 0x11b2, \ + {0xaa, 0x72, 0xbb, 0x75, 0x19, 0x81, 0xbd, 0x00 }} + +/* ca79a00e-010d-11d5-a5be-0060b0fc04b7 */ +#define NS_MSGTHREADSWITHUNREADDBVIEW_CID \ + {0xca79a00e, 0x010d, 0x11d5, \ + {0xa5, 0xbe, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }} + +/* 597e1ffe-0123-11d5-a5be-0060b0fc04b7 */ +#define NS_MSGWATCHEDTHREADSWITHUNREADDBVIEW_CID \ + {0x597e1ffe, 0x0123, 0x11d5, \ + {0xa5, 0xbe, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }} + +/* aeac118c-0823-11d5-a5bf-0060b0fc04b7 */ +#define NS_MSGSEARCHDBVIEW_CID \ + {0xaeac118c, 0x0823, 0x11d5, \ + {0xa5, 0xbf, 0x00, 0x60, 0xb0, 0xfc, 0x04, 0xb7}} + +/* 2dd9d0fe-b609-11d6-bacc-00108335748d */ +#define NS_MSGQUICKSEARCHDBVIEW_CID \ + {0x2dd9d0fe, 0xb609, 0x11d6, \ + {0xba, 0xcc, 0x00, 0x10, 0x83, 0x35, 0x74, 0x8d}} + +/* 2af6e050-04f6-495a-8387-86b0aeb1863c */ +#define NS_MSG_XFVFDBVIEW_CID \ + {0x2af6e050, 0x04f6, 0x495a, \ + {0x83, 0x87, 0x86, 0xb0, 0xae, 0xb1, 0x86, 0x3c}} + +/* e4603d6c-0a74-47c5-b69e-2f8876990304 */ +#define NS_MSG_GROUPDBVIEW_CID \ + {0xe4603d6c, 0x0a74, 0x47c5, \ + {0xb6, 0x9e, 0x2f, 0x88, 0x76, 0x99, 0x03, 0x04}} +// +// nsMsgAccountManager +// +#define NS_MSGOFFLINEMANAGER_CONTRACTID \ + "@mozilla.org/messenger/offline-manager;1" + +#define NS_MSGOFFLINEMANAGER_CID \ +{ /* ac6c518a-09b2-11d5-a5bf-0060b0fc04b7 */ \ + 0xac6c518a, 0x09b2, 0x11d5, \ + {0xa5, 0xbf, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 }} + + +// +// nsMsgProgress +// +#define NS_MSGPROGRESS_CONTRACTID \ + "@mozilla.org/messenger/progress;1" + +#define NS_MSGPROGRESS_CID \ +{ /* 9f4dd201-3b1f-11d5-9daa-c345c9453d3c */ \ + 0x9f4dd201, 0x3b1f, 0x11d5, \ + {0x9d, 0xaa, 0xc3, 0x45, 0xc9, 0x45, 0x3d, 0x3c }} + +// +// nsSpamSettings +// +#define NS_SPAMSETTINGS_CONTRACTID \ + "@mozilla.org/messenger/spamsettings;1" + +#define NS_SPAMSETTINGS_CID \ +{ /* ce6038ae-e5e0-4372-9cff-2a6633333b2b */ \ + 0xce6038ae, 0xe5e0, 0x4372, \ + {0x9c, 0xff, 0x2a, 0x66, 0x33, 0x33, 0x3b, 0x2b }} + +// +// nsMsgTagService +// +#define NS_MSGTAGSERVICE_CONTRACTID \ + "@mozilla.org/messenger/tagservice;1" + +#define NS_MSGTAGSERVICE_CID \ +{ /* b897da55-8256-4cf5-892b-32e77bc7c50b */ \ + 0xb897da55, 0x8256, 0x4cf5, \ + { 0x89, 0x2b, 0x32, 0xe7, 0x7b, 0xc7, 0xc5, 0x0b}} + +// +// nsMsgNotificationService +// +#define NS_MSGNOTIFICATIONSERVICE_CONTRACTID \ +"@mozilla.org/messenger/msgnotificationservice;1" + +#define NS_MSGNOTIFICATIONSERVICE_CID \ +{ /* F1F7CBCD-D5E3-45A0-AA2D-CECF1A95AB03 */ \ + 0xf1f7cbcd, 0xd5e3, 0x45a0, \ + {0xaa, 0x2d, 0xce, 0xcf, 0x1a, 0x95, 0xab, 0x03}} + +// +// nsMessengerOSIntegration +// +#define NS_MESSENGEROSINTEGRATION_CONTRACTID \ + "@mozilla.org/messenger/osintegration;1" + +// +// cid protocol handler +// +#define NS_CIDPROTOCOLHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "cid" + +#define NS_CIDPROTOCOL_CID \ +{ /* b3db9392-1b15-48ba-a136-0cc3db13d87b */ \ + 0xb3db9392, 0x1b15, 0x48ba, \ + {0xa1, 0x36, 0x0c, 0xc3, 0xdb, 0x13, 0xd8, 0x7b }} + +// +// Mail Directory Provider +// +#define NS_MAILDIRPROVIDER_CONTRACTID \ + "@mozilla.org/mail/dir-provider;1" + +#define MAILDIRPROVIDER_CID \ +{ 0x3f9bb53, 0xa680, 0x4349, \ + { 0x8d, 0xe9, 0xd2, 0x68, 0x64, 0xd9, 0xff, 0xd9 } } + +// +// nsMessengerContentHandler +// +#define NS_MESSENGERCONTENTHANDLER_CID \ +{ /* 57E1BCBB-1FBA-47e7-B96B-F59E392473B0 */ \ + 0x57e1bcbb, 0x1fba, 0x47e7, \ + {0xb9, 0x6b, 0xf5, 0x9e, 0x39, 0x24, 0x73, 0xb0}} + +#define NS_MESSENGERCONTENTHANDLER_CONTRACTID \ + NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-message-display" + +// +// nsMsgShutdownService +// +#define NS_MSGSHUTDOWNSERVICE_CID \ +{ /* 483c8abb-ecf9-48a3-a394-2c604b603bd5 */ \ + 0x483c8abb, 0xecf9, 0x48a3, \ + { 0xa3, 0x94, 0x2c, 0x60, 0x4b, 0x60, 0x3b, 0xd5 }} + +#define NS_MSGSHUTDOWNSERVICE_CONTRACTID \ + "@mozilla.org/messenger/msgshutdownservice;1" + +// +// msgAsyncPrompter (only contract id for utility purposes as the CID is defined +// in js). +// +#define NS_MSGASYNCPROMPTER_CONTRACTID \ + "@mozilla.org/messenger/msgAsyncPrompter;1" + +// +// MailNewsDLF +// +#define NS_MAILNEWSDLF_CID \ +{ /* DE0F34A9-A87F-4F4C-B978-6187DB187B90 */ \ + 0xde0f34a9, 0xa87f, 0x4f4c, \ + { 0xb9, 0x78, 0x61, 0x87, 0xdb, 0x18, 0x7b, 0x90 }} + +#define NS_MAILNEWSDLF_CONTRACTID \ + "@mozilla.org/mailnews/document-loader-factory;1" + +// +// NewMailNotificationService +// +#define MOZ_NEWMAILNOTIFICATIONSERVICE_CID \ +{ /* 740880E6-E299-4165-B82F-DF1DCAB3AE22 */ \ + 0x740880E6, 0xE299, 0x4165, \ + { 0xB8, 0x2F, 0xDF, 0x1D, 0xCA, 0xB3, 0xAE, 0x22 }} + +#define MOZ_NEWMAILNOTIFICATIONSERVICE_CONTRACTID \ + "@mozilla.org/newMailNotificationService;1" + +#endif // nsMessageBaseCID_h__ diff --git a/mailnews/base/public/nsMsgFolderFlags.idl b/mailnews/base/public/nsMsgFolderFlags.idl new file mode 100644 index 000000000..ba7e0a776 --- /dev/null +++ b/mailnews/base/public/nsMsgFolderFlags.idl @@ -0,0 +1,115 @@ +/*-*- 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/. */ + +// 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 { + /** + * @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/mailnews/base/public/nsMsgGroupnameFlags.h b/mailnews/base/public/nsMsgGroupnameFlags.h new file mode 100644 index 000000000..59061e2ca --- /dev/null +++ b/mailnews/base/public/nsMsgGroupnameFlags.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#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. */ + +#define MSG_GROUPNAME_FLAG_ELIDED 0x0010 /* 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_MODERATED 0x0020 /* Whether this folder + represents a moderated + newsgroup. */ +#define MSG_GROUPNAME_FLAG_SUBSCRIBED 0x0040 /* Whether this folder + represents a subscribed + newsgroup. */ +#define MSG_GROUPNAME_FLAG_NEW_GROUP 0x0080 /* A newsgroup which has just + been added by the `Check + New Groups' command. */ +#define MSG_GROUPNAME_FLAG_HASCHILDREN 0x40000 /* Whether there are children + of this group. Whether those + chilren 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_IMAP_PERSONAL 0x80000 /* folder is an IMAP personal folder */ + +#define MSG_GROUPNAME_FLAG_IMAP_PUBLIC 0x100000 /* folder is an IMAP public folder */ + +#define MSG_GROUPNAME_FLAG_IMAP_OTHER_USER 0x200000 /* folder is another user's IMAP folder */ + +#define MSG_GROUPNAME_FLAG_IMAP_NOSELECT 0x400000 /* A \NoSelect IMAP folder */ + +#define MSG_GROUPNAME_FLAG_PERSONAL_SHARED 0x800000 /* whether or not this folder is one of your personal folders that + ` is shared with other users */ + +#endif diff --git a/mailnews/base/public/nsMsgHeaderMasks.h b/mailnews/base/public/nsMsgHeaderMasks.h new file mode 100644 index 000000000..5ffeb3a53 --- /dev/null +++ b/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_ + +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 + + +#endif diff --git a/mailnews/base/public/nsMsgLocalFolderHdrs.h b/mailnews/base/public/nsMsgLocalFolderHdrs.h new file mode 100644 index 000000000..e34c7fc70 --- /dev/null +++ b/mailnews/base/public/nsMsgLocalFolderHdrs.h @@ -0,0 +1,39 @@ +/* -*- 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 + +/* 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 ": %04.4x" +#define X_MOZILLA_STATUS_LEN /*1234567890123456*/ 16 + +#define X_MOZILLA_STATUS2 "X-Mozilla-Status2" +#define X_MOZILLA_STATUS2_FORMAT X_MOZILLA_STATUS2 ": %08.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') + +/* blank filled header to store keyword/tags in the mailbox */ +#define X_MOZILLA_KEYWORDS "X-Mozilla-Keys" ": " MSG_LINEBREAK +#define X_MOZILLA_KEYWORDS_LEN (sizeof(X_MOZILLA_KEYWORDS) - 1) + +#endif diff --git a/mailnews/base/public/nsMsgMessageFlags.idl b/mailnews/base/public/nsMsgMessageFlags.idl new file mode 100644 index 000000000..4139e47f9 --- /dev/null +++ b/mailnews/base/public/nsMsgMessageFlags.idl @@ -0,0 +1,173 @@ +/* -*- 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/. */ + +typedef unsigned long nsMsgMessageFlagType; + +/// Flags about a single message. +[scriptable,uuid(1ea3acdb-7b9f-4e35-9513-76e0a0cc6baa)] +interface nsMsgMessageFlags +{ + /// 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 othe + * 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; + + /** + * 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; + + /// This message has files attached to it + const nsMsgMessageFlagType Attachment = 0x10000000; + + /** + * 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 +{ + /// 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; +}; |