gecko-dev/mailnews/base/public/nsIMsgAccountManager.idl
putterman%netscape.com 46acd7660f Fix for 17712. Reviewed by bienvenu and alecf. Mailnews shuts down accounts, biff,
and folders properly as an xpcom shutdown observer.
1999-11-14 20:36:22 +00:00

141 lines
4.4 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsISupports.idl"
#include "nsIMsgAccount.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgIncomingServer.idl"
#include "nsISupportsArray.idl"
#include "nsIIncomingServerListener.idl"
interface nsIMsgFolderCache;
[scriptable, uuid(6ed2cc00-e623-11d2-b7fc-00805f05ffa5)]
interface nsIMsgAccountManager : nsISupports {
nsIMsgAccount createAccount();
nsIMsgAccount getAccount(in string key);
void RemoveAccount(in nsIMsgAccount account);
/*
* 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 ProgID
*/
nsIMsgIncomingServer createIncomingServer(in string type);
/*
* get the identity with the given key
* if the identity does not exist, it will be created
*/
nsIMsgIdentity getIdentity(in string 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 string key);
/* account list stuff */
/* defaultAccount should always be set if there are any accounts
* in the account manager. 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
* array of nsIMsgAccount
*/
readonly attribute nsISupportsArray accounts;
/* list of all identities in all accounts
* array of nsIMsgIdentity
*/
readonly attribute nsISupportsArray allIdentities;
/* list of all servers in all accounts
* array of nsIMsgIncomingServer
*/
readonly attribute nsISupportsArray allServers;
/* summary of summary files folder cache */
readonly attribute nsIMsgFolderCache folderCache;
/*
* 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 string userName, in string hostname, in string type);
/**
* find the index of this server in the (ordered) list of accounts
*/
long FindServerIndex(in nsIMsgIncomingServer server);
nsIMsgAccount
FindAccountForServer(in nsIMsgIncomingServer server);
/* given a server, return all identities in accounts that have this server
* returns an array of nsIMsgIdentity
*/
nsISupportsArray GetIdentitiesForServer(in nsIMsgIncomingServer server);
/* given an identity, return all servers in accounts that have
* this identity
* returns an array of nsIMsgIncomingServer
*/
nsISupportsArray GetServersForIdentity(in nsIMsgIdentity identity);
/* 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();
/* unload accounts frees all the account manager data structures */
void UnloadAccounts();
void WriteToFolderCache(in nsIMsgFolderCache folderCache);
void CloseCachedConnections();
/* search for 4.x mailnews prefs, and migrate to 5.0 prefs */
void UpgradePrefs();
void AddIncomingServerListener(in nsIIncomingServerListener serverListener);
void RemoveIncomingServerListener(in nsIIncomingServerListener serverListener);
void NotifyServerLoaded(in nsIMsgIncomingServer server);
void NotifyServerUnloaded(in nsIMsgIncomingServer server);
void createLocalMailAccount(in nsIMsgIdentity identity);
};