prefValues[1] = nsCRT::strdup(temp.GetUnicode());
prefValues[1] = nsCRT::strdup(temp.get());
nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew){	nsresult			rv = NS_OK;	if (!makeNew) {		// FIXME: How do I get the list of address books and look for a		// specific name.  Major bogosity!		// For now, assume we didn't find anything with that name	}		IMPORT_LOG0( "In GetAddressBook\n");	NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);	if (NS_FAILED( rv)) {		IMPORT_LOG0( "*** Error: Unable to get proxy manager\n");		return( nsnull);	}	nsIAddrDatabase *	pDatabase = nsnull;	/* Get the profile directory */	// Note to Candice: This should return an nsIFileSpec, not a nsFileSpec	nsFileSpec *					dbPath = nsnull;	NS_WITH_PROXIED_SERVICE(nsIAddrBookSession, abSession, kAddrBookSessionCID, NS_UI_THREAD_EVENTQ, &rv); 		if (NS_SUCCEEDED(rv))		abSession->GetUserProfileDirectory(&dbPath);	if (dbPath) {		// Create a new address book file - we don't care what the file		// name is, as long as it's unique		(*dbPath) += "impab.mab";		(*dbPath).MakeUnique();				IMPORT_LOG0( "Getting the address database factory\n");		NS_WITH_PROXIED_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, NS_UI_THREAD_EVENTQ, &rv);		if (NS_SUCCEEDED(rv) && addrDBFactory) {						IMPORT_LOG0( "Opening the new address book\n");			rv = addrDBFactory->Open( dbPath, PR_TRUE, &pDatabase, PR_TRUE);		}	}	else {		IMPORT_LOG0( "Failed to get the user profile directory from the address book session\n");	}		if (pDatabase) {		// We made a database, add it to the UI?!?!?!?!?!?!		// This is major bogosity again!  Why doesn't the address book		// just handle this properly for me?  Uggggg...				NS_WITH_PROXIED_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, NS_UI_THREAD_EVENTQ, &rv);		if (NS_SUCCEEDED(rv)) {			nsCOMPtr<nsIRDFResource>	parentResource;			char *parentUri = PR_smprintf( "%s", kAllDirectoryRoot);			rv = rdfService->GetResource( parentUri, getter_AddRefs(parentResource));			nsCOMPtr<nsIAbDirectory> parentDir;			rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),										parentResource, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( parentDir));			if (parentUri)				PR_smprintf_free(parentUri);			if (parentDir)		       	{				PRUint32 prefCount = 2;				char **prefNames = (char **) nsMemory::Alloc(prefCount * (sizeof (char *)));				if (!prefNames)					return nsnull;				PRUnichar ** prefValues = (PRUnichar **) nsMemory::Alloc(prefCount * (sizeof(PRUnichar *)));				if (!prefValues)					return nsnull;									prefNames[0] = PR_smprintf("description");				prefNames[1] = PR_smprintf("fileName");									prefValues[0] = (PRUnichar *)name;					char *fileName = (*dbPath).GetLeafName();				PRInt32 descLength = PL_strlen(fileName);				NS_ConvertUTF8toUCS2 temp((const char *)fileName, descLength);				prefValues[1] = nsCRT::strdup(temp.GetUnicode());				parentDir->CreateNewDirectory((unsigned int )prefCount, (const char** )prefNames, (const PRUnichar** )prefValues);          delete dbPath;				if (fileName)					nsCRT::free(fileName);				if (prefNames[0])					PR_smprintf_free(prefNames[0]);				if (prefNames[1])					PR_smprintf_free(prefNames[1]);				if (prefNames)					nsMemory::Free(prefNames);				if (prefValues)					nsMemory::Free(prefValues);							}			IMPORT_LOG0( "Added new address book to the UI\n");		}	}		return( pDatabase);}