diff 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
line wrap: on
line diff
--- a/src/filter.c	Mon Oct 22 14:41:43 2001 +0100
+++ b/src/filter.c	Tue Oct 30 12:42:13 2001 +0000
@@ -3,7 +3,7 @@
   
   Article filtering.
   
-  $Id: filter.c 300 2001-08-05 08:24:22Z bears $
+  $Id: filter.c 313 2001-10-30 12:42:13Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -192,7 +192,8 @@
 
 /*
  * Run the rules over the supplied overview. If a specific rule fires,
- * returns its action. If no rule fires, return the default read mode.
+ * returns its action. If no rule fires, or a rule specifying the default
+ * action fires, return the default read mode.
  */
 FilterAction
 Flt_checkFilters( const char *thisGrp, const char *newsgroups,
@@ -203,10 +204,15 @@
     for ( i = 0; i < filter.nFilters; i++ )
 	if ( checkFilter( thisGrp, newsgroups, ov, filter.filters[ i ] ) )
 	{
+	    FilterAction action = filter.filters[ i ]->action;
+	    
 	    Log_dbg( LOG_DBG_FILTER,
 		     "Filter %d fired on message %s",
 		     i, Ov_msgId( ov ) );
-	    return filter.filters[ i ]->action;
+	    if ( action == FILTER_DEFAULT )
+		break;
+	    else
+		return action;
 	}
 
     switch( mode )
@@ -233,7 +239,7 @@
     f->nRules = 0;
     f->maxRules = 0;
     f->rules = NULL;
-    f->action = FILTER_FULL;
+    f->action = FILTER_DEFAULT;
     return f;
 }