Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgAccountManager.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Seth Spitzer <sspitzer@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 #include "nsIMsgAccount.idl"
00041 #include "nsIMsgIdentity.idl"
00042 #include "nsIMsgIncomingServer.idl"
00043 #include "nsISupportsArray.idl"
00044 #include "nsIIncomingServerListener.idl"
00045 #include "nsIMsgFolder.idl"
00046 
00047 interface nsIMsgFolderCache;
00048 interface nsIFolderListener;
00049 
00050 [scriptable, uuid(0dc74b96-c2fc-4ce0-baed-c6f03c69026e)]
00051 interface nsIMsgAccountManager : nsISupports {
00052 
00053   nsIMsgAccount createAccount();
00054   /*
00055    * Return the account with the provided key, or null if none found.
00056    */
00057   nsIMsgAccount getAccount(in string key);
00058     
00059   void removeAccount(in nsIMsgAccount account);
00060   void removeIdentity(in nsIMsgIdentity identity);
00061   void duplicateAccount(in nsIMsgAccount account);
00062   
00063   /*
00064    * creates a new identity and assigns it a new, unique "key"
00065    */
00066   nsIMsgIdentity createIdentity();
00067 
00068   /*
00069    * creates a new server and assigns it a new, unique "key"
00070    * the given type will be used to construct a ContractID
00071    */
00072   nsIMsgIncomingServer createIncomingServer(in string username,
00073                                             in string hostname,
00074                                             in string type);
00075   
00076   /*
00077    * get the identity with the given key
00078    * if the identity does not exist, it will be created
00079    */
00080   nsIMsgIdentity getIdentity(in string key);
00081 
00082   /*
00083    * Gets the existing incoming server with the given key
00084    * if the server's type does not exist in the preference,
00085    * an error is returned/thrown
00086    */
00087   nsIMsgIncomingServer getIncomingServer(in string key);
00088 
00089   /* account list stuff */
00090 
00091   /* defaultAccount should always be set if there are any accounts
00092    * in the account manager. You can only set the defaultAccount to an
00093    * account already in the account manager */
00094   attribute nsIMsgAccount defaultAccount;
00095 
00100   readonly attribute nsISupportsArray accounts;
00101 
00102   /* list of all identities in all accounts
00103    * array of nsIMsgIdentity
00104    */
00105   readonly attribute nsISupportsArray allIdentities;
00106 
00107   /* list of all servers in all accounts
00108    * array of nsIMsgIncomingServer
00109    */
00110   readonly attribute nsISupportsArray allServers;
00111 
00112   /* summary of summary files folder cache */
00113   readonly attribute nsIMsgFolderCache folderCache;
00114 
00115   /* are we shutting down */
00116   readonly attribute boolean shutdownInProgress;
00117 
00121   attribute boolean userNeedsToAuthenticate;
00122   /*
00123    * search for the server with the given username, hostname, and type
00124    * the type is the same as is specified in the preferences,
00125    * i.e. "imap", "pop3", "none", or "nntp"
00126    */
00127   nsIMsgIncomingServer
00128       FindServer(in string userName, in string hostname, in string type);
00129 
00130   /*
00131    * search for the server with the given uri
00132    * an analog to FindServer()
00133    * The boolean flag selects whether we compare input against the    
00134    * 'realhostname' and 'realuserName' pref settings.
00135    */
00136   nsIMsgIncomingServer
00137       findServerByURI(in nsIURI aURI, in boolean aRealFlag);
00138 
00139   /*
00140    * Same as FindServer() except it compares the input values against
00141    * 'realhostname' and 'realuserName' pref settings.
00142    */
00143   nsIMsgIncomingServer
00144       findRealServer(in string userName, in string hostname, in string type, in long port );
00145 
00149   long FindServerIndex(in nsIMsgIncomingServer server);
00150 
00151   nsIMsgAccount
00152       FindAccountForServer(in nsIMsgIncomingServer server);
00153 
00154   /* given a server, return all identities in accounts that have this server
00155    * returns an array of nsIMsgIdentity
00156    */
00157   nsISupportsArray GetIdentitiesForServer(in nsIMsgIncomingServer server);
00158 
00162   nsIMsgIdentity getFirstIdentityForServer(in nsIMsgIncomingServer server);
00163 
00164   /* given an identity, return all servers in accounts that have
00165    * this identity
00166    * returns an array of nsIMsgIncomingServer
00167    */
00168   nsISupportsArray GetServersForIdentity(in nsIMsgIdentity identity);
00169 
00170   /* there is a special server "Local Folders" that is guaranteed to exist.
00171    * this will allow you to get */
00172   attribute nsIMsgIncomingServer localFoldersServer;
00173 
00174   /* load accounts kicks off the creation of all accounts. You do not need
00175    * to call this and all accounts should be loaded lazily if you use any
00176    * of the above.
00177    */
00178   void LoadAccounts();
00179 
00180   void setSpecialFolders();
00181 
00182   void loadVirtualFolders();
00183 
00184   /* unload accounts frees all the account manager data structures */
00185   void UnloadAccounts();
00186 
00187   void WriteToFolderCache(in nsIMsgFolderCache folderCache);
00188   void saveVirtualFolders();
00189   void closeCachedConnections();
00190   void shutdownServers();
00191 
00192   void CleanupOnExit();
00193   void SetFolderDoingEmptyTrash(in nsIMsgFolder folder);
00194   boolean GetEmptyTrashInProgress();
00195 
00196   void SetFolderDoingCleanupInbox(in nsIMsgFolder folder);
00197   boolean GetCleanupInboxInProgress();
00198 
00199   void addRootFolderListener(in nsIFolderListener listener);
00200   void removeRootFolderListener(in nsIFolderListener listener);
00201 
00202   // these are going away in favor of add/removeRootFolderListener
00203   void addIncomingServerListener(in nsIIncomingServerListener serverListener);
00204   void removeIncomingServerListener(in nsIIncomingServerListener serverListener);
00205 
00206   // these are going away in favor of nsIMsgFolder::NotifyEvent(in nsIAtom event);
00207   void notifyServerLoaded(in nsIMsgIncomingServer server);
00208   void notifyServerUnloaded(in nsIMsgIncomingServer server);
00209   void notifyServerChanged(in nsIMsgIncomingServer server);
00210 
00211   // force account info out to prefs file
00212   void saveAccountInfo();
00213 
00214   string getChromePackageName(in string aExtensionName);
00215 };
00216 
00217 
00218 %{C++
00219 #define MAILNEWS_ACCOUNTMANAGER_EXTENSIONS "mailnews-accountmanager-extensions"
00220 %}
00221 
00222 
00223 [scriptable, uuid(9ce9fc76-1dd1-11b2-8da2-bf6b98b4c537)]
00224 interface nsIMsgAccountManagerExtension : nsISupports
00225 {
00226     readonly attribute string name;   // examples:  mdn
00227     boolean showPanel(in nsIMsgIncomingServer server);
00228     readonly attribute string chromePackageName;  // example:  messenger, chrome://messenger/content/am-mdn.xul and chrome://messenger/locale/am-mdn.properties
00229 };
00230