Bug #162789 --> need a method on a mdb directory to see if a card exits for an address. this is part of the work

for adding the ability to filter and search based on the sender in an address book.
r=navin
sr=bienvenu
This commit is contained in:
mscott%netscape.com 2002-09-12 20:43:21 +00:00
Родитель f6ee8b02ea
Коммит f7150736db
4 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -84,4 +84,7 @@ interface nsIAbMDBDirectory : nsISupports {
[noscript] void notifyDirItemAdded(in nsISupports item);
[noscript] void clearDatabase();
// Check if the directory has a card for the specified email address
boolean hasCardForEmailAddress(in string emailAddress);
};

Просмотреть файл

@ -210,3 +210,7 @@ NS_IMETHODIMP nsAbMDBDirProperty::SetValueForCard(nsIAbCard *card, const char *n
return rv;
}
NS_IMETHODIMP nsAbMDBDirProperty::HasCardForEmailAddress(const char * aEmailAddress, PRBool * aCardExists)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -1010,3 +1010,19 @@ nsresult nsAbMDBDirectory::GetAbDatabase()
return NS_ERROR_NULL_POINTER;
return NS_OK;
}
NS_IMETHODIMP nsAbMDBDirectory::HasCardForEmailAddress(const char * aEmailAddress, PRBool * aCardExists)
{
nsresult rv = NS_OK;
*aCardExists = PR_FALSE;
if (!mDatabase)
rv = GetAbDatabase();
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAbCard> cardExists;
mDatabase->GetCardFromAttribute(this, kPriEmailColumn, aEmailAddress, PR_FALSE /* retain case */, getter_AddRefs(cardExists));
if (cardExists)
*aCardExists = PR_TRUE;
return NS_OK;
}

Просмотреть файл

@ -83,6 +83,7 @@ public:
NS_IMETHOD RemoveEmailAddressAt(PRUint32 aIndex);
NS_IMETHOD AddDirectory(const char *uriName, nsIAbDirectory **childDir);
NS_IMETHOD GetDirUri(char **uri);
NS_IMETHOD HasCardForEmailAddress(const char * aEmailAddress, PRBool * aCardExists);
// nsIAbDirectory methods:
NS_IMETHOD GetChildNodes(nsIEnumerator* *result);