1#
2# Mailagent rules for filter regression tests
3#
4
5# $Id: rules,v 3.0.1.5 2001/03/17 18:16:21 ram Exp ram $
6#
7#  Copyright (c) 1990-2006, Raphael Manfredi
8#
9#  You may redistribute only under the terms of the Artistic License,
10#  as specified in the README file that comes with the distribution.
11#  You may reuse parts of this distribution only within the terms of
12#  that same Artistic License; a copy of which may be found at the root
13#  of the source tree for mailagent 3.0.
14#
15# $Log: rules,v $
16# Revision 3.0.1.5  2001/03/17 18:16:21  ram
17# patch72: added new filter/address tests
18#
19# Revision 3.0.1.4  1999/07/12  13:58:02  ram
20# patch66: fixed wrong semantics for <2>, and rewrote tests accordingly
21#
22# Revision 3.0.1.3  1996/12/24  15:03:48  ram
23# patch45: added test cases for new Relayed selector
24#
25# Revision 3.0.1.2  1994/07/01  15:12:23  ram
26# patch8: added test rules for macro substitution in patterns
27#
28# Revision 3.0.1.1  1994/04/25  15:26:12  ram
29# patch7: added three more tests in filter/group
30#
31# Revision 3.0  1993/11/29  13:50:27  ram
32# Baseline for mailagent 3.0 netwide release.
33#
34
35maildir = ~;
36mailfilter = ~;
37
38Subject: /test/		{ DELETE };
39
40# filter/address
41X-Tag: /address #1/				{ BEGIN ADDR; REJECT };
42<ADDR> To: ram					{ SAVE ok.1; REJECT };
43<ADDR> To: ramx					{ SAVE bad.1; REJECT };
44<ADDR> To: am					{ SAVE bad.2; REJECT };
45<ADDR> To: /^ram@/				{ SAVE ok.2; REJECT };
46<ADDR> To: ram@eiffel.com		{ SAVE ok.3; REJECT };
47<ADDR> To: am@eiffel.com		{ SAVE bad.3; REJECT };
48<ADDR> To: xram@eiffel.com		{ SAVE bad.4; REJECT };
49<ADDR> To: ramx@eiffel.com		{ SAVE bad.5; REJECT };
50<ADDR> To: RAM@eiffel.COM		{ SAVE ok.4; REJECT };
51<ADDR> To: ram@eiffe..com		{ SAVE bad.6; REJECT };
52<ADDR> To: ram@eiffel			{ SAVE bad.7; REJECT };
53<ADDR> To: ram@eif				{ SAVE bad.8; REJECT };
54<ADDR> To: ram*					{ SAVE ok.5; REJECT };
55<ADDR> To: ra*					{ SAVE ok.6; REJECT };
56<ADDR> To: ra*@eif*				{ SAVE ok.7; REJECT };
57<ADDR>							{ DELETE };
58
59# filter/default
60X-Tag: /default #1/ { DELETE };
61X-Tag: /default #2/ { NOP };
62X-Tag: /unknown/ 	{ UNKNOWN };
63
64# filter/loop
65X-Tag: /loop #1/			{ BEGIN LOOP; RESTART };
66X-Tag: /loop #2/			{ DELETE };
67
68# filter/multiple
69X-None Subject To X-Tag: /multiple #1/			{ SAVE %u.1 };
70X-None X-Tag: /multiple #2/, X-Other: /another/,
71To Cc: root, Cc To: ram							{ SAVE %u.3; REJECT MULTIPLE };
72<MULTIPLE> X-Non-Existent: *					{ SAVE %u.2 };
73X-Tag: /multiple #2/, X-Other: /multiple #2/	{ SAVE %u.2 };
74
75# filter/list
76X-Tag: /list #1/				{ BEGIN LIST; REJECT };
77<LIST> To: ram					{ SAVE %u.1 };
78<LIST> To: max					{ SAVE %u.2 };
79<LIST> To: /^root@eiffel.com$/	{ SAVE %u.3 };
80<LIST> To: /^riot@eiffel.co$/	{ DELETE };
81<LIST> To: /^riot@eiffel.com$/	{ SAVE %u.4 };
82<LIST> To: /^riot/				{ SAVE %u.5 };
83<LIST> To: /riot/				{ SAVE %u.6 };
84<LIST> Newsgroups: news.lists	{ SAVE %u.7 };
85<LIST> To <3>: /^root@local/	{ SAVE %u.8 };
86<LIST> To: !ram					{ SAVE %u.9 };
87<LIST>							{ DELETE };
88
89X-Tag: /list #2/						{ BEGIN LIST; REJECT };
90<LIST> Relayed: ursa-major.spdcc.com	{ SAVE ok.1; REJECT LIST_OK };
91<LIST> 									{ SAVE never; REJECT };
92<LIST,LIST_OK> 							{ REJECT LIST };
93<LIST> Relayed <1>: /ursa-major/ 		{ SAVE ok.2; REJECT LIST_OK };
94<LIST> 									{ SAVE never; REJECT };
95<LIST,LIST_OK> 							{ REJECT LIST };
96<LIST> Relayed <-1,->: *eiffel.com	 	{ SAVE ok.3 };
97<LIST> 									{ SAVE never };
98
99# filter/pattern
100X-T.*: "pattern-list"			{ BEGIN PAT; REJECT };
101<PAT> .*Re[^\-]*$: *, ^Sub*: *	{ RUN /bin/echo '%&' > macro; DELETE };
102
103# filter/backref
104X-Tag: /^back(.*) #1/,
105Subject: /Re:\s+(\w+)\s+ice\s+(\w+)/,
106From: /(.*)compilers/,
107From: /com(.*)rs/,
108To: /^(\w+)@(\S+)/		{ RUN /bin/echo '%1,%4,%5@%6,%2 %3' > output; DELETE };
109
110X-Tag: /^back.* #2/,
111Newsgroups:
112	/(comp.lang.perl)/,
113	/(comp.unix.wizards)/,
114	/(comp.mail.mh)/	{ SAVE %1 };
115
116# filter/escape
117X-Tag: /escape/			{ RUN /bin/echo '\;,\\\;,\\,\w' > output; DELETE };
118
119# filter/mode
120X-Tag: /mode/			{ REJECT MODE };
121<MODE, !INITIAL>		{ SAVE always; REJECT };
122<MODE>					{ SAVE always.2; REJECT };
123<!NOSUCH,!BADMODE> X-Tag: /mode/	{ SAVE always.3; REJECT };
124<!MODE> X-Tag: /mode/				{ SAVE never; REJECT };
125<MODE>					{ DELETE };
126
127# filter/not
128X-Tag: /not #1/			{ BEGIN NOT; REJECT };
129<NOT> To: !ram			{ SAVE never };
130<NOT> To: !/ram@eiffel/	{ SAVE never };
131<NOT> To: !/^ram/i		{ SAVE never };
132<NOT> To: /^ram/i				{ SAVE always; REJECT };
133<NOT> To: !/^root/i				{ SAVE always.2; REJECT };
134<NOT> X-Tag: !"pattern-list"	{ SAVE always.3 };
135
136X-Tag: /not #2/,
137!To: !ram,
138To: !compilers,
139!From: root				{ SAVE always };
140
141# filter/group
142X-Tag: /group/			{ BEGIN GROUP; REJECT };
143<GROUP> !To !From: ram	{ SAVE never };
144<GROUP> To !From: !ram	{ SAVE never };
145<GROUP> !To !From: ram,
146	!Subject !To: ram		{ SAVE never };
147<GROUP> !To: root, ram		{ SAVE never };
148<GROUP> !F.*: /compiler/	{ SAVE never };
149<GROUP> !From: ram, !To: ram	{ SAVE always; REJECT };
150<GROUP> From: ram, To: ram		{ SAVE never };
151<GROUP> From: /compiler/,
152	!From: ram, !From: !/compiler/	{ SAVE always.2; REJECT };
153<GROUP> From !Cc !To: /compiler/,
154	From !Cc !To: ram,
155	!From To Cc: /eiffel/,
156	!From To Cc: !/ice/			{ SAVE always.3; REJECT };
157<GROUP> !To !Cc: guy_3			{ SAVE never.2 };
158<GROUP> !To Cc: guy_3			{ SAVE always.4; REJECT };
159<GROUP> !To: unknown, !Subject !From: ram	{ SAVE always.5 };
160
161# filter/case
162X-Tag: case, Cc: root	{ STRIP Cc; SAVE always };
163
164# filter/base64
165X-Tag: base64,
166Body: /successfully/ 	{ SAVE always };
167
168# filter/qp
169X-Tag: qp,
170Body: /broken/ 			{ SAVE always };
171
172# filter/status
173X-Tag: /status/	{ REJECT -t STATUS };
174<STATUS> { RUN ../no/such/file; REJECT -t; SAVE always; REJECT -t; SAVE never };
175<STATUS> { RUN ../this/does/not/exist; REJECT -f; SAVE never };
176<STATUS> { RUN ../nor/does/this; REJECT -t; REJECT -t; REJECT -f; SAVE never };
177<STATUS> { SAVE always.2; REJECT -f; BEGIN INITIAL; REJECT -t };
178<INITIAL> X-Tag: /status/	{ SAVE always.3 };
179
180# filter/hook
181X-Tag: /hook #(\d)/		{ SAVE hook.%1; ABORT -t; SAVE never };
182
183# filter/range
184X-Tag: /range/			{ BEGIN RANGE; REJECT };
185<RANGE> From <2, 4>: /compiler/	{ SAVE always; REJECT };
186<RANGE> To Cc: made				{ SAVE always.2; REJECT };
187<RANGE> To Cc <1, 1>: made		{ SAVE never; REJECT };
188<RANGE> To Cc <1, 2>: must		{ SAVE always.3; REJECT };
189<RANGE> To Cc <3, 1>: ram		{ SAVE never.2; REJECT };
190<RANGE> Body <-, 3>: /SIGPLAN/	{ SAVE never.3; REJECT };
191<RANGE> Body <-, ->: /SIGpLAN/i	{ SAVE always.4; REJECT };
192<RANGE> Body <9, 9>: m|SI\w+N|	{ SAVE always.5; REJECT };
193<RANGE> Body <9, 9>: /CD-ROM/		{ SAVE never.4; REJECT };
194<RANGE> Body <13, 14>: m,something,	{ SAVE always.6; REJECT };
195<RANGE> Body <-3, ->: /Regards/		{ SAVE always.7; REJECT };
196<RANGE> Cc <-1, ->: made			{ SAVE always.8; REJECT };
197<RANGE> Body <-3, ->: /request/		{ SAVE never.5; REJECT };
198<RANGE> Cc <-1, ->: must			{ SAVE never.6 };
199<RANGE> 							{ DELETE };
200
201# filter/macros
202X-Tag: /macros/			{ REJECT MACROS };
203<MACROS> To: %u			{ LEAVE };
204<MACROS>				{ DELETE };
205
206