1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1999
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38
39 #include "nsISupports.idl"
40 #include "nsMsgFilterCore.idl"
41 #include "nsIMsgSearchScopeTerm.idl"
42 #include "nsIMsgSearchValue.idl"
43 #include "nsIMsgSearchTerm.idl"
44 #include "nsISupportsArray.idl"
45
46 interface nsOutputStream;
47
48 [scriptable, uuid(FFC5D40D-7527-4286-9765-136617D32624)]
49 interface nsIMsgRuleAction : nsISupports {
50
51 attribute nsMsgRuleActionType type;
52
53 // target priority.. throws an exception if the action is not priority
54 attribute nsMsgPriorityValue priority;
55
56 // target folder.. throws an exception if the action is not move to folder
57 attribute ACString targetFolderUri;
58
59 // target label. throws an exception if the action is not label
60 attribute nsMsgLabelValue label;
61
62 attribute long junkScore;
63
64 attribute ACString strValue;
65
66 };
67
68 [scriptable, uuid(346C8CC6-35EA-4F44-B348-94E84D7C03E0)]
69 interface nsIMsgFilter : nsISupports {
70 attribute nsMsgFilterTypeType filterType;
71 /**
72 * some filters are "temporary". For example, the filters we create when the user
73 * filters return receipts to the Sent folder.
74 * we don't show temporary filters in the UI
75 * and we don't write them to disk.
76 */
77 attribute boolean temporary;
78 attribute boolean enabled;
79 attribute AString filterName;
80 attribute ACString filterDesc;
81 attribute ACString unparsedBuffer; //holds the entire filter if we don't know how to handle it
82 attribute boolean unparseable; //whether we could parse the filter or not
83
84 readonly attribute nsIMsgFilterList filterList; // owning filter list
85
86 void AddTerm(in nsMsgSearchAttribValue attrib,
87 in nsMsgSearchOpValue op,
88 in nsIMsgSearchValue value,
89 in boolean BooleanAND,
90 in ACString arbitraryHeader);
91
92 void GetTerm(in long termIndex,
93 out nsMsgSearchAttribValue attrib,
94 out nsMsgSearchOpValue op,
95 out nsIMsgSearchValue value, // bad! using shared structure
96 out boolean BooleanAND,
97 out ACString arbitraryHeader);
98
99 void appendTerm(in nsIMsgSearchTerm term);
100
101 nsIMsgSearchTerm createTerm();
102
103 attribute nsISupportsArray searchTerms;
104
105 attribute nsIMsgSearchScopeTerm scope;
106
107 // marking noscript because "headers" is actually a null-separated
108 // list of headers, which is not scriptable
109 [noscript] void MatchHdr(in nsIMsgDBHdr msgHdr, in nsIMsgFolder folder,
110 in nsIMsgDatabase db,
111 in string headers,
112 // [array, size_is(headerSize)] in string headers,
113 in unsigned long headerSize, out boolean result);
114
115 void logRuleHit(in nsIMsgRuleAction aFilterAction, in nsIMsgDBHdr aHeader);
116 nsIMsgRuleAction createAction();
117
118 nsIMsgRuleAction getActionAt(in long aIndex);
119
120 void appendAction(in nsIMsgRuleAction action);
121
122 void clearActionList();
123 void getSortedActionList(in nsISupportsArray actionList); //will return an action list with moveAction (if present) as last one.
124 readonly attribute nsISupportsArray actionList;
125 };