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
This commit is contained in:
alecf%netscape.com
2000-06-18 05:45:19 +00:00
parent c839a774fa
commit dcf35347af
2 changed files with 19 additions and 16 deletions

View File

@@ -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;

View File

@@ -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()