Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsAbMDBDirectory.cpp File Reference
#include "nsAbMDBDirectory.h"
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsAbBaseCID.h"
#include "nsAddrDatabase.h"
#include "nsIAbMDBCard.h"
#include "nsIAbListener.h"
#include "nsIAddrBookSession.h"
#include "nsIAddressBook.h"
#include "nsIURL.h"
#include "nsNetCID.h"
#include "nsAbDirectoryQuery.h"
#include "nsIAbDirectoryQueryProxy.h"
#include "nsAbQueryStringToExpression.h"
#include "nsArrayEnumerator.h"
#include "nsAbMDBCardProperty.h"
#include "mdb.h"
#include "prprf.h"

Go to the source code of this file.

Functions

 NS_IMPL_ISUPPORTS_INHERITED4 (nsAbMDBDirectory, nsRDFResource, nsIAbDirectory, nsIAbMDBDirectory, nsIAbDirectorySearch, nsIAddrDBListener) nsresult nsAbMDBDirectory
 PR_STATIC_CALLBACK (PRBool) enumerateSearchCache(nsHashKey *aKey
array AppendElement (card)

Variables

voidaData
void void *closure
nsISupportsArray
array = (nsISupportsArray* )closure
nsIAbCardcard = (nsIAbCard* )aData
return PR_TRUE

Function Documentation

Here is the caller graph for this function:

Definition at line 82 of file nsAbMDBDirectory.cpp.

{
  nsresult rv = NS_OK;
  PRUint32 listTotal;
  PRInt32 i, j;

  // These checks ensure we don't run into null pointers
  // as we did when we caused bug 280463.
  if (!mDatabase)
  {
    rv = GetAbDatabase();
    NS_ENSURE_SUCCESS(rv, rv);
  }

  if (!m_AddressList)
  {
    rv = mDatabase->GetMailingListsFromDB(this);
    NS_ENSURE_SUCCESS(rv, rv);
    // Ensure that the previous call did set the address list pointer
    if (!m_AddressList)
      return NS_ERROR_NULL_POINTER;
  }

  rv = m_AddressList->Count(&listTotal);
  NS_ENSURE_SUCCESS(rv,rv);

  for (i = listTotal - 1; i >= 0; i--)
  {            
    nsCOMPtr<nsIAbDirectory> listDir(do_QueryElementAt(m_AddressList, i, &rv));
    if (listDir)
    {
      // First remove the instance in the database
      mDatabase->DeleteCardFromMailList(listDir, card, PR_FALSE);

      // Now remove the instance in any lists we hold.
      nsCOMPtr <nsISupportsArray> pAddressLists;
      listDir->GetAddressLists(getter_AddRefs(pAddressLists));
      if (pAddressLists)
      {  
        PRUint32 total;
        rv = pAddressLists->Count(&total);
        for (j = total - 1; j >= 0; j--)
        {
          nsCOMPtr<nsIAbCard> cardInList(do_QueryElementAt(pAddressLists, j, &rv));
          PRBool equals;
          nsresult rv = cardInList->Equals(card, &equals);  // should we checking email?
          if (NS_SUCCEEDED(rv) && equals) {
            pAddressLists->RemoveElementAt(j);
        }
      }
    }
  }
  }
  return NS_OK;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 381 of file nsAbMDBDirectory.cpp.

Definition at line 383 of file nsAbMDBDirectory.cpp.

Definition at line 384 of file nsAbMDBDirectory.cpp.

Definition at line 387 of file nsAbMDBDirectory.cpp.