Mercurial > noffle
comparison src/filter.c @ 194:a4e9a20e50e5 noffle
[svn] * docs/noffle.conf.5,src/configfile.c,src/filter.h,src/filter.c:
Contrary to the documentation, the action of a filter if not specified
was 'full'. Add a new 'default' action which makes the action that of the
group's subscription mode. Make this the default action, and allow
'default' to be specified explicitly as the action in the filter
definition. Adapted from patch submitted by Mirko Liss. Thanks, Mirko.
* docs/noffle.conf.5: Correct small typo.
author | bears |
---|---|
date | Tue, 30 Oct 2001 12:42:13 +0000 |
parents | fed1334d766b |
children | 24d4cd032da5 |
comparison
equal
deleted
inserted
replaced
193:021d145e34e9 | 194:a4e9a20e50e5 |
---|---|
1 /* | 1 /* |
2 filter.c | 2 filter.c |
3 | 3 |
4 Article filtering. | 4 Article filtering. |
5 | 5 |
6 $Id: filter.c 300 2001-08-05 08:24:22Z bears $ | 6 $Id: filter.c 313 2001-10-30 12:42:13Z bears $ |
7 */ | 7 */ |
8 | 8 |
9 #if HAVE_CONFIG_H | 9 #if HAVE_CONFIG_H |
10 #include <config.h> | 10 #include <config.h> |
11 #endif | 11 #endif |
190 filter.filters[ filter.nFilters++ ] = f; | 190 filter.filters[ filter.nFilters++ ] = f; |
191 } | 191 } |
192 | 192 |
193 /* | 193 /* |
194 * Run the rules over the supplied overview. If a specific rule fires, | 194 * Run the rules over the supplied overview. If a specific rule fires, |
195 * returns its action. If no rule fires, return the default read mode. | 195 * returns its action. If no rule fires, or a rule specifying the default |
196 * action fires, return the default read mode. | |
196 */ | 197 */ |
197 FilterAction | 198 FilterAction |
198 Flt_checkFilters( const char *thisGrp, const char *newsgroups, | 199 Flt_checkFilters( const char *thisGrp, const char *newsgroups, |
199 const Over *ov, FetchMode mode ) | 200 const Over *ov, FetchMode mode ) |
200 { | 201 { |
201 int i; | 202 int i; |
202 | 203 |
203 for ( i = 0; i < filter.nFilters; i++ ) | 204 for ( i = 0; i < filter.nFilters; i++ ) |
204 if ( checkFilter( thisGrp, newsgroups, ov, filter.filters[ i ] ) ) | 205 if ( checkFilter( thisGrp, newsgroups, ov, filter.filters[ i ] ) ) |
205 { | 206 { |
207 FilterAction action = filter.filters[ i ]->action; | |
208 | |
206 Log_dbg( LOG_DBG_FILTER, | 209 Log_dbg( LOG_DBG_FILTER, |
207 "Filter %d fired on message %s", | 210 "Filter %d fired on message %s", |
208 i, Ov_msgId( ov ) ); | 211 i, Ov_msgId( ov ) ); |
209 return filter.filters[ i ]->action; | 212 if ( action == FILTER_DEFAULT ) |
213 break; | |
214 else | |
215 return action; | |
210 } | 216 } |
211 | 217 |
212 switch( mode ) | 218 switch( mode ) |
213 { | 219 { |
214 case FULL: return FILTER_FULL; | 220 case FULL: return FILTER_FULL; |
231 exit( EXIT_FAILURE ); | 237 exit( EXIT_FAILURE ); |
232 } | 238 } |
233 f->nRules = 0; | 239 f->nRules = 0; |
234 f->maxRules = 0; | 240 f->maxRules = 0; |
235 f->rules = NULL; | 241 f->rules = NULL; |
236 f->action = FILTER_FULL; | 242 f->action = FILTER_DEFAULT; |
237 return f; | 243 return f; |
238 } | 244 } |
239 | 245 |
240 void | 246 void |
241 del_Filter( Filter *f ) | 247 del_Filter( Filter *f ) |