Mercurial > noffle
annotate src/filter.h @ 217:b4f1731a6470 noffle
[svn] * Makefile.in,aclocal.m4,config.h.in,configure,configure.in
docs/Makefile.in,src/Makefile.in: Regularise format of Noffle
default parameters in configure.in and regenerate.
author | bears |
---|---|
date | Thu, 22 Nov 2001 22:25:12 +0000 |
parents | 21200ce10e68 |
children | 0340b9c17edc |
rev | line source |
---|---|
128 | 1 /* |
2 filter.h | |
3 | |
4 Article filtering. | |
5 | |
212 | 6 $Id: filter.h 331 2001-11-22 12:04:45Z mirkol $ |
128 | 7 */ |
8 | |
9 #ifndef FILTER_H | |
10 #define FILTER_H | |
11 | |
12 #include <sys/types.h> | |
13 #include <regex.h> | |
14 #include "fetchlist.h" | |
15 #include "over.h" | |
16 | |
17 /* The possible actions in a filter. */ | |
18 typedef enum { | |
19 FILTER_FULL, | |
20 FILTER_XOVER, | |
21 FILTER_THREAD, | |
194
a4e9a20e50e5
[svn] * docs/noffle.conf.5,src/configfile.c,src/filter.h,src/filter.c:
bears
parents:
128
diff
changeset
|
22 FILTER_DISCARD, |
a4e9a20e50e5
[svn] * docs/noffle.conf.5,src/configfile.c,src/filter.h,src/filter.c:
bears
parents:
128
diff
changeset
|
23 FILTER_DEFAULT |
128 | 24 } FilterAction; |
25 | |
26 /* Representation of a rule. */ | |
27 typedef enum { | |
28 RULE_NEWSGROUP, /* Wildmat data */ | |
29 RULE_SUBJECT, /* Regex data */ | |
30 RULE_FROM, | |
31 RULE_MSGID, | |
32 RULE_BYTES_LT, RULE_BYTES_EQ, RULE_BYTES_GT, /* Number data */ | |
33 RULE_LINES_LT, RULE_LINES_EQ, RULE_LINES_GT, | |
34 RULE_NOREFS_LT, RULE_NOREFS_EQ, RULE_NOREFS_GT, | |
212 | 35 RULE_XPOSTS_LT, RULE_XPOSTS_EQ, RULE_XPOSTS_GT, |
36 RULE_POST_STATUS /* 'y','n','m' */ | |
128 | 37 } FilterRuleType; |
38 | |
39 typedef union { | |
40 regex_t regex; | |
41 unsigned long amount; | |
42 char *grp; | |
212 | 43 char postAllow; /* 'y','n','m' */ |
128 | 44 } FilterRuleData; |
45 | |
46 typedef struct { | |
47 FilterRuleType type; | |
48 FilterRuleData data; | |
49 } FilterRule; | |
50 | |
51 /* A single filter is a collection of rules with an action. */ | |
52 typedef struct { | |
53 int nRules; | |
54 int maxRules; | |
55 FilterRule *rules; | |
56 FilterAction action; | |
57 } Filter; | |
58 | |
59 /* Add a filter to the list of filters. */ | |
60 void | |
61 Flt_addFilter( const Filter *f ); | |
62 | |
63 /* | |
64 * Run the rules over the supplied overview. If a specific rule fires, | |
65 * returns its action. If no rule fires, return the default read mode. | |
66 */ | |
67 FilterAction | |
68 Flt_checkFilters( const char *thisGrp, const char *newsgroups, | |
69 const Over *ov, FetchMode mode ); | |
70 | |
71 /* | |
72 * Build and access a filter | |
73 */ | |
74 Filter * | |
75 new_Filter( void ); | |
76 | |
77 void | |
78 del_Filter( Filter *f ); | |
79 | |
80 FilterAction | |
81 Flt_action( const Filter *f ); | |
82 | |
83 int | |
84 Flt_nRules( const Filter *f ); | |
85 | |
86 Bool | |
87 Flt_getNewsgroups( void ); | |
88 | |
89 FilterRule | |
90 Flt_rule( const Filter *f, int ruleNo ); | |
91 | |
92 void | |
93 Flt_setAction( Filter *f, FilterAction action ); | |
94 | |
95 void | |
96 Flt_addRule( Filter *f, FilterRule rule ); | |
97 | |
98 #endif /* FILTER_H */ |