Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Events | Private Member Functions | Static Private Member Functions | Private Attributes
nsMsgAccountManager Class Reference

#include <nsMsgAccountManager.h>

Inheritance diagram for nsMsgAccountManager:
Inheritance graph
[legend]
Collaboration diagram for nsMsgAccountManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsMsgAccountManager ()
virtual ~nsMsgAccountManager ()
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGACCOUNTMANAGER
NS_DECL_NSIOBSERVER
NS_DECL_NSIURLLISTENER
NS_DECL_NSIFOLDERLISTENER
nsresult 
Init ()
nsresult Shutdown ()
nsIMsgAccount createAccount ()
nsIMsgAccount getAccount (in string key)
void removeAccount (in nsIMsgAccount account)
void removeIdentity (in nsIMsgIdentity identity)
void duplicateAccount (in nsIMsgAccount account)
nsIMsgIdentity createIdentity ()
nsIMsgIncomingServer createIncomingServer (in string username, in string hostname, in string type)
nsIMsgIdentity getIdentity (in string key)
nsIMsgIncomingServer getIncomingServer (in string key)
nsIMsgIncomingServer FindServer (in string userName, in string hostname, in string type)
nsIMsgIncomingServer findServerByURI (in nsIURI aURI, in boolean aRealFlag)
nsIMsgIncomingServer findRealServer (in string userName, in string hostname, in string type, in long port)
long FindServerIndex (in nsIMsgIncomingServer server)
 find the index of this server in the (ordered) list of accounts
nsIMsgAccount FindAccountForServer (in nsIMsgIncomingServer server)
nsISupportsArray GetIdentitiesForServer (in nsIMsgIncomingServer server)
nsIMsgIdentity getFirstIdentityForServer (in nsIMsgIncomingServer server)
 given a server, return the first identity in accounts that have this server
nsISupportsArray GetServersForIdentity (in nsIMsgIdentity identity)
void LoadAccounts ()
void setSpecialFolders ()
void loadVirtualFolders ()
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)
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)
void saveAccountInfo ()
string getChromePackageName (in string aExtensionName)
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.
void OnStartRunningUrl (in nsIURI url)
void OnStopRunningUrl (in nsIURI url, in nsresult aExitCode)
void OnItemAdded (in nsIRDFResource parentItem, in nsISupports item)
void OnItemRemoved (in nsIRDFResource parentItem, in nsISupports item)
void OnItemPropertyChanged (in nsIRDFResource item, in nsIAtom property, in string oldValue, in string newValue)
void OnItemIntPropertyChanged (in nsIRDFResource item, in nsIAtom property, in long oldValue, in long newValue)
void OnItemBoolPropertyChanged (in nsIRDFResource item, in nsIAtom property, in boolean oldValue, in boolean newValue)
void OnItemUnicharPropertyChanged (in nsIRDFResource item, in nsIAtom property, in wstring oldValue, in wstring newValue)
void OnItemPropertyFlagChanged (in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldFlag, in unsigned long newFlag)
void OnItemEvent (in nsIMsgFolder item, in nsIAtom event)

Public Attributes

attribute nsIMsgAccount defaultAccount
readonly attribute nsISupportsArray accounts
 ordered list of all accounts, by the order they are in the prefs array of nsIMsgAccount
readonly attribute nsISupportsArray allIdentities
readonly attribute nsISupportsArray allServers
readonly attribute
nsIMsgFolderCache 
folderCache
readonly attribute boolean shutdownInProgress
attribute boolean userNeedsToAuthenticate
 for preventing unauthenticated users from seeing header information
attribute nsIMsgIncomingServer localFoldersServer
const folderListenerNotifyFlagValue added = 0x1
const folderListenerNotifyFlagValue removed = 0x2
const folderListenerNotifyFlagValue propertyChanged = 0x4
const folderListenerNotifyFlagValue intPropertyChanged = 0x8
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40

Events

const
folderListenerNotifyFlagValue=0 
x80
const folderListenerNotifyFlagValue all = 0xFFFFFFFF

Private Member Functions

nsresult SetLastServerFound (nsIMsgIncomingServer *server, const char *hostname, const char *username, const PRInt32 port, const char *type)
nsresult createKeyedAccount (const char *key, nsIMsgAccount **_retval)
nsresult createKeyedServer (const char *key, const char *username, const char *password, const char *type, nsIMsgIncomingServer **_retval)
nsresult createKeyedIdentity (const char *key, nsIMsgIdentity **_retval)
nsresult removeKeyedAccount (const char *key)
nsresult setDefaultAccountPref (nsIMsgAccount *aDefaultAccount)
nsresult notifyDefaultServerChange (nsIMsgAccount *aOldAccount, nsIMsgAccount *aNewAccount)
nsresult GetVirtualFoldersFile (nsCOMPtr< nsILocalFile > &file)
nsresult WriteLineToOutputStream (const char *prefix, const char *line, nsIOutputStream *outputStream)
nsresult AddVFListenersForVF (nsIMsgFolder *virtualFolder, const char *srchFolderUris, nsIRDFService *rdf, nsIMsgDBService *msgDBService)
nsresult SetSendLaterUriPref (nsIMsgIncomingServer *server)
nsresult getPrefService ()
nsresult InternalFindServer (const char *username, const char *hostname, const char *type, PRBool useRealSetting, nsIMsgIncomingServer **aResult)

Static Private Member Functions

static void LogoutOfServer (nsIMsgIncomingServer *aServer)
static PRBool hashElementToArray (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK hashElementRelease (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK hashUnloadServer (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK hashLogoutOfServer (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK cleanupOnExit (nsHashKey *aKey, void *aData, void *closure)
static PRBool getAccountList (nsISupports *aKey, void *aData)
static PRBool findIdentitiesForServer (nsISupports *element, void *aData)
static PRBool findServersForIdentity (nsISupports *element, void *aData)
static PRBool findServerIndexByServer (nsISupports *element, void *aData)
static PRBool findAccountByKey (nsISupports *element, void *aData)
static PRBool findAccountByServerKey (nsISupports *element, void *aData)
static PRBool getIdentitiesToArray (nsISupports *element, void *aData)
static PRBool addIdentityIfUnique (nsISupports *element, void *aData)
static PRBool PR_CALLBACK getServersToArray (nsHashKey *aKey, void *element, void *aData)
static PRBool findServer (nsISupports *aElement, void *data)
static PRBool findServerUrl (nsISupports *aElement, void *data)
static PRBool PR_CALLBACK writeFolderCache (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK shutdown (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK closeCachedConnections (nsHashKey *aKey, void *aData, void *closure)
static void getUniqueKey (const char *prefix, nsHashtable *hashTable, nsCString &aResult)
static void getUniqueAccountKey (const char *prefix, nsISupportsArray *accounts, nsCString &aResult)
static PRBool PR_CALLBACK addListener (nsHashKey *aKey, void *element, void *aData)
static PRBool PR_CALLBACK removeListener (nsHashKey *aKey, void *element, void *aData)
static PRBool addListenerToFolder (nsISupports *element, void *data)
static PRBool removeListenerFromFolder (nsISupports *element, void *data)

Private Attributes

PRBool m_accountsLoaded
nsCOMPtr< nsIMsgFolderCachem_msgFolderCache
nsCOMPtr< nsIAtomkDefaultServerAtom
nsCOMPtr< nsISupportsArraym_accounts
nsHashtable m_identities
nsHashtable m_incomingServers
nsCOMPtr< nsIMsgAccountm_defaultAccount
nsCOMArray
< nsIIncomingServerListener
m_incomingServerListeners
nsCOMArray< nsIDBChangeListenerm_virtualFolderListeners
nsCOMPtr< nsIMsgFolderm_folderDoingEmptyTrash
nsCOMPtr< nsIMsgFolderm_folderDoingCleanupInbox
PRBool m_emptyTrashInProgress
PRBool m_cleanupInboxInProgress
nsCString mAccountKeyList
PRBool m_haveShutdown
PRBool m_shutdownInProgress
PRBool m_userAuthenticated
PRBool m_loadingVirtualFolders
PRBool m_virtualFoldersLoaded
nsCOMPtr< nsIMsgIncomingServerm_lastFindServerResult
nsCString m_lastFindServerHostName
nsCString m_lastFindServerUserName
PRInt32 m_lastFindServerPort
nsCString m_lastFindServerType
nsCOMPtr< nsIPrefBranchm_prefs
nsCOMPtr< nsISupportsArraymFolderListeners

Detailed Description

Definition at line 61 of file nsMsgAccountManager.h.


Constructor & Destructor Documentation

Definition at line 170 of file nsMsgAccountManager.cpp.

{
  nsresult rv;

  if(!m_haveShutdown)
  {
    Shutdown();
    //Don't remove from Observer service in Shutdown because Shutdown also gets called
    //from xpcom shutdown observer.  And we don't want to remove from the service in that case.
    nsCOMPtr<nsIObserverService> observerService = 
         do_GetService("@mozilla.org/observer-service;1", &rv);
    if (NS_SUCCEEDED(rv))
    {    
      observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
      observerService->RemoveObserver(this, ABOUT_TO_GO_OFFLINE_TOPIC);
    }
  }
}

Here is the call graph for this function:


Member Function Documentation

PRBool nsMsgAccountManager::addIdentityIfUnique ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 1237 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgIdentity> identity = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) {
    printf("addIdentityIfUnique problem\n");
    return PR_TRUE;
  }
  
  nsISupportsArray *array = (nsISupportsArray*)aData;

  
  nsXPIDLCString key;
  rv = identity->GetKey(getter_Copies(key));
  if (NS_FAILED(rv)) return PR_TRUE;

  PRUint32 count=0;
  rv = array->Count(&count);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  PRBool found=PR_FALSE;
  PRUint32 i;
  for (i=0; i<count; i++) {
    nsCOMPtr<nsISupports> thisElement;
    array->GetElementAt(i, getter_AddRefs(thisElement));

    nsCOMPtr<nsIMsgIdentity> thisIdentity =
      do_QueryInterface(thisElement, &rv);
    if (NS_FAILED(rv)) continue;

    nsXPIDLCString thisKey;
    thisIdentity->GetKey(getter_Copies(thisKey));
    if (PL_strcmp(key, thisKey)==0) {
      found = PR_TRUE;
      break;
    }
  }

  if (!found)
    array->AppendElement(identity);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgAccountManager::addListener ( nsHashKey *  aKey,
void element,
void aData 
) [static, private]

Definition at line 2381 of file nsMsgAccountManager.cpp.

{
  nsIMsgIncomingServer *server = (nsIMsgIncomingServer *)element;
  nsIFolderListener* listener = (nsIFolderListener *)aData;

  nsresult rv;
  
  nsCOMPtr<nsIMsgFolder> rootFolder;
  rv = server->GetRootFolder(getter_AddRefs(rootFolder));
  NS_ENSURE_SUCCESS(rv, PR_TRUE);

  rv = rootFolder->AddFolderListener(listener);
  NS_ENSURE_SUCCESS(rv, PR_TRUE);
  
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::addListenerToFolder ( nsISupports *  element,
void data 
) [static, private]

Definition at line 565 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsIMsgFolder *rootFolder = (nsIMsgFolder *)data;
  nsCOMPtr<nsIFolderListener> listener = do_QueryInterface(element, &rv);
  NS_ENSURE_SUCCESS(rv, PR_TRUE);

  rootFolder->AddFolderListener(listener);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgAccountManager::AddVFListenersForVF ( nsIMsgFolder virtualFolder,
const char *  srchFolderUris,
nsIRDFService rdf,
nsIMsgDBService msgDBService 
) [private]

Definition at line 3099 of file nsMsgAccountManager.cpp.

{
  nsCStringArray folderUris;
  folderUris.ParseString(srchFolderUris, "|");
  nsCOMPtr <nsIRDFResource> resource;

  for (PRInt32 i = 0; i < folderUris.Count(); i++)
  {
    rdf->GetResource(*(folderUris[i]), getter_AddRefs(resource));
    nsCOMPtr <nsIMsgFolder> realFolder = do_QueryInterface(resource);
    VirtualFolderChangeListener *dbListener = new VirtualFolderChangeListener();
    NS_ENSURE_TRUE(dbListener, NS_ERROR_OUT_OF_MEMORY);
    m_virtualFolderListeners.AppendObject(dbListener);
    dbListener->m_virtualFolder = virtualFolder;
    dbListener->m_folderWatching = realFolder;
    dbListener->Init();
    msgDBService->RegisterPendingListener(realFolder, dbListener);
  }
  return NS_OK;
}

Here is the call graph for this function:

PRBool PR_CALLBACK nsMsgAccountManager::cleanupOnExit ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1012 of file nsMsgAccountManager.cpp.

{
  nsIMsgIncomingServer *server = (nsIMsgIncomingServer*)aData;
  PRBool emptyTrashOnExit = PR_FALSE;
  PRBool cleanupInboxOnExit = PR_FALSE;
  nsresult rv;
    
  if (WeAreOffline())
    return PR_TRUE;

  server->GetEmptyTrashOnExit(&emptyTrashOnExit);
  nsCOMPtr <nsIImapIncomingServer> imapserver = do_QueryInterface(server);
  if (imapserver)
  {
    imapserver->GetCleanupInboxOnExit(&cleanupInboxOnExit);
    imapserver->SetShuttingDown(PR_TRUE);
  }
  if (emptyTrashOnExit || cleanupInboxOnExit)
  {
    nsCOMPtr<nsIMsgFolder> root;
    server->GetRootFolder(getter_AddRefs(root));
    nsXPIDLCString type;
    server->GetType(getter_Copies(type));
    if (root)
    {
      nsCOMPtr<nsIMsgFolder> folder;
      folder = do_QueryInterface(root);
      if (folder)
      {
         nsXPIDLCString passwd;
         PRBool serverRequiresPasswordForAuthentication = PR_TRUE;
         PRBool isImap = (type ? PL_strcmp(type, "imap") == 0 :
                          PR_FALSE);
         if (isImap)
         {
           server->GetServerRequiresPasswordForBiff(&serverRequiresPasswordForAuthentication);
           server->GetPassword(getter_Copies(passwd));
         }
         if (!isImap || (isImap && (!serverRequiresPasswordForAuthentication || (passwd && 
                        strlen((const char*) passwd)))))
         {
           nsCOMPtr<nsIUrlListener> urlListener;
           nsCOMPtr<nsIMsgAccountManager> accountManager = 
                    do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
           if (NS_FAILED(rv)) return rv;
           nsCOMPtr<nsIEventQueueService> pEventQService = 
                    do_GetService(kEventQueueServiceCID, &rv);
           if (NS_FAILED(rv)) return rv;
           nsCOMPtr<nsIEventQueue> eventQueue;
           pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD,
                                    getter_AddRefs(eventQueue)); 
           if (isImap)
             urlListener = do_QueryInterface(accountManager, &rv);
                    
           if (isImap && cleanupInboxOnExit)
           {
             nsCOMPtr<nsIEnumerator> aEnumerator;
             folder->GetSubFolders(getter_AddRefs(aEnumerator));
             nsCOMPtr<nsISupports> aSupport;
             rv = aEnumerator->First();
             while (NS_SUCCEEDED(rv))
             {  
               rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
               nsCOMPtr<nsIMsgFolder>inboxFolder = do_QueryInterface(aSupport);
               PRUint32 flags;
               inboxFolder->GetFlags(&flags);
               if (flags & MSG_FOLDER_FLAG_INBOX)
               {
                 rv = inboxFolder->Compact(urlListener, nsnull /* msgwindow */);
                 if (NS_SUCCEEDED(rv))
                   accountManager->SetFolderDoingCleanupInbox(inboxFolder);
                 break;
                }
                else
                  rv = aEnumerator->Next();
             }
           }
                          
           if (emptyTrashOnExit)
           {
             rv = folder->EmptyTrash(nsnull, urlListener);
             if (isImap && NS_SUCCEEDED(rv))
               accountManager->SetFolderDoingEmptyTrash(folder);
           }
                    
           if (isImap && urlListener)
           {
             PRBool inProgress = PR_FALSE;
             if (cleanupInboxOnExit)
             {
               PRInt32 loopCount = 0; // used to break out after 5 seconds
               accountManager->GetCleanupInboxInProgress(&inProgress);
               while (inProgress && loopCount++ < 5000)
               {
                 accountManager->GetCleanupInboxInProgress(&inProgress);
                 PR_CEnterMonitor(folder);
                 PR_CWait(folder, PR_MicrosecondsToInterval(1000UL));
                 PR_CExitMonitor(folder);
                 if (eventQueue)
                 {
                   PLEvent *event;
                   do
                   {
                     eventQueue->GetEvent(&event);
                     if (event)
                       eventQueue->HandleEvent(event);
                   }
                   while (event);
                 }
               }
             }
             if (emptyTrashOnExit)
             {
               accountManager->GetEmptyTrashInProgress(&inProgress);
               PRInt32 loopCount = 0;
               while (inProgress && loopCount++ < 5000)
               {
                 accountManager->GetEmptyTrashInProgress(&inProgress);
                 PR_CEnterMonitor(folder);
                 PR_CWait(folder, PR_MicrosecondsToInterval(1000UL));
                 PR_CExitMonitor(folder);
                 if (eventQueue)
                 {
                   PLEvent *event;
                   do
                   {
                     eventQueue->GetEvent(&event);
                     if (event)
                       eventQueue->HandleEvent(event);
                   }
                   while (event);
                 }
               }
             }
           } 
         }
       }     
     }
   }
   return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::closeCachedConnections ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1155 of file nsMsgAccountManager.cpp.

Here is the call graph for this function:

nsIMsgIncomingServer nsIMsgAccountManager::createIncomingServer ( in string  username,
in string  hostname,
in string  type 
) [inherited]
nsresult nsMsgAccountManager::createKeyedAccount ( const char *  key,
nsIMsgAccount **  _retval 
) [private]

Definition at line 1645 of file nsMsgAccountManager.cpp.

{
    
  nsresult rv;
  nsCOMPtr<nsIMsgAccount> account = do_CreateInstance(kMsgAccountCID, &rv);
  if (NS_FAILED(rv)) return rv;

  account->SetKey(key);

  // add to internal nsISupportsArray
  m_accounts->AppendElement(NS_STATIC_CAST(nsISupports*, account));

  // add to string list
  if (mAccountKeyList.IsEmpty())
    mAccountKeyList = key;
  else {
    mAccountKeyList += ",";
    mAccountKeyList += key;
  }

  rv = getPrefService();
  if (NS_SUCCEEDED(rv))
    m_prefs->SetCharPref(PREF_MAIL_ACCOUNTMANAGER_ACCOUNTS,
                         mAccountKeyList.get());

  NS_ADDREF(*aAccount = account);
  
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgAccountManager::createKeyedIdentity ( const char *  key,
nsIMsgIdentity **  _retval 
) [private]

Definition at line 421 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgIdentity> identity =
      do_CreateInstance(NS_MSGIDENTITY_CONTRACTID, &rv);
  if (NS_FAILED(rv)) return rv;
  
  identity->SetKey(key);
  
  nsCStringKey hashKey(key);

  // addref for the hash table`
  nsISupports* idsupports = identity;
  NS_ADDREF(idsupports);
  m_identities.Put(&hashKey, (void *)idsupports);

  NS_ADDREF(*aIdentity = identity);
  
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgAccountManager::createKeyedServer ( const char *  key,
const char *  username,
const char *  password,
const char *  type,
nsIMsgIncomingServer **  _retval 
) [private]

Definition at line 523 of file nsMsgAccountManager.cpp.

{
  nsresult rv;

  //construct the contractid
  nsCAutoString serverContractID(NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX);
  serverContractID += type;
  
  // finally, create the server
  nsCOMPtr<nsIMsgIncomingServer> server =
           do_CreateInstance(serverContractID.get(), &rv);
  NS_ENSURE_SUCCESS(rv, rv);
  
  server->SetKey(key);
  server->SetType(type);
  server->SetUsername(username);
  server->SetHostName(hostname);

  nsCStringKey hashKey(key);

  // addref for the hashtable
  nsISupports* serversupports = server;
  NS_ADDREF(serversupports);
  m_incomingServers.Put(&hashKey, serversupports);

  // now add all listeners that are supposed to be
  // waiting on root folders
  nsCOMPtr<nsIMsgFolder> rootFolder;
  rv = server->GetRootFolder(getter_AddRefs(rootFolder));
  NS_ENSURE_SUCCESS(rv, rv);
  mFolderListeners->EnumerateForwards(addListenerToFolder,
                                      (void *)(nsIMsgFolder*)rootFolder);
  NS_ADDREF(*aServer = server);
  
  return NS_OK;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::findAccountByKey ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 1761 of file nsMsgAccountManager.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element, &rv);
    if (NS_FAILED(rv)) return PR_TRUE;
    
    findAccountByKeyEntry *entry = (findAccountByKeyEntry*) aData;

    nsXPIDLCString key;
    account->GetKey(getter_Copies(key));
    if (PL_strcmp(key, entry->key)==0) {
        entry->account = account;
        return PR_FALSE;        // stop when found
    }

    return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgAccountManager::findAccountByServerKey ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 2023 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  findAccountByKeyEntry *entry = (findAccountByKeyEntry*)aData;
  nsCOMPtr<nsIMsgAccount> account =
    do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) 
    return PR_TRUE;

  nsCOMPtr<nsIMsgIncomingServer> server;
  rv = account->GetIncomingServer(getter_AddRefs(server));
  if (!server || NS_FAILED(rv)) 
    return PR_TRUE;

  nsXPIDLCString key;
  rv = server->GetKey(getter_Copies(key));
  if (NS_FAILED(rv)) return PR_TRUE;

  // if the keys are equal, the servers are equal
  if (PL_strcmp(key, entry->key)==0) 
  {
    entry->account = account;
    return PR_FALSE;            // stop on first found account
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgAccountManager::findIdentitiesForServer ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 2237 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  findIdentitiesByServerEntry *entry = (findIdentitiesByServerEntry*)aData;
  
  nsCOMPtr<nsIMsgIncomingServer> thisServer;
  rv = account->GetIncomingServer(getter_AddRefs(thisServer));
  if (NS_FAILED(rv)) return PR_TRUE;
  nsXPIDLCString serverKey;
    
//  NS_ASSERTION(thisServer, "thisServer is null");
  NS_ASSERTION(entry, "entry is null");
  NS_ASSERTION(entry->server, "entry->server is null");
  // if this happens, bail.
  if (!thisServer || !entry || !(entry->server)) 
    return PR_TRUE;

  entry->server->GetKey(getter_Copies(serverKey));
  nsXPIDLCString thisServerKey;
  thisServer->GetKey(getter_Copies(thisServerKey));
  if (PL_strcmp(serverKey, thisServerKey)==0) 
  {
    // add all these elements to the nsISupports array
    nsCOMPtr<nsISupportsArray> theseIdentities;
    rv = account->GetIdentities(getter_AddRefs(theseIdentities));
    if (NS_SUCCEEDED(rv))
      rv = entry->identities->AppendElements(theseIdentities);
  }

  return PR_TRUE;
}

Here is the call graph for this function:

nsIMsgIncomingServer nsIMsgAccountManager::findRealServer ( in string  userName,
in string  hostname,
in string  type,
in long  port 
) [inherited]
nsIMsgIncomingServer nsIMsgAccountManager::FindServer ( in string  userName,
in string  hostname,
in string  type 
) [inherited]

Here is the caller graph for this function:

PRBool nsMsgAccountManager::findServer ( nsISupports *  aElement,
void data 
) [static, private]

Definition at line 2137 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  
  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aElement, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;

  findServerEntry *entry = (findServerEntry*) data;
  
  nsXPIDLCString thisHostname;
  if (entry->useRealSetting)
    rv = server->GetRealHostName(getter_Copies(thisHostname));
  else
  rv = server->GetHostName(getter_Copies(thisHostname));
  if (NS_FAILED(rv)) return PR_TRUE;

  nsXPIDLCString thisUsername;
  if (entry->useRealSetting)
    rv = server->GetRealUsername(getter_Copies(thisUsername));
  else
  rv = server->GetUsername(getter_Copies(thisUsername));
  if (NS_FAILED(rv)) return PR_TRUE;
 
  nsXPIDLCString thisType;
  rv = server->GetType(getter_Copies(thisType));
  if (NS_FAILED(rv)) return PR_TRUE;
 
  // treat "" as a wild card, so if the caller passed in "" for the desired attribute
  // treat it as a match
  PRBool checkType = PL_strcmp(entry->type, "");
  PRBool checkHostname = PL_strcmp(entry->hostname,"");
  PRBool checkUsername = PL_strcmp(entry->username,"");
  if ((!checkType || (PL_strcmp(entry->type, thisType)==0)) && 
      (!checkHostname || (PL_strcasecmp(entry->hostname, thisHostname)==0)) && 
      (!checkUsername || (PL_strcmp(entry->username, thisUsername)==0))) 
  {
    entry->server = server;
    return PR_FALSE;            // stop on first find 
  }
  
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

find the index of this server in the (ordered) list of accounts

PRBool nsMsgAccountManager::findServerIndexByServer ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 1734 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  
  nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element);
  findServerByKeyEntry *entry = (findServerByKeyEntry*) aData;

  // increment the index;
  entry->index++;
  
  nsCOMPtr<nsIMsgIncomingServer> server;
  rv = account->GetIncomingServer(getter_AddRefs(server));
  if (!server || NS_FAILED(rv)) return PR_TRUE;
  
  nsXPIDLCString key;
  rv = server->GetKey(getter_Copies(key));
  if (NS_FAILED(rv)) return PR_TRUE;

  // stop when found,
  // index will be set to the current index 
  if (nsCRT::strcmp(key, entry->key)==0)
    return PR_FALSE;
  
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::findServersForIdentity ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 2298 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  findServersByIdentityEntry *entry = (findServersByIdentityEntry*)aData;

  nsCOMPtr<nsISupportsArray> identities;
  account->GetIdentities(getter_AddRefs(identities));

  PRUint32 idCount=0;
  identities->Count(&idCount);

  PRUint32 id;
  nsXPIDLCString identityKey;
  rv = entry->identity->GetKey(getter_Copies(identityKey));

  
  for (id=0; id<idCount; id++) 
  {

    // convert supports->Identity
    nsCOMPtr<nsISupports> thisSupports;
    rv = identities->GetElementAt(id, getter_AddRefs(thisSupports));
    if (NS_FAILED(rv)) continue;
    
    nsCOMPtr<nsIMsgIdentity>
      thisIdentity = do_QueryInterface(thisSupports, &rv);

    if (NS_SUCCEEDED(rv)) 
    {

      nsXPIDLCString thisIdentityKey;
      rv = thisIdentity->GetKey(getter_Copies(thisIdentityKey));

      if (NS_SUCCEEDED(rv) && PL_strcmp(identityKey, thisIdentityKey) == 0) 
      {
        nsCOMPtr<nsIMsgIncomingServer> thisServer;
        rv = account->GetIncomingServer(getter_AddRefs(thisServer));
        
        if (thisServer && NS_SUCCEEDED(rv)) 
        {
          entry->servers->AppendElement(thisServer);
          break;
        }
      }
    }
  }

  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::findServerUrl ( nsISupports *  aElement,
void data 
) [static, private]

Definition at line 2084 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  
  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aElement);
  if (!server) return PR_TRUE;

  findServerEntry *entry = (findServerEntry*) data;
  
  nsXPIDLCString thisHostname;
  if (entry->useRealSetting)
    rv = server->GetRealHostName(getter_Copies(thisHostname));
  else
    rv = server->GetHostName(getter_Copies(thisHostname));
  if (NS_FAILED(rv)) return PR_TRUE;

  nsXPIDLCString thisUsername;
  if (entry->useRealSetting)
    rv = server->GetRealUsername(getter_Copies(thisUsername));
  else
    rv = server->GetUsername(getter_Copies(thisUsername));
  if (NS_FAILED(rv)) return PR_TRUE;
 
  nsXPIDLCString thisType;
  rv = server->GetType(getter_Copies(thisType));
  if (NS_FAILED(rv)) return PR_TRUE;
 
  PRInt32 thisPort = -1; // use the default port identifier
  // Don't try and get a port for the 'none' scheme 
  if (!thisType.EqualsLiteral("none")) 
  {
    rv = server->GetPort(&thisPort);
    NS_ENSURE_TRUE(NS_SUCCEEDED(rv), PR_TRUE);
  }

  // treat "" as a wild card, so if the caller passed in "" for the desired attribute
  // treat it as a match
  // NOTE: DO NOT REPLACE PL_strcmp OR PL_strcasecmp below because one or more
  // of these items may be null
  if ((!*entry->type || (PL_strcmp(entry->type, thisType)==0)) && 
      (!*entry->hostname || (PL_strcasecmp(entry->hostname, thisHostname)==0)) && 
      (!(entry->port != 0) || (entry->port == thisPort)) && 
      (!*entry->username || (PL_strcmp(entry->username, thisUsername)==0))) 
  {
    entry->server = server;
    return PR_FALSE;            // stop on first find 
  }
  
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::getAccountList ( nsISupports *  aKey,
void aData 
) [static, private]

Definition at line 1495 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCAutoString* accountList = (nsCAutoString*) aData;
  nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  nsXPIDLCString key;
  rv = account->GetKey(getter_Copies(key));
  if (NS_FAILED(rv)) return PR_TRUE;

  if ((*accountList).IsEmpty())
    (*accountList).Append(key);
  else {
    (*accountList) += ',';
    (*accountList).Append(key);
  }

  return PR_TRUE;
}

Here is the call graph for this function:

given a server, return the first identity in accounts that have this server

PRBool nsMsgAccountManager::getIdentitiesToArray ( nsISupports *  element,
void aData 
) [static, private]

Definition at line 1282 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgAccount> account = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  
  nsCOMPtr<nsISupportsArray> identities;
  rv = account->GetIdentities(getter_AddRefs(identities));
  if (NS_FAILED(rv)) return PR_TRUE;

  identities->EnumerateForwards(addIdentityIfUnique, aData);
  
  return PR_TRUE;
}

Here is the call graph for this function:

Definition at line 316 of file nsMsgAccountManager.cpp.

{

  // get the prefs service
  nsresult rv = NS_OK;
  
  if (!m_prefs)
    m_prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);

  if (NS_FAILED(rv)) return rv;
  /* m_prefs is good now */
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool PR_CALLBACK nsMsgAccountManager::getServersToArray ( nsHashKey *  aKey,
void element,
void aData 
) [static, private]

Definition at line 1319 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgIncomingServer> server =
    do_QueryInterface((nsISupports*)element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;
  
  nsISupportsArray *array = (nsISupportsArray*)aData;
  
  nsCOMPtr<nsISupports> serverSupports = do_QueryInterface(server);
  if (NS_SUCCEEDED(rv)) 
    array->AppendElement(serverSupports);

  return PR_TRUE;
}

Here is the call graph for this function:

void nsMsgAccountManager::getUniqueAccountKey ( const char *  prefix,
nsISupportsArray accounts,
nsCString aResult 
) [static, private]

Definition at line 350 of file nsMsgAccountManager.cpp.

{
  PRInt32 i=1;
  PRBool unique = PR_FALSE;
  
  findAccountByKeyEntry findEntry;
  findEntry.account = nsnull;
  
  do {
      aResult = prefix;
      aResult.AppendInt(i++);
      findEntry.key = aResult.get();
    
    accounts->EnumerateForwards(findAccountByKey, (void *)&findEntry);

    if (!findEntry.account) unique=PR_TRUE;
    findEntry.account = nsnull;
  } while (!unique);

}

Here is the call graph for this function:

void nsMsgAccountManager::getUniqueKey ( const char *  prefix,
nsHashtable *  hashTable,
nsCString aResult 
) [static, private]

Definition at line 331 of file nsMsgAccountManager.cpp.

{
  PRInt32 i=1;
  PRBool unique=PR_FALSE;

  do {
    aResult=prefix;
    aResult.AppendInt(i++);
    nsCStringKey hashKey(aResult);
    void* hashElement = hashTable->Get(&hashKey);
    
    if (!hashElement) unique=PR_TRUE;
  } while (!unique);

}

Here is the call graph for this function:

Definition at line 2871 of file nsMsgAccountManager.cpp.

{
  nsCOMPtr<nsIFile> profileDir;
  nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
  NS_ENSURE_SUCCESS(rv, rv);

  rv = profileDir->AppendNative(nsDependentCString("virtualFolders.dat"));
  if (NS_SUCCEEDED(rv))
    file = do_QueryInterface(profileDir, &rv);
  return rv;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::hashElementRelease ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1205 of file nsMsgAccountManager.cpp.

{
  nsISupports* element = (nsISupports*)aData;

  NS_RELEASE(element);

  return PR_TRUE;               // return true to remove this element
}
PRBool nsMsgAccountManager::hashElementToArray ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1194 of file nsMsgAccountManager.cpp.

{
    nsISupports* element = (nsISupports*)aData;
    nsISupportsArray* array = (nsISupportsArray*)closure;

    array->AppendElement(element);
    return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::hashLogoutOfServer ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 956 of file nsMsgAccountManager.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIMsgIncomingServer> server =
      do_QueryInterface((nsISupports*)aData, &rv);
    if (NS_SUCCEEDED(rv))
      LogoutOfServer(server);

    return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::hashUnloadServer ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 923 of file nsMsgAccountManager.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIMsgIncomingServer> server =
      do_QueryInterface((nsISupports*)aData, &rv);
    if (NS_FAILED(rv)) return PR_TRUE;
    
    nsMsgAccountManager *accountManager = (nsMsgAccountManager*)closure;
    accountManager->NotifyServerUnloaded(server);

    nsCOMPtr<nsIMsgFolder> rootFolder;
    rv = server->GetRootFolder(getter_AddRefs(rootFolder));

    accountManager->mFolderListeners->EnumerateForwards(removeListenerFromFolder,
                                        (void *)(nsIMsgFolder*)rootFolder);

    if(NS_SUCCEEDED(rv))
        rootFolder->Shutdown(PR_TRUE);

    return PR_TRUE;

}

Here is the call graph for this function:

Definition at line 189 of file nsMsgAccountManager.cpp.

{
  nsresult rv;

  rv = NS_NewISupportsArray(getter_AddRefs(m_accounts));
  if(NS_FAILED(rv)) return rv;

  rv = NS_NewISupportsArray(getter_AddRefs(mFolderListeners));

  nsCOMPtr<nsIObserverService> observerService = 
           do_GetService("@mozilla.org/observer-service;1", &rv);
  if (NS_SUCCEEDED(rv))
  {    
    observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
    observerService->AddObserver(this, "quit-application" , PR_TRUE);
    observerService->AddObserver(this, ABOUT_TO_GO_OFFLINE_TOPIC, PR_TRUE);
    observerService->AddObserver(this, "session-logout", PR_TRUE);
    observerService->AddObserver(this, "profile-before-change", PR_TRUE);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgAccountManager::InternalFindServer ( const char *  username,
const char *  hostname,
const char *  type,
PRBool  useRealSetting,
nsIMsgIncomingServer **  aResult 
) [private]

Definition at line 1924 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsCOMPtr<nsISupportsArray> servers;
 
  findServerEntry serverInfo;

  // "" acts as the wild card.

  // hostname might be blank, pass "" instead
  serverInfo.hostname = hostname ? hostname : "";
  // username might be blank, pass "" instead
  serverInfo.username = username ? username : "";
  // type might be blank, pass "" instead
  serverInfo.type = type ? type : "";
  serverInfo.useRealSetting = useRealSetting;

  // If 'useRealSetting' is set then we want to scan all existing accounts
  // to make sure there's no duplicate including those whose host and/or
  // user names have been changed.
  if (!useRealSetting &&
      (m_lastFindServerHostName.Equals(serverInfo.hostname)) &&
      (m_lastFindServerUserName.Equals(serverInfo.username)) &&
      (m_lastFindServerType.Equals(serverInfo.type)) &&
      m_lastFindServerResult) 
  {
    NS_ADDREF(*aResult = m_lastFindServerResult);
    return NS_OK;
  }

  rv = GetAllServers(getter_AddRefs(servers));
  if (NS_FAILED(rv)) return rv;

  serverInfo.server = *aResult = nsnull;
  
  servers->EnumerateForwards(findServer, (void *)&serverInfo);

  if (!serverInfo.server) return NS_ERROR_UNEXPECTED;

  // cache for next time
  rv = SetLastServerFound(serverInfo.server, hostname, username, 0, type);
  NS_ENSURE_SUCCESS(rv,rv);

  NS_ADDREF(*aResult = serverInfo.server);
  
  return NS_OK;

}

Here is the call graph for this function:

Definition at line 947 of file nsMsgAccountManager.cpp.

{
    nsresult rv = aServer->Shutdown();
    NS_ASSERTION(NS_SUCCEEDED(rv), "Shutdown of server failed");
    rv = aServer->ForgetSessionPassword();
    NS_ASSERTION(NS_SUCCEEDED(rv), "failed to remove the password associated with server");
}

Here is the caller graph for this function:

nsresult nsMsgAccountManager::notifyDefaultServerChange ( nsIMsgAccount aOldAccount,
nsIMsgAccount aNewAccount 
) [private]

Definition at line 855 of file nsMsgAccountManager.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIMsgIncomingServer> server;
  nsCOMPtr<nsIMsgFolder> rootFolder;
  
  // first tell old server it's no longer the default
  if (aOldAccount) {
    rv = aOldAccount->GetIncomingServer(getter_AddRefs(server));
    if (NS_SUCCEEDED(rv) && server) {
      rv = server->GetRootFolder(getter_AddRefs(rootFolder));
      if (NS_SUCCEEDED(rv) && rootFolder)
        rootFolder->NotifyBoolPropertyChanged(kDefaultServerAtom,
                                                        PR_TRUE, PR_FALSE);
    }
  }
    
    // now tell new server it is.
  if (aNewAccount) {
    rv = aNewAccount->GetIncomingServer(getter_AddRefs(server));
    if (NS_SUCCEEDED(rv) && server) {
      rv = server->GetRootFolder(getter_AddRefs(rootFolder));
      if (NS_SUCCEEDED(rv) && rootFolder)
        rootFolder->NotifyBoolPropertyChanged(kDefaultServerAtom,
                                              PR_FALSE, PR_TRUE);
    }
  }

  if (aOldAccount && aNewAccount)  //only notify if the user goes and changes default account
  {
    nsCOMPtr<nsIObserverService> observerService = 
      do_GetService("@mozilla.org/observer-service;1", &rv);

    if (NS_SUCCEEDED(rv))
      observerService->NotifyObservers(nsnull,"mailDefaultAccountChanged",nsnull);
  }

  return NS_OK;
}

Here is the call graph for this function:

void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
void nsIFolderListener::OnItemAdded ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemBoolPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in boolean  oldValue,
in boolean  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemEvent ( in nsIMsgFolder  item,
in nsIAtom  event 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemIntPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in long  oldValue,
in long  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in string  oldValue,
in string  newValue 
) [inherited]
void nsIFolderListener::OnItemPropertyFlagChanged ( in nsIMsgDBHdr  item,
in nsIAtom  property,
in unsigned long  oldFlag,
in unsigned long  newFlag 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemRemoved ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]
void nsIFolderListener::OnItemUnicharPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in wstring  oldValue,
in wstring  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIUrlListener::OnStopRunningUrl ( in nsIURI  url,
in nsresult  aExitCode 
) [inherited]

Here is the caller graph for this function:

Definition at line 723 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  rv = getPrefService();
  if (NS_FAILED(rv)) return rv;

  nsXPIDLCString accountList;
  rv = m_prefs->GetCharPref(PREF_MAIL_ACCOUNTMANAGER_ACCOUNTS, getter_Copies(accountList));
  if (NS_FAILED(rv)) return rv;

  // reconstruct the new account list, re-adding all accounts except
  // the one with 'key'
  nsCAutoString newAccountList;
  char *newStr;
  char *rest = accountList.BeginWriting();
  
  char *token = nsCRT::strtok(rest, ",", &newStr);
  while (token) {
    nsCAutoString testKey(token);
    testKey.StripWhitespace();

    // re-add the candidate key only if it's not the key we're looking for
    if (!testKey.IsEmpty() && !testKey.Equals(key)) {
      if (!newAccountList.IsEmpty())
        newAccountList += ',';
      newAccountList += testKey;
    }

    token = nsCRT::strtok(newStr, ",", &newStr);
  }

  // Update mAccountKeyList to reflect the deletion
  mAccountKeyList = newAccountList;

  // now write the new account list back to the prefs
  rv = m_prefs->SetCharPref(PREF_MAIL_ACCOUNTMANAGER_ACCOUNTS,
                              newAccountList.get());
  if (NS_FAILED(rv)) return rv;


  return NS_OK;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::removeListener ( nsHashKey *  aKey,
void element,
void aData 
) [static, private]

Definition at line 2399 of file nsMsgAccountManager.cpp.

{
  nsIMsgIncomingServer *server = (nsIMsgIncomingServer *)element;
  nsIFolderListener* listener = (nsIFolderListener *)aData;

  nsresult rv;
  
  nsCOMPtr<nsIMsgFolder> rootFolder;
  rv = server->GetRootFolder(getter_AddRefs(rootFolder));
  NS_ENSURE_SUCCESS(rv, PR_TRUE);

  rv = rootFolder->RemoveFolderListener(listener);
  NS_ENSURE_SUCCESS(rv, PR_TRUE);
  
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsMsgAccountManager::removeListenerFromFolder ( nsISupports *  element,
void data 
) [static, private]

Definition at line 577 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  nsIMsgFolder *rootFolder = (nsIMsgFolder *)data;
  nsCOMPtr<nsIFolderListener> listener = do_QueryInterface(element, &rv);
  NS_ENSURE_SUCCESS(rv, PR_TRUE);

  rootFolder->RemoveFolderListener(listener);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 898 of file nsMsgAccountManager.cpp.

{
  nsresult rv;
  
  rv = getPrefService();
  NS_ENSURE_SUCCESS(rv,rv);

  if (aDefaultAccount) {
    nsXPIDLCString key;
    rv = aDefaultAccount->GetKey(getter_Copies(key));
    NS_ENSURE_SUCCESS(rv, rv);
    
    rv = m_prefs->SetCharPref(PREF_MAIL_ACCOUNTMANAGER_DEFAULTACCOUNT, key);
    NS_ENSURE_SUCCESS(rv,rv);
  }
  else
    // don't care if this fails
    m_prefs->ClearUserPref(PREF_MAIL_ACCOUNTMANAGER_DEFAULTACCOUNT);

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsMsgAccountManager::SetLastServerFound ( nsIMsgIncomingServer server,
const char *  hostname,
const char *  username,
const PRInt32  port,
const char *  type 
) [private]

Definition at line 2549 of file nsMsgAccountManager.cpp.

Here is the caller graph for this function:

Definition at line 212 of file nsMsgAccountManager.cpp.

{
  if (m_haveShutdown)     // do not shutdown twice
    return NS_OK;

  nsresult rv;

  SaveVirtualFolders();
    
  nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
  if (msgDBService)
  {
    PRInt32 numVFListeners = m_virtualFolderListeners.Count();
    for(PRInt32 i = 0; i < numVFListeners; i++)
      msgDBService->UnregisterPendingListener(m_virtualFolderListeners[i]);
  }
  if(m_msgFolderCache)
    WriteToFolderCache(m_msgFolderCache);
  (void)ShutdownServers();
  (void)UnloadAccounts();
  
  //shutdown removes nsIIncomingServer listener from biff manager, so do it after accounts have been unloaded
  nsCOMPtr<nsIMsgBiffManager> biffService = do_GetService(NS_MSGBIFFMANAGER_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv) && biffService)
    biffService->Shutdown();

  //shutdown removes nsIIncomingServer listener from purge service, so do it after accounts have been unloaded
  nsCOMPtr<nsIMsgPurgeService> purgeService = do_GetService(NS_MSGPURGESERVICE_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv) && purgeService)
    purgeService->Shutdown();
  
  m_msgFolderCache = nsnull;

  m_haveShutdown = PR_TRUE;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgAccountManager::shutdown ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1164 of file nsMsgAccountManager.cpp.

{
  nsIMsgIncomingServer *server = (nsIMsgIncomingServer*)aData;

  server->Shutdown();

  return PR_TRUE;
}

Here is the caller graph for this function:

PRBool nsMsgAccountManager::writeFolderCache ( nsHashKey *  aKey,
void aData,
void closure 
) [static, private]

Definition at line 1001 of file nsMsgAccountManager.cpp.

Here is the call graph for this function:

nsresult nsMsgAccountManager::WriteLineToOutputStream ( const char *  prefix,
const char *  line,
nsIOutputStream outputStream 
) [private]

Definition at line 3090 of file nsMsgAccountManager.cpp.

{
  PRUint32 writeCount;
  outputStream->Write(prefix, strlen(prefix), &writeCount);
  outputStream->Write(line, strlen(line), &writeCount);
  outputStream->Write("\n", 1, &writeCount);
  return NS_OK;
}

Here is the caller graph for this function:


Member Data Documentation

ordered list of all accounts, by the order they are in the prefs array of nsIMsgAccount

Definition at line 100 of file nsIMsgAccountManager.idl.

Definition at line 49 of file nsIFolderListener.idl.

Definition at line 105 of file nsIMsgAccountManager.idl.

Definition at line 110 of file nsIMsgAccountManager.idl.

Definition at line 69 of file nsIFolderListener.idl.

Definition at line 94 of file nsIMsgAccountManager.idl.

Definition at line 113 of file nsIMsgAccountManager.idl.

Definition at line 63 of file nsIFolderListener.idl.

Definition at line 88 of file nsMsgAccountManager.h.

Definition at line 172 of file nsIMsgAccountManager.idl.

Definition at line 89 of file nsMsgAccountManager.h.

Definition at line 86 of file nsMsgAccountManager.h.

Definition at line 98 of file nsMsgAccountManager.h.

Definition at line 92 of file nsMsgAccountManager.h.

Definition at line 97 of file nsMsgAccountManager.h.

Definition at line 96 of file nsMsgAccountManager.h.

Definition at line 95 of file nsMsgAccountManager.h.

Definition at line 102 of file nsMsgAccountManager.h.

nsHashtable nsMsgAccountManager::m_identities [private]

Definition at line 90 of file nsMsgAccountManager.h.

Definition at line 93 of file nsMsgAccountManager.h.

Definition at line 91 of file nsMsgAccountManager.h.

Definition at line 110 of file nsMsgAccountManager.h.

Definition at line 112 of file nsMsgAccountManager.h.

Definition at line 109 of file nsMsgAccountManager.h.

Definition at line 113 of file nsMsgAccountManager.h.

Definition at line 111 of file nsMsgAccountManager.h.

Definition at line 105 of file nsMsgAccountManager.h.

Definition at line 87 of file nsMsgAccountManager.h.

Definition at line 226 of file nsMsgAccountManager.h.

Definition at line 103 of file nsMsgAccountManager.h.

Definition at line 104 of file nsMsgAccountManager.h.

Definition at line 94 of file nsMsgAccountManager.h.

Definition at line 106 of file nsMsgAccountManager.h.

Definition at line 100 of file nsMsgAccountManager.h.

Definition at line 240 of file nsMsgAccountManager.h.

Definition at line 57 of file nsIFolderListener.idl.

Definition at line 81 of file nsIFolderListener.idl.

Definition at line 53 of file nsIFolderListener.idl.

Definition at line 116 of file nsIMsgAccountManager.idl.

Definition at line 75 of file nsIFolderListener.idl.

for preventing unauthenticated users from seeing header information

Definition at line 121 of file nsIMsgAccountManager.idl.


Event Documentation

Definition at line 90 of file nsIFolderListener.idl.

Definition at line 87 of file nsIFolderListener.idl.


The documentation for this class was generated from the following files: