changeset 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 021d145e34e9
children 76460d98b2fb
files ChangeLog docs/noffle.conf.5 src/configfile.c src/filter.c src/filter.h
diffstat 5 files changed, 34 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Oct 22 14:41:43 2001 +0100
+++ b/ChangeLog	Tue Oct 30 12:42:13 2001 +0000
@@ -1,3 +1,13 @@
+Tur Oct 30 2001 Jim Hague <jim.hague@acm.org>
+
+* 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.
+	
 Mon Oct 22 2001 Jim Hague <jim.hague@acm.org>
 
 * src/fetch.c: Only leave articles in the requested list if the error
@@ -38,7 +48,7 @@
 Wed Sep 12 2001 Jim Hague <jim.hague@acm.org>
 
 * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
-  robustness - instead of retruning simple Passed/Failed statuses from
+  robustness - instead of returning simple Passed/Failed statuses from
   connection functions, return an integer status instead. This allows
   Noffle to distinguish between a connection failure, an unrecoverable
   protocol error and a recoverable problem. As a concrete instance, Noffle
--- a/docs/noffle.conf.5	Mon Oct 22 14:41:43 2001 +0100
+++ b/docs/noffle.conf.5	Tue Oct 30 12:42:13 2001 +0000
@@ -1,5 +1,5 @@
 .TH noffle.conf 5
-.\" $Id: noffle.conf.5 311 2001-10-21 11:00:12Z bears $
+.\" $Id: noffle.conf.5 313 2001-10-30 12:42:13Z bears $
 
 .SH NAME
 noffle.conf \- Configuration file for NOFFLE news server
@@ -140,7 +140,7 @@
 .TP
 .B auto-unsubscribe yes|no
 Automatically remove groups from fetch list if they have not been
-accessed for a number days. Groups are only unsubscribed if there
+accessed for a number of days. Groups are only unsubscribed if there
 are fresh articles arriving and remaining unread.
 .br
 Default: no
@@ -345,9 +345,11 @@
 .PP
 .B action
 =
-.IR "full|over|thread|discard" .
-Specifies the action to be taken if the filter matches. If not specified,
-the default action is as specified by the group's default subscription mode.
+.IR "full|over|thread|discard|default" .
+Specifies the action to be taken if the filter matches. If not specified
+or specified as
+.BR default ,
+the action is as specified by the group's subscription mode.
 .PP
 .B group
 =
--- a/src/configfile.c	Mon Oct 22 14:41:43 2001 +0100
+++ b/src/configfile.c	Tue Oct 30 12:42:13 2001 +0000
@@ -6,7 +6,7 @@
     SPOOLDIR
     VERSION
 
-  $Id: configfile.c 309 2001-10-05 15:44:22Z enz $
+  $Id: configfile.c 313 2001-10-30 12:42:13Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -780,6 +780,8 @@
 		f->action = FILTER_THREAD;
 	    else if ( strcmp( value, "discard" ) == 0 )
 		f->action = FILTER_DISCARD;
+	    else if ( strcmp( value, "default" ) == 0 )
+		f->action = FILTER_DEFAULT;
 	    seenAction = TRUE;
 	}
 	else if ( rule.type == RULE_NEWSGROUP )
--- 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;
 }
 
--- a/src/filter.h	Mon Oct 22 14:41:43 2001 +0100
+++ b/src/filter.h	Tue Oct 30 12:42:13 2001 +0000
@@ -3,7 +3,7 @@
 
   Article filtering.
 
-  $Id: filter.h 189 2000-08-09 21:19:17Z bears $
+  $Id: filter.h 313 2001-10-30 12:42:13Z bears $
 */
 
 #ifndef	FILTER_H
@@ -19,7 +19,8 @@
     FILTER_FULL,
     FILTER_XOVER,
     FILTER_THREAD,
-    FILTER_DISCARD
+    FILTER_DISCARD,
+    FILTER_DEFAULT
 } FilterAction;
 
 /* Representation of a rule. */