further updates to the datasource to allow it to answer more questions

not part of build
This commit is contained in:
alecf%netscape.com 2000-04-18 08:05:39 +00:00
Родитель 04b44006ee
Коммит 487c403462
3 изменённых файлов: 53 добавлений и 7 удалений

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

@ -42,9 +42,14 @@ nsCOMPtr<nsISupportsArray> nsMsgFilterDataSource::mFilterArcsOut;
nsMsgFilterDataSource::nsMsgFilterDataSource()
{
NS_INIT_ISUPPORTS();
if (mGlobalRefCount == 0)
initGlobalObjects(getRDFService());
#ifdef DEBUG_alecf
printf("nsMsgFilterDataSource::nsMsgFilterDataSource()\n");
#endif
mGlobalRefCount++;
/* member initializers and constructor code */
}
@ -87,6 +92,18 @@ nsMsgFilterDataSource::GetTargets(nsIRDFResource *aSource,
PRBool aTruthValue,
nsISimpleEnumerator **aResult)
{
#ifdef DEBUG_alecf
nsXPIDLCString source;
aSource->GetValue(getter_Copies(source));
nsXPIDLCString property;
aProperty->GetValue(getter_Copies(property));
printf("nsMsgFilterDataSource::GetTargets(%s, %s, %s..);\n",
(const char*)source,
(const char*)property, aTruthValue ? "TRUE" : "FALSE");
#endif
nsresult rv;
nsCOMPtr<nsIMsgFilterList> filterList;
@ -100,12 +117,9 @@ nsMsgFilterDataSource::GetTargets(nsIRDFResource *aSource,
rv = getFilterListTargets(filterList, aSource, aProperty,
aTruthValue, resourceList);
else {
// maybe it's just a filter
nsCOMPtr<nsIMsgFilter> filter;
rv = aSource->GetDelegate("filter", NS_GET_IID(nsIMsgFilter),
(void **)getter_AddRefs(filter));
if (NS_SUCCEEDED(rv))
rv = getFilterTargets(filter, aProperty, aTruthValue, resourceList);
// maybe it's a filter?
// not sure if RDF will ask us or not.
NS_WARNING("nsMsgFilterDataSource: Filters don't have multiple targets");
}
nsArrayEnumerator *cursor = new nsArrayEnumerator(resourceList);
@ -117,6 +131,17 @@ nsMsgFilterDataSource::GetTargets(nsIRDFResource *aSource,
return NS_OK;
}
NS_IMETHODIMP
nsMsgFilterDataSource::GetTarget(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
PRBool aTruthValue,
nsIRDFNode **aResult)
{
*aResult = nsnull;
return NS_RDF_NO_VALUE;
}
NS_IMETHODIMP
nsMsgFilterDataSource::ArcLabelsOut(nsIRDFResource *aSource,

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

@ -42,6 +42,12 @@ public:
nsIRDFResource *property,
PRBool aTruthValue,
nsISimpleEnumerator **_retval);
NS_IMETHOD GetTarget(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
PRBool aTruthValue,
nsIRDFNode **aResult);
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source,
nsISimpleEnumerator **_retval);

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

@ -56,18 +56,33 @@ NS_IMETHODIMP nsMsgFilterDelegateFactory::CreateDelegate(nsIRDFResource *aOuter,
// otherwise make sure it's in the form
// mailbox://userid@server/foldername#filter4
#ifdef DEBUG_alecf
nsXPIDLCString outerValue;
aOuter->GetValue(getter_Copies(outerValue));
printf("nsMsgFilterDelegateFactory::CreateDelegate(%s, %s, ..)\n",
outerValue, aKey);
#endif
*aResult = nsnull;
nsresult rv;
if (aIID.Equals(NS_GET_IID(nsIMsgFilterList))) {
nsIMsgFilterList *filterList;
rv = getFilterListDelegate(aOuter, &filterList);
#ifdef DEBUG_alecf
if (NS_SUCCEEDED(rv))
printf(" creating nsIMsgFilterList delegate\n");
#endif
if (NS_SUCCEEDED(rv))
*aResult = (void *)filterList;
} else if (aIID.Equals(NS_GET_IID(nsIMsgFilter))) {
nsIMsgFilter *filter;
rv = getFilterDelegate(aOuter, &filter);
#ifdef DEBUG_alecf
if (NS_SUCCEEDED(rv))
printf(" creating nsIMsgFilter delegate\n");
#endif
if (NS_SUCCEEDED(rv))
*aResult = (void *)filter;
}