mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 03:49:37 +00:00
initial entry into cvs of searching and filter interfaces, not part of build
This commit is contained in:
parent
dbadca0a8d
commit
9fedeebda9
58
mailnews/base/search/public/nsIMsgFilterList.h
Normal file
58
mailnews/base/search/public/nsIMsgFilterList.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _nsMsgFilterList_H_
|
||||
#define _nsMsgFilterList_H_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The Msg Filter List is an interface designed to make accessing filter lists
|
||||
// easier. Clients typically open a filter list and either enumerate the filters,
|
||||
// or add new filters, or change the order around...
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class nsIMsgFilterList : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMSGFILTERLIST_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetFolderForFilterList(nsIMsgFolder **aFolder);
|
||||
NS_IMETHOD GetFilterCount(PRInt32 *pCount);
|
||||
NS_IMETHOD GetFilterAt(nsMsgFilterIndex filterIndex, nsIMsgFilter **filter);
|
||||
/* these methods don't delete filters - they just change the list. FE still must
|
||||
call MSG_DestroyFilter to delete a filter.
|
||||
*/
|
||||
NS_IMETHOD SetFilterAt(nsMsgFilterIndex filterIndex, nsIMsgFilter *filter);
|
||||
NS_IMETHOD RemoveFilterAt(nsMsgFilterIndex filterIndex);
|
||||
NS_IMETHOD MoveFilterAt(nsMsgFilterIndex filterIndex, nsMsgFilterMotion motion);
|
||||
NS_IMETHOD InsertFilterAt(nsMsgFilterIndex filterIndex, nsMsgFilter *filter);
|
||||
|
||||
NS_IMETHOD EnableLogging(PRBool enable);
|
||||
NS_IMETHOD IsLoggingEnabled(PRBool *aResult);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
151
mailnews/base/search/public/nsIMsgFilterService.h
Normal file
151
mailnews/base/search/public/nsIMsgFilterService.h
Normal file
@ -0,0 +1,151 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _nsMsgFilterService_H_
|
||||
#define _nsMsgFilterService_H_
|
||||
|
||||
|
||||
|
||||
/* Front ends call MSG_OpenFilterList to get a handle to a FilterList, of existing nsMsgFilter *.
|
||||
These are manipulated by the front ends as a result of user interaction
|
||||
with dialog boxes. To apply the new list, fe's call MSG_CloseFilterList.
|
||||
|
||||
For example, if the user brings up the rule management UI, deletes a rule,
|
||||
and presses OK, the front end calls MSG_RemoveFilterListAt, and
|
||||
then MSG_CloseFilterList.
|
||||
|
||||
*/
|
||||
nsMsgFilterError MSG_OpenFilterList(nsMsgFilterType type, nsIMsgFilterList **filterList);
|
||||
nsMsgFilterError MSG_OpenFolderFilterList(MSG_Pane *pane, MSG_FolderInfo *folder, nsMsgFilterType type, nsMsgFilterList **filterList);
|
||||
nsMsgFilterError MSG_OpenFolderFilterListFromMaster(MSG_Master *master, MSG_FolderInfo *folder, nsMsgFilterType type, nsMsgFilterList **filterList);
|
||||
nsMsgFilterError MSG_CloseFilterList(nsMsgFilterList *filterList);
|
||||
nsMsgFilterError MSG_SaveFilterList(nsMsgFilterList *filterList); /* save without deleting */
|
||||
nsMsgFilterError MSG_CancelFilterList(nsMsgFilterList *filterList);
|
||||
|
||||
MSG_FolderInfo *MSG_GetFolderInfoForFilterList(nsMsgFilterList *filterList);
|
||||
nsMsgFilterError MSG_GetFilterCount(nsMsgFilterList *filterList, int32 *pCount);
|
||||
nsMsgFilterError MSG_GetFilterAt(nsMsgFilterList *filterList,
|
||||
nsMsgFilterIndex filterIndex, nsMsgFilter **filter);
|
||||
/* these methods don't delete filters - they just change the list. FE still must
|
||||
call MSG_DestroyFilter to delete a filter.
|
||||
*/
|
||||
nsMsgFilterError MSG_SetFilterAt(nsMsgFilterList *filterList,
|
||||
nsMsgFilterIndex filterIndex, nsMsgFilter *filter);
|
||||
nsMsgFilterError MSG_RemoveFilterAt(nsMsgFilterList *filterList,
|
||||
nsMsgFilterIndex filterIndex);
|
||||
nsMsgFilterError MSG_MoveFilterAt(nsMsgFilterList *filterList,
|
||||
nsMsgFilterIndex filterIndex, nsMsgFilterMotion motion);
|
||||
nsMsgFilterError MSG_InsertFilterAt(nsMsgFilterList *filterList,
|
||||
nsMsgFilterIndex filterIndex, nsMsgFilter *filter);
|
||||
|
||||
nsMsgFilterError MSG_EnableLogging(nsMsgFilterList *filterList, XP_Bool enable);
|
||||
XP_Bool MSG_IsLoggingEnabled(nsMsgFilterList *filterList);
|
||||
|
||||
/* In general, any data gotten with MSG_*Get is good until the owning object
|
||||
is deleted, or the data is replaced with a MSG_*Set call. For example, the name
|
||||
returned in MSG_GetFilterName is valid until either the filter is destroyed,
|
||||
or MSG_SetFilterName is called on the same filter.
|
||||
*/
|
||||
nsMsgFilterError MSG_CreateFilter (nsMsgFilterType type, char *name, nsMsgFilter **result);
|
||||
nsMsgFilterError MSG_DestroyFilter(nsMsgFilter *filter);
|
||||
nsMsgFilterError MSG_GetFilterType(nsMsgFilter *, nsMsgFilterType *filterType);
|
||||
nsMsgFilterError MSG_EnableFilter(nsMsgFilter *, XP_Bool enable);
|
||||
nsMsgFilterError MSG_IsFilterEnabled(nsMsgFilter *, XP_Bool *enabled);
|
||||
nsMsgFilterError MSG_GetFilterRule(nsMsgFilter *, MSG_Rule ** result);
|
||||
nsMsgFilterError MSG_GetFilterName(nsMsgFilter *, char **name);
|
||||
nsMsgFilterError MSG_SetFilterName(nsMsgFilter *, const char *name);
|
||||
nsMsgFilterError MSG_GetFilterDesc(nsMsgFilter *, char **description);
|
||||
nsMsgFilterError MSG_SetFilterDesc(nsMsgFilter*, const char *description);
|
||||
nsMsgFilterError MSG_GetFilterScript(nsMsgFilter *, char **name);
|
||||
nsMsgFilterError MSG_SetFilterScript(nsMsgFilter *, const char *name);
|
||||
|
||||
nsMsgFilterError MSG_RuleAddTerm(MSG_Rule *,
|
||||
MSG_SearchAttribute attrib, /* attribute for this term */
|
||||
MSG_SearchOperator op, /* operator e.g. opContains */
|
||||
MSG_SearchValue *value, /* value e.g. "Dogbert" */
|
||||
XP_Bool BooleanAND, /* TRUE if AND is the boolean operator. FALSE if OR is the boolean operators */
|
||||
char * arbitraryHeader); /* arbitrary header specified by user. ignored unless attrib = attribOtherHeader */
|
||||
|
||||
nsMsgFilterError MSG_RuleGetNumTerms(MSG_Rule *, int32 *numTerms);
|
||||
|
||||
nsMsgFilterError MSG_RuleGetTerm(MSG_Rule *, int32 termIndex,
|
||||
MSG_SearchAttribute *attrib, /* attribute for this term */
|
||||
MSG_SearchOperator *op, /* operator e.g. opContains */
|
||||
MSG_SearchValue *value, /* value e.g. "Dogbert" */
|
||||
XP_Bool *BooleanAnd, /* TRUE if AND is the boolean operator. FALSE if OR is the boolean operator */
|
||||
char ** arbitraryHeader); /* arbitrary header specified by user. ignore unless attrib = attribOtherHeader */
|
||||
|
||||
nsMsgFilterError MSG_RuleSetScope(MSG_Rule *, MSG_ScopeTerm *scope);
|
||||
nsMsgFilterError MSG_RuleGetScope(MSG_Rule *, MSG_ScopeTerm **scope);
|
||||
|
||||
/* if type is acChangePriority, value is a pointer to priority.
|
||||
If type is acMoveToFolder, value is pointer to folder name.
|
||||
Otherwise, value is ignored.
|
||||
*/
|
||||
nsMsgFilterError MSG_RuleSetAction(MSG_Rule *, MSG_RuleActionType type, void *value);
|
||||
nsMsgFilterError MSG_RuleGetAction(MSG_Rule *, MSG_RuleActionType *type, void **value);
|
||||
|
||||
/* help FEs manage menu choices in Filter dialog box */
|
||||
|
||||
/* Use this to help build menus in the filter dialogs. See APIs below */
|
||||
typedef struct MSG_RuleMenuItem
|
||||
{
|
||||
int16 attrib;
|
||||
char name[32];
|
||||
} MSG_RuleMenuItem;
|
||||
|
||||
|
||||
nsMsgFilterError MSG_GetRuleActionMenuItems (
|
||||
nsMsgFilterType type, /* type of filter */
|
||||
MSG_RuleMenuItem *items, /* array of caller-allocated structs */
|
||||
uint16 *maxItems); /* in- max array size; out- num returned */
|
||||
|
||||
nsMsgFilterError MSG_GetFilterWidgetForAction( MSG_RuleActionType action,
|
||||
MSG_SearchValueWidget *widget );
|
||||
|
||||
MSG_SearchError MSG_GetValuesForAction( MSG_RuleActionType action,
|
||||
MSG_SearchMenuItem *items,
|
||||
uint16 *maxItems);
|
||||
|
||||
void MSG_ViewFilterLog(MSG_Pane *pane);
|
||||
|
||||
/*
|
||||
** Adding/editting javascript filters.
|
||||
**
|
||||
** The FE calls one of the below functions, along with a callback and some closure
|
||||
** data. This callback is invoked when the user clicks OK in the JS filter dialog.
|
||||
** If CANCEL is pressed, the callback is not invoked.
|
||||
**
|
||||
** If the user called MSG_EditJSFilter, the filter_index parameter of the callback
|
||||
** is the same one passed in. If the user called MSG_NewJSFilter, the filter_index
|
||||
** parameter is -1.
|
||||
**
|
||||
** The filter_changed parameter is TRUE if the user modified any of the fields of
|
||||
** the javascript filter, and FALSE otherwise.
|
||||
*/
|
||||
typedef void (*JSFilterCallback)(void* arg, nsMsgFilterIndex filter_index, XP_Bool filter_changed);
|
||||
|
||||
void MSG_EditJSFilter(MWContext *context, nsMsgFilterList *filter_list,
|
||||
nsMsgFilterIndex filter_index,
|
||||
JSFilterCallback cb, void *arg);
|
||||
void MSG_NewJSFilter(MWContext *context, nsMsgFilterList *filter_list,
|
||||
nsMsgFilterType filter_type, JSFilterCallback cb, void *arg);
|
||||
|
||||
|
||||
#endif // _nsMsgFilterService_H_
|
||||
|
102
mailnews/base/search/public/nsIMsgSearchSession.h
Normal file
102
mailnews/base/search/public/nsIMsgSearchSession.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIMsgSearchSession_h___
|
||||
#define nsIMsgSearchSession_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIMsgFolder;
|
||||
|
||||
/* a819050a-0302-11d3-a50a-0060b0fc04b7 */
|
||||
#define NS_IMSGSEARCHSESSION_IID \
|
||||
{ 0xa819050a, 0x0302, 0x11d3, \
|
||||
{ 0xa5, 0x0a, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 } }
|
||||
|
||||
/* e9a7cd70-0303-11d3-a50a-0060b0fc04b7 */
|
||||
#define NS_IMSGSEARCHSESSION_CID \
|
||||
{ 0xe9a7cd70, 0x0303, 0x11d3, \
|
||||
{ 0xa5, 0x0a, 0x0, 0x60, 0xb0, 0xfc, 0x04, 0xb7 } }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The Msg Search Session is an interface designed to make constructing searches
|
||||
// easier. Clients typically build up search terms, and then run the search
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class nsIMsgSearchService : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMSGSEARCHSESSION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD AddSearchTerm (nsMsgSearchAttribute attrib, /* attribute for this term */
|
||||
nsMsgSearchOperator op, /* operator e.g. opContains */
|
||||
nsMsgSearchValue *value, /* value e.g. "Dogbert" */
|
||||
PRBool BooleanAND, /* set to true if associated boolean operator is AND */
|
||||
char * arbitraryHeader) = 0; /* user defined arbitrary header. ignored unless attrib = attribOtherHeader */
|
||||
|
||||
NS_IMETHOD CountSearchTerms (PRInt32 *numTerms) = 0;
|
||||
|
||||
NS_IMETHOD GetNthSearchTerm (PRInt32 whichTerm, nsMsgSearchAttribute *attrib,
|
||||
nsMsgSearchOperator *op, nsMsgSearchValue *value) = 0;
|
||||
|
||||
NS_IMETHOD MSG_CountSearchScopes (PRInt32 *numScopes) = 0;
|
||||
|
||||
NS_IMETHOD MSG_GetNthSearchScope (
|
||||
PRInt32 which,
|
||||
nsMsgScopeAttribute *scopeId,
|
||||
void **scope) = 0;
|
||||
|
||||
/* add a scope (e.g. a mail folder) to the search */
|
||||
NS_IMETHOD AddScopeTerm (
|
||||
nsMsgScopeAttribute attrib, /* what kind of scope term is this */
|
||||
nsIMsgFolder *folder) = 0; /* which folder to search */
|
||||
|
||||
/* special cases for LDAP since LDAP isn't really a folderInfo */
|
||||
NS_IMETHOD AddLdapScope (nsMsgDIRServer *server) = 0;
|
||||
//NS_IMETHOD AddAllLdapScopes (XP_List *dirServerList);
|
||||
|
||||
/* Call this function everytime the scope changes! It informs the FE if
|
||||
the current scope support custom header use. FEs should not display the
|
||||
custom header dialog if custom headers are not supported */
|
||||
|
||||
NS_IMETHOD ScopeUsesCustomHeaders(nsMsgScopeAttribute scope,
|
||||
void * selection, /* could be a folder or server based on scope */
|
||||
PRBool forFilters, PRBool *result) = 0;
|
||||
|
||||
NS_IMETHOD IsStringAttribute( /* use this to determine if your attribute is a string attrib */
|
||||
nsMsgSearchAttribute attrib, PRBool *aResult) = 0;
|
||||
|
||||
/* add all scopes of a given type to the search */
|
||||
NS_IMETHOD AddAllScopes (nsMsgScopeAttribute attrib) = 0; /* what kind of scopes to add */
|
||||
|
||||
/* begin execution of the search */
|
||||
NS_IMETHOD Search (void) = 0;
|
||||
NS_IMETHOD InterruptSearch (void) = 0;
|
||||
NS_IMETHOD GetSearchParam (void **aParam) = 0;
|
||||
NS_IMETHOD GetSearchType (nsMsgSearchType *aResult) = 0;
|
||||
NS_IMETHOD SetSearchParam (nsMsgSearchType type, /* type of specialized search to perform */
|
||||
void *param) = 0; /* extended search parameter */
|
||||
NS_IMETHOD GetNumResults (PRUint32 *numResults) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
63
mailnews/base/search/public/nsMsgFilterCore.h
Normal file
63
mailnews/base/search/public/nsMsgFilterCore.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _nsMsgFilterCore_H_
|
||||
#define _nsMsgFilterCore_H_
|
||||
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsString2.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
nsMsgFilterActionNone, /* uninitialized state */
|
||||
nsMsgFilterActionMoveToFolder,
|
||||
nsMsgFilterActionChangePriority,
|
||||
nsMsgFilterActionDelete,
|
||||
nsMsgFilterActionMarkRead,
|
||||
nsMsgFilterActionKillThread,
|
||||
nsMsgFilterActionWatchThread
|
||||
} nsMsgRuleActionType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
nsMsgFilterInboxRule = 0x1,
|
||||
nsMsgFilterInboxJavaScript = 0x2,
|
||||
nsMsgFilterInbox = 0x3,
|
||||
nsMsgFilterNewsRule = 0x4,
|
||||
nsMsgFilterNewsJavaScript = 0x8,
|
||||
nsMsgFilterNews=0xb,
|
||||
nsMsgFilterAll=0xf
|
||||
} nsMsgFilterType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
nsMsgFilterUp,
|
||||
nsMsgFilterDown
|
||||
} nsMsgFilterMotion;
|
||||
|
||||
typedef PRInt32 nsMsgFilterIndex;
|
||||
|
||||
// shouldn't need these...probably should be interfaces.
|
||||
struct nsMsgFilter;
|
||||
struct nsMsgRule;
|
||||
struct nsMsgRuleAction;
|
||||
struct nsMsgFilterList;
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user