From dcf35347af39f9ad0f31383fa97009dd649859cd Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Sun, 18 Jun 2000 05:45:19 +0000 Subject: [PATCH] further bring the searchsession and mailfilter apis together so that they can share code from JS - basically expose the search term as a readonly array, and reset it with Clear() rather than destroying it. r=sspitzer for #33101 git-svn-id: svn://10.0.0.236/trunk@72510 18797224-902f-48f8-a5cc-f745e15eee43 --- .../search/public/nsIMsgSearchSession.idl | 24 +++++++++---------- .../base/search/src/nsMsgSearchSession.cpp | 11 +++++---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/mozilla/mailnews/base/search/public/nsIMsgSearchSession.idl b/mozilla/mailnews/base/search/public/nsIMsgSearchSession.idl index a6a34d7404f..e97095d933e 100644 --- a/mozilla/mailnews/base/search/public/nsIMsgSearchSession.idl +++ b/mozilla/mailnews/base/search/public/nsIMsgSearchSession.idl @@ -45,29 +45,29 @@ interface nsIMsgSearchSession : nsISupports { in boolean BooleanAND, /* set to true if associated boolean operator is AND */ in string arbitraryHeader); /* user defined arbitrary header. ignored unless attrib = attribOtherHeader */ - void AddSearchTermArray (in nsISupportsArray searchTerms); + readonly attribute nsISupportsArray searchTerms; nsIMsgSearchTerm createTerm (); void appendTerm(in nsIMsgSearchTerm term); - void RegisterListener (in nsIMsgSearchNotify listener); - void UnregisterListener (in nsIMsgSearchNotify listener); + void registerListener (in nsIMsgSearchNotify listener); + void unregisterListener (in nsIMsgSearchNotify listener); readonly attribute unsigned long numSearchTerms; readonly attribute nsIMsgSearchAdapter runningAdapter; - void GetNthSearchTerm(in long whichTerm, + void getNthSearchTerm(in long whichTerm, in nsMsgSearchAttribValue attrib, in nsMsgSearchOpValue op, in nsIMsgSearchValue value); // wrong, should be out - long CountSearchScopes(); + long countSearchScopes(); - void GetNthSearchScope(in long which,out nsMsgSearchScopeValue scopeId, out nsIMsgFolder folder); + void getNthSearchScope(in long which,out nsMsgSearchScopeValue scopeId, out nsIMsgFolder folder); /* add a scope (e.g. a mail folder) to the search */ - void AddScopeTerm(in nsMsgSearchScopeValue attrib, + void addScopeTerm(in nsMsgSearchScopeValue attrib, in nsIMsgFolder folder); /* special cases for LDAP since LDAP isn't really a folderInfo */ @@ -88,16 +88,16 @@ interface nsIMsgSearchSession : nsISupports { /* add all scopes of a given type to the search */ void AddAllScopes(in nsMsgSearchScopeValue attrib); - void Search(in nsIMsgWindow aWindow); - void InterruptSearch(); + void search(in nsIMsgWindow aWindow); + void interruptSearch(); // these two methods are used when the search session is using // a timer to do local search, and the search adapter needs // to run a url (e.g., to reparse a local folder) and wants to // pause the timer while running the url. This will fail if the // current adapter is not using a timer. - void PauseSearch(); - void ResumeSearch(); + void pauseSearch(); + void resumeSearch(); [noscript] readonly attribute voidPtr searchParam; readonly attribute nsMsgSearchType searchType; @@ -107,7 +107,7 @@ interface nsIMsgSearchSession : nsISupports { [noscript] void AddResultElement(in nsMsgResultElement element); - void AddSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder); + void addSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder); readonly attribute long numResults; attribute nsIMsgWindow window; diff --git a/mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp b/mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp index e88485a1082..f4fe893041b 100644 --- a/mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgSearchSession.cpp @@ -45,6 +45,7 @@ nsMsgSearchSession::nsMsgSearchSession() m_handlingError = PR_FALSE; m_pSearchParam = nsnull; m_searchPaused = PR_FALSE; + NS_NewISupportsArray(getter_AddRefs(m_termList)); } @@ -81,10 +82,12 @@ nsMsgSearchSession::AppendTerm(nsIMsgSearchTerm *aTerm) } NS_IMETHODIMP -nsMsgSearchSession::AddSearchTermArray(nsISupportsArray *searchTerms) +nsMsgSearchSession::GetSearchTerms(nsISupportsArray **aResult) { - m_termList = searchTerms; - return NS_OK; + NS_ENSURE_ARG_POINTER(aResult); + *aResult = m_termList; + NS_ADDREF(*aResult); + return NS_OK; } NS_IMETHODIMP @@ -594,7 +597,7 @@ void nsMsgSearchSession::DestroyScopeList() void nsMsgSearchSession::DestroyTermList () { - m_termList = nsnull; // don't really need this now that caller owns term list. + m_termList->Clear(); } nsMsgSearchScopeTerm *nsMsgSearchSession::GetRunningScope()