Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgSearchSession.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsISupports.idl"
00039 #include "nsMsgSearchCore.idl"
00040 #include "nsIMsgSearchValue.idl"
00041 
00042 interface nsMsgResultElement;
00043 interface nsIMsgSearchAdapter;
00044 interface nsIMsgSearchTerm;
00045 interface nsIMsgSearchNotify;
00046 interface nsIMsgHdr;
00047 interface nsIMsgDatabase;
00048 
00050 // The Msg Search Session is an interface designed to make constructing
00051 // searches easier. Clients typically build up search terms, and then run
00052 // the search
00054 
00055 [scriptable, uuid(a819050a-0302-11d3-a50a-0060b0fc04b7)]
00056 interface nsIMsgSearchSession :  nsISupports {
00057 
00058     void addSearchTerm(in nsMsgSearchAttribValue attrib, /* attribute for this term */
00059                        in nsMsgSearchOpValue op,/* operator e.g. opContains */
00060                        in nsIMsgSearchValue value, /* value e.g. "Dogbert" */
00061                        in boolean BooleanAND, /* set to true if associated boolean operator is AND */
00062                        in string arbitraryHeader); /* user defined arbitrary header. ignored unless attrib = attribOtherHeader */
00063 
00064     readonly attribute nsISupportsArray searchTerms;
00065 
00066        nsIMsgSearchTerm createTerm ();
00067     void appendTerm(in nsIMsgSearchTerm term);
00068 
00069        void registerListener (in nsIMsgSearchNotify listener);
00070        void unregisterListener (in nsIMsgSearchNotify listener);
00071 
00072     readonly attribute unsigned long numSearchTerms;
00073 
00074        readonly attribute nsIMsgSearchAdapter runningAdapter;
00075 
00076     void getNthSearchTerm(in long whichTerm,
00077                           in nsMsgSearchAttribValue attrib,
00078                           in nsMsgSearchOpValue op,
00079                           in nsIMsgSearchValue value); // wrong, should be out
00080 
00081     long countSearchScopes();
00082 
00083     void getNthSearchScope(in long which,out nsMsgSearchScopeValue scopeId, out nsIMsgFolder folder);
00084 
00085        /* add a scope (e.g. a mail folder) to the search */
00086     void addScopeTerm(in nsMsgSearchScopeValue scope,
00087                       in nsIMsgFolder folder);
00088 
00089     void addDirectoryScopeTerm(in nsMsgSearchScopeValue scope);
00090 
00091     void clearScopes();
00092 
00093     /* Call this function everytime the scope changes! It informs the FE if 
00094        the current scope support custom header use. FEs should not display the
00095        custom header dialog if custom headers are not supported */
00096     [noscript] boolean ScopeUsesCustomHeaders(in nsMsgSearchScopeValue scope,
00097                                    /* could be a folder or server based on scope */
00098                                    in voidPtr selection,
00099                                    in boolean forFilters);
00100 
00101     /* use this to determine if your attribute is a string attrib */
00102     boolean IsStringAttribute(in nsMsgSearchAttribValue attrib);
00103 
00104     /* add all scopes of a given type to the search */
00105     void AddAllScopes(in nsMsgSearchScopeValue attrib);
00106     
00107     void search(in nsIMsgWindow aWindow);
00108     void interruptSearch();
00109 
00110        // these two methods are used when the search session is using
00111        // a timer to do local search, and the search adapter needs
00112        // to run a url (e.g., to reparse a local folder) and wants to
00113        // pause the timer while running the url. This will fail if the
00114        // current adapter is not using a timer.
00115     void pauseSearch();
00116        void resumeSearch();
00117 
00118     [noscript] readonly attribute voidPtr searchParam;
00119     readonly attribute nsMsgSearchType searchType;
00120     
00121     [noscript] nsMsgSearchType SetSearchParam(in nsMsgSearchType type,
00122                                               in voidPtr param);
00123 
00124        [noscript] void AddResultElement(in nsMsgResultElement element);
00125   boolean MatchHdr(in nsIMsgDBHdr aMsgHdr, in nsIMsgDatabase aDatabase);
00126 
00127        void addSearchHit(in nsIMsgDBHdr header, in nsIMsgFolder folder);
00128 
00129     readonly attribute long numResults;
00130        attribute nsIMsgWindow window;
00131     
00132     /* these longs are all actually of type nsMsgSearchBooleanOp */
00133     const long BooleanOR=0;
00134     const long BooleanAND=1;
00135 };