# HG changeset patch # User mirkol # Date 1006430685 0 # Node ID 21200ce10e689eefb864e5a544b3edaa301ab1ff # Parent de96be6946a0ad5d7fb3fe9189c8f8da4ad0fe00 [svn] filter post-status=mod|yes|no. diff -r de96be6946a0 -r 21200ce10e68 docs/noffle.conf.5 --- a/docs/noffle.conf.5 Thu Nov 22 12:03:01 2001 +0000 +++ b/docs/noffle.conf.5 Thu Nov 22 12:04:45 2001 +0000 @@ -1,5 +1,5 @@ .TH noffle.conf 5 -.\" $Id: noffle.conf.5 314 2001-10-30 13:16:40Z bears $ +.\" $Id: noffle.conf.5 331 2001-11-22 12:04:45Z mirkol $ .SH NAME noffle.conf \- Configuration file for NOFFLE news server @@ -407,6 +407,14 @@ .IR . Matches if the number of groups the article is posted to is less than, equal to, or greater than the given number. +.PP +.B post-status += +.IR "mod|yes|no" . +Matches if the current newsgroup is moderated, not moderated or closed. +Unlike the +.B group +filter, only the current newsgroup is checked. .PP Numbers may have a suffix of 'k' or 'm'. As you might expect, 'k' diff -r de96be6946a0 -r 21200ce10e68 src/configfile.c --- a/src/configfile.c Thu Nov 22 12:03:01 2001 +0000 +++ b/src/configfile.c Thu Nov 22 12:04:45 2001 +0000 @@ -6,7 +6,7 @@ SPOOLDIR VERSION - $Id: configfile.c 316 2001-10-31 11:44:53Z bears $ + $Id: configfile.c 331 2001-11-22 12:04:45Z mirkol $ */ #if HAVE_CONFIG_H @@ -742,6 +742,8 @@ rule.type = RULE_NOREFS_LT; else if ( strcmp( ruleName, "xposts" ) == 0 ) rule.type = RULE_XPOSTS_LT; + else if ( strcmp( ruleName, "post-status" ) == 0 ) + rule.type = RULE_POST_STATUS; else if ( strcmp( ruleName, "action" ) != 0 ) goto synErr; @@ -793,6 +795,14 @@ if ( regcomp( &rule.data.regex, value, REG_EXTENDED ) != 0 ) goto synErr; } + else if (rule.type == RULE_POST_STATUS ) + if ( ( strcmp( value, "yes" ) == 0 ) || \ + ( strcmp( value, "no" ) == 0 ) || \ + ( strncmp( value, "mod", 3 ) == 0 ) ) + /* no need to type out "moderated" */ + rule.data.postAllow = value[0]; /* 'y','n' or 'm' */ + else + goto synErr; else { char * endVal; diff -r de96be6946a0 -r 21200ce10e68 src/filter.c --- a/src/filter.c Thu Nov 22 12:03:01 2001 +0000 +++ b/src/filter.c Thu Nov 22 12:04:45 2001 +0000 @@ -3,7 +3,7 @@ Article filtering. - $Id: filter.c 316 2001-10-31 11:44:53Z bears $ + $Id: filter.c 331 2001-11-22 12:04:45Z mirkol $ */ #if HAVE_CONFIG_H @@ -16,6 +16,7 @@ #include "itemlist.h" #include "log.h" #include "wildmat.h" +#include "group.h" struct { @@ -147,6 +148,12 @@ return FALSE; ul = countGroups( newsgroups ); return ( ul > r->data.amount ); + + case RULE_POST_STATUS: + if ( Grp_postAllow( thisGrp ) == r->data.postAllow ) + return TRUE; + return FALSE; + } ASSERT( FALSE ); /* Shouldn't get here */ diff -r de96be6946a0 -r 21200ce10e68 src/filter.h --- a/src/filter.h Thu Nov 22 12:03:01 2001 +0000 +++ b/src/filter.h Thu Nov 22 12:04:45 2001 +0000 @@ -3,7 +3,7 @@ Article filtering. - $Id: filter.h 313 2001-10-30 12:42:13Z bears $ + $Id: filter.h 331 2001-11-22 12:04:45Z mirkol $ */ #ifndef FILTER_H @@ -32,13 +32,15 @@ RULE_BYTES_LT, RULE_BYTES_EQ, RULE_BYTES_GT, /* Number data */ RULE_LINES_LT, RULE_LINES_EQ, RULE_LINES_GT, RULE_NOREFS_LT, RULE_NOREFS_EQ, RULE_NOREFS_GT, - RULE_XPOSTS_LT, RULE_XPOSTS_EQ, RULE_XPOSTS_GT + RULE_XPOSTS_LT, RULE_XPOSTS_EQ, RULE_XPOSTS_GT, + RULE_POST_STATUS /* 'y','n','m' */ } FilterRuleType; typedef union { regex_t regex; unsigned long amount; char *grp; + char postAllow; /* 'y','n','m' */ } FilterRuleData; typedef struct {