Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsAbMDBDirFactory.cpp File Reference
#include "nsAbMDBDirFactory.h"
#include "nsAbUtils.h"
#include "nsIRDFService.h"
#include "nsIRDFResource.h"
#include "nsRDFResource.h"
#include "nsIAbMDBDirectory.h"
#include "nsAbDirFactoryService.h"
#include "nsIAddressBook.h"
#include "nsIAddrBookSession.h"
#include "nsIAddrDBListener.h"
#include "nsEnumeratorUtils.h"
#include "nsAbBaseCID.h"

Go to the source code of this file.

Functions

static nsresult RemoveMailListDBListeners (nsIAddrDatabase *database, nsIAbDirectory *directory)

Function Documentation

static nsresult RemoveMailListDBListeners ( nsIAddrDatabase database,
nsIAbDirectory directory 
) [static]

Definition at line 69 of file nsAbMDBDirFactory.cpp.

{
    nsresult rv;

    nsCOMPtr<nsISupportsArray> pAddressLists;
    rv = directory->GetAddressLists(getter_AddRefs(pAddressLists));
    NS_ENSURE_SUCCESS(rv, rv);

    PRUint32 total;
    rv = pAddressLists->Count(&total);
    NS_ENSURE_SUCCESS(rv, rv);

    for (PRUint32 i = 0; i < total; i++)
    {
        nsCOMPtr<nsISupports> pSupport;
        rv = pAddressLists->GetElementAt(i, getter_AddRefs(pSupport));
        if (NS_FAILED(rv))
            break;

        nsCOMPtr<nsIAbDirectory> listDir(do_QueryInterface(pSupport, &rv));
        if (NS_FAILED(rv))
            break;
        nsCOMPtr<nsIAddrDBListener> dbListener(do_QueryInterface(pSupport, &rv));
        if (NS_FAILED(rv))
            break;

        database->RemoveListener(dbListener);
    }

    return NS_OK;
}

Here is the call graph for this function: