1 #ifndef _SUCK_KILLFILE_H
2 #define _SUCK_KILLFILE_H 1
3 
4 #define SIZEOF_SKIPARRAY 256
5 
6 #ifdef HAVE_UNISTD_H
7 #include <sys/types.h> /* for pid_t */
8 #endif
9 
10 #ifdef PERL_EMBED
11 #include <EXTERN.h>
12 #include <perl.h>
13 #endif
14 
15 #ifdef HAVE_REGEX_H
16 #include <regex.h>	/* for regex_t */
17 #endif
18 typedef struct MYREGEX {
19 #ifdef HAVE_REGEX_H
20 	regex_t *ptrs;
21 #endif
22 	char *header;
23 	char *string;
24 	struct MYREGEX *next;
25 /*	void *next; */
26 	unsigned char skiparray[SIZEOF_SKIPARRAY];
27 	int case_sensitive;
28 } my_regex, *pmy_regex;
29 
30 /* this is a structure so can add other kill options later */
31 typedef struct {
32 	int hilines;	/* nr of lines max article length */
33 	int lowlines;	/* nr of lines min article length */
34 	int maxgrps;	/* max nr of grps (to prevent spams) */
35 	int maxxref;    /* max nr of Xrefs (another spamer) */
36 	unsigned long bodybig;	/* max size of article body  */
37 	unsigned long bodysmall; /* minimum size of article body */
38 	char quote;	/* character to use as quote (for case compare) */
39 	char non_regex;	/* character to use as non_regex (don't do regex compare ) */
40 #ifdef HAVE_REGEX_H
41 	int use_extended;	/* do we use extended regex */
42 #endif
43 	pmy_regex header;       /* scan the entire header */
44 	pmy_regex body;		/* scan the body */
45 	pmy_regex list;	/* linked list of headers and what to match */
46 } OneKill, *POneKill;
47 
48 typedef struct {
49 	OneKill match;
50 	int delkeep;
51 	char *group;	/* dynamically allocated */
52 } Group, *PGroup;
53 
54 typedef struct {
55 	int Stdin;
56 	int Stdout;
57 	pid_t Pid;
58 } Child;
59 
60 typedef struct killstruct {
61 	FILE *logfp;
62 	int logyn;
63 	int grp_override;
64 	int tie_delete;
65 	int totgrps;
66 	int ignore_postfix;
67 	int xover_log_long;
68 	PGroup grps;	/* dynamicly allocated array */
69 	int ( *killfunc)(PMaster, struct killstruct *, char *, int); /*function to call to check header */
70 	char *pbody;
71 	unsigned long bodylen;
72 	int use_extended_regex;
73 	Child child;		/* these two are last since can't initialize */
74 	OneKill master;
75 #ifdef PERL_EMBED
76 	PerlInterpreter *perl_int;
77 #endif
78 } KillStruct, *PKillStruct;
79 
80 /* function prototypes for killfile.c  and xover.c*/
81 int get_one_article_kill(PMaster, int, long);
82 PKillStruct parse_killfile(int, int, int, int);
83 void free_killfile(PKillStruct);
84 int chk_msg_kill(PMaster, PKillStruct, char *, int);
85 int regex_block(char *, pmy_regex, int);
86 
87 /* function prototypes for killprg.c */
88 int killprg_forkit(PKillStruct, char *, int, int);
89 int chk_msg_kill_fork(PMaster, PKillStruct, char *, int);
90 void killprg_closeit(PKillStruct);
91 void killprg_sendoverview(PMaster);
92 int killprg_sendxover(PMaster, char *);
93 #ifdef PERL_EMBED
94 int killperl_setup(PKillStruct, char *, int, int);
95 int chk_msg_kill_perl(PMaster, PKillStruct, char *, int);
96 void killperl_done(PKillStruct);
97 int killperl_sendxover(PMaster, char *);
98 #endif
99 
100 enum { KILL_XOVER, KILL_KILLFILE}; /* are we doing xover or killfile */
101 enum { KILL_LOG_NONE, KILL_LOG_SHORT, KILL_LOG_LONG };  /* what level of logging do we use */
102 enum { DELKEEP_KEEP, DELKEEP_DELETE }; /* is this a keep or delete group */
103 
104 #define COMMA ','			/* group separator in newsgroup line in article */
105 #define SPACE ' '                       /* another group separator in newsgroup/xref line in article */
106 #define COLON ':'                       /* group/article nr separator in Xref line */
107 
108 #endif /* _SUCK_KILLFILE_H */
109