]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __CHANFIX_H | |
2 | #define __CHANFIX_H | |
3 | ||
4 | #include "../channel/channel.h" | |
5 | ||
6 | typedef struct chanfix { | |
7 | chanindex *index; | |
8 | array regops; | |
9 | } chanfix; | |
10 | ||
11 | typedef struct regop { | |
12 | int type; /* CFACCOUNT or CFHOST */ | |
13 | unsigned long hash; /* hash of the user's account or host */ | |
14 | sstring *uh; /* account or user@host if the user has enough points */ | |
15 | time_t lastopped; /* when was he last opped */ | |
16 | unsigned int score; /* chanfix score */ | |
17 | } regop; | |
18 | ||
19 | extern int cfext; | |
20 | extern int cfnext; | |
21 | ||
22 | #define CFAUTOFIX 0 | |
23 | #define CFDEBUG 0 | |
24 | ||
25 | #if CFDEBUG | |
26 | #define CFSAMPLEINTERVAL 5 | |
27 | #define CFEXPIREINTERVAL 60 | |
28 | #define CFAUTOSAVEINTERVAL 60 | |
29 | #define CFREMEMBEROPS 10*24*60 | |
30 | #else | |
31 | #define CFSAMPLEINTERVAL 300 | |
32 | #define CFEXPIREINTERVAL 3600 | |
33 | #define CFAUTOSAVEINTERVAL 3600 | |
34 | #define CFREMEMBEROPS 10*24*3600 | |
35 | #endif | |
36 | ||
37 | /* we won't track scores for channels which have | |
38 | less users than this */ | |
39 | #define CFMINUSERS 4 | |
40 | /* if you lose a channel after 30 minutes then | |
41 | you really don't need a channel at all */ | |
42 | #define CFMINSCORE 6 | |
43 | /* a user needs this many points to have his account/host | |
44 | stored in the regop struct */ | |
45 | #define CFMINSCOREUH 48 | |
46 | /* chanfix won't ever reop more users than this */ | |
47 | #define CFMAXOPS 10 | |
48 | /* where we store our chanfix data */ | |
49 | #define CFSTORAGE "chanfix" | |
50 | /* how many chanfix files we have */ | |
51 | #define CFSAVEFILES 5 | |
52 | /* maximum number of servers which may be split */ | |
53 | #define CFMAXSPLITSERVERS 10 | |
54 | ||
55 | /* track user by account */ | |
56 | #define CFACCOUNT 0x1 | |
57 | /* track user by ident@host */ | |
58 | #define CFHOST 0x2 | |
59 | ||
60 | /* channel was fixed */ | |
61 | #define CFX_FIXED 0 | |
62 | /* no chanfix information available */ | |
63 | #define CFX_NOCHANFIX 1 | |
64 | /* channel was fixed but less than CFMAXOPS were opped */ | |
65 | #define CFX_FIXEDFEWOPS 2 | |
66 | /* nobody could be found for a reop */ | |
67 | #define CFX_NOUSERSAVAILABLE 3 | |
68 | ||
69 | regop *cf_findregop(nick *np, chanindex *cip, int type); | |
70 | chanfix *cf_findchanfix(chanindex *cip); | |
71 | nick *cf_findnick(regop *ro, chanindex *cip); | |
72 | int cf_wouldreop(nick *np, channel *cp); | |
73 | int cf_fixchannel(channel *cp); | |
74 | int cf_getsortedregops(chanfix *cf, int max, regop **list); | |
75 | int cf_cmpregopnick(regop *ro, nick *np); | |
76 | ||
77 | #endif /* __CHANFIX_H */ |