diff --git a/mailnews/base/search/src/nsMsgFilterDataSource.cpp b/mailnews/base/search/src/nsMsgFilterDataSource.cpp index 2bee88c82079..51ca569396e8 100644 --- a/mailnews/base/search/src/nsMsgFilterDataSource.cpp +++ b/mailnews/base/search/src/nsMsgFilterDataSource.cpp @@ -42,9 +42,14 @@ nsCOMPtr 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 filterList; @@ -100,12 +117,9 @@ nsMsgFilterDataSource::GetTargets(nsIRDFResource *aSource, rv = getFilterListTargets(filterList, aSource, aProperty, aTruthValue, resourceList); else { - // maybe it's just a filter - nsCOMPtr 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, diff --git a/mailnews/base/search/src/nsMsgFilterDataSource.h b/mailnews/base/search/src/nsMsgFilterDataSource.h index 2ed91cae120e..fd93d9ff9657 100644 --- a/mailnews/base/search/src/nsMsgFilterDataSource.h +++ b/mailnews/base/search/src/nsMsgFilterDataSource.h @@ -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); diff --git a/mailnews/base/search/src/nsMsgFilterDelegateFactory.cpp b/mailnews/base/search/src/nsMsgFilterDelegateFactory.cpp index c87d9163a971..e10a1b8dcdaa 100644 --- a/mailnews/base/search/src/nsMsgFilterDelegateFactory.cpp +++ b/mailnews/base/search/src/nsMsgFilterDelegateFactory.cpp @@ -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; }