Revision control
Copy as Markdown
Other Tools
/* -*- 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
#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 {
AUTF8String getUniqueAccountKey();
nsIMsgAccount createAccount();
/*
* Return the account with the provided key, or null if none found.
*/
nsIMsgAccount getAccount(in AUTF8String key);
/**
* Removes the account from the list of accounts.
*
* @param aAccount the account to remove
* @param aRemoveFiles remove data directory (local directory) of this account
*/
void removeAccount(in nsIMsgAccount aAccount, [optional] in boolean aRemoveFiles);
/*
* creates a new identity and assigns it a new, unique "key"
*/
nsIMsgIdentity createIdentity();
/**
* Scan the preferences to find a unique server key.
*/
AUTF8String getUniqueServerKey();
/*
* creates a new server and assigns it a new, unique "key"
* the given type will be used to construct a ContractID
*
* @param type "imap", "pop3", "nntp", "none", "rss", "generic"
* (suffix of contract ID @mozilla.org/messenger/server;1?type= )
*/
nsIMsgIncomingServer createIncomingServer(in AUTF8String username,
in AUTF8String hostname,
in AUTF8String 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 AUTF8String 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 AUTF8String key);
/* account list stuff */
/**
* Returns the account that was marked as the default one.
* Only some server types can serve as default account.
* If there is no such account, null is returned.
* You can only set the defaultAccount to an
* account already in the account manager.
*/
attribute nsIMsgAccount defaultAccount;
/**
* Ordered list of all accounts, by the order they are in the prefs.
* Accounts with hidden servers are not returned.
* array of nsIMsgAccount
*/
readonly attribute Array<nsIMsgAccount> accounts;
/* list of all identities in all accounts
* array of nsIMsgIdentity
*/
readonly attribute Array<nsIMsgIdentity> allIdentities;
/* list of all servers in all accounts, except for hidden and IM servers
* array of nsIMsgIncomingServer
*/
readonly attribute Array<nsIMsgIncomingServer> allServers;
/* summary of summary files folder cache */
readonly attribute nsIMsgFolderCache folderCache;
/* are we shutting down */
readonly attribute boolean shutdownInProgress;
/**
* for preventing unauthenticated users from seeing header information
*/
attribute boolean userNeedsToAuthenticate;
/*
* search for the server with the given username, hostname, and type
* the type is the same as is specified in the preferences,
* i.e. "imap", "pop3", "none", or "nntp"
*/
nsIMsgIncomingServer findServer(in AUTF8String userName,
in AUTF8String hostname,
in AUTF8String type,
[optional] in long port);
/*
* search for the server with the given uri
* an analog to FindServer()
*/
nsIMsgIncomingServer findServerByURI(in nsIURI aURI);
/**
* find the index of this server in the (ordered) list of accounts
*/
long findServerIndex(in nsIMsgIncomingServer server);
/**
* Finds an account for the given incoming server.
*
* @param server An incoming server to find the account for.
* @return If found, the nsIMsgAccount representing the account found.
* Otherwise returns null.
*/
nsIMsgAccount findAccountForServer(in nsIMsgIncomingServer server);
/* given a server, return all identities in accounts that have this server
* returns an array of nsIMsgIdentity
*/
Array<nsIMsgIdentity> getIdentitiesForServer(in nsIMsgIncomingServer server);
/**
* given a server, return the first identity in accounts that have this server
*/
nsIMsgIdentity getFirstIdentityForServer(in nsIMsgIncomingServer server);
/* given an identity, return all servers in accounts that have
* this identity
* returns an array of nsIMsgIncomingServer
*/
Array<nsIMsgIncomingServer> getServersForIdentity(in nsIMsgIdentity identity);
/* there is a special server "Local Folders" that is guaranteed to exist.
* this will allow you to get */
attribute nsIMsgIncomingServer localFoldersServer;
// Create the account for that special server.
nsIMsgAccount createLocalMailAccount();
/**
* Kicks off the creation of all accounts. You do not need to call this and
* all accounts should be loaded lazily if you use any of the above.
*/
void loadAccounts();
/** Frees all the account manager data structures. */
void unloadAccounts();
/**
* When the server for an account could not be loaded, typically because the
* extension providing it could not be loaded, it is deactivated for a period
* of time as documented in nsIMsgAccount.idl. The server is normally only
* rechecked at startup but this function can be used to recheck all servers
* at any time to avoid having to restart to reactivate an account.
*/
void reactivateAccounts();
void setSpecialFolders();
void loadVirtualFolders();
void writeToFolderCache(in nsIMsgFolderCache folderCache);
void saveVirtualFolders();
void closeCachedConnections();
void shutdownServers();
void cleanupOnExit();
void setFolderDoingEmptyTrash(in nsIMsgFolder folder);
boolean getEmptyTrashInProgress();
void setFolderDoingCleanupInbox(in nsIMsgFolder folder);
boolean getCleanupInboxInProgress();
void addRootFolderListener(in nsIFolderListener listener);
void removeRootFolderListener(in nsIFolderListener listener);
// these are going away in favor of add/removeRootFolderListener
void addIncomingServerListener(in nsIIncomingServerListener serverListener);
void removeIncomingServerListener(in nsIIncomingServerListener serverListener);
void notifyServerLoaded(in nsIMsgIncomingServer server);
void notifyServerUnloaded(in nsIMsgIncomingServer server);
void notifyServerChanged(in nsIMsgIncomingServer server);
// force account info out to prefs file
void saveAccountInfo();
AUTF8String getChromePackageName(in AUTF8String aExtensionName);
/// Enumerate all incoming servers and their folders and return in an array.
readonly attribute Array<nsIMsgFolder> allFolders;
// Used to sort servers (accounts) for e.g. the folder pane
long getSortOrder(in nsIMsgIncomingServer server);
/**
* Sets new order of accounts.
*
* @param accountKeys - Account keys in the new preferred order.
*/
void reorderAccounts(in Array<AUTF8String> accountKeys);
};
%{C++
#define MAILNEWS_ACCOUNTMANAGER_EXTENSIONS "mailnews-accountmanager-extensions"
%}
[scriptable, uuid(70032DE0-CD59-41ba-839D-FC1B65367EE7)]
interface nsIMsgAccountManagerExtension : nsISupports
{
readonly attribute AUTF8String name; // examples: mdn
boolean showPanel(in nsIMsgIncomingServer server);
readonly attribute AUTF8String chromePackageName; // example: messenger, chrome://messenger/content/am-mdn.xhtml and chrome://messenger/locale/am-mdn.properties
};