]> jfr.im git - irc/quakenet/newserv.git/blame - chanfix/chanfix.h
A4STATS: remove E style escapes and switch to createtable for indices
[irc/quakenet/newserv.git] / chanfix / chanfix.h
CommitLineData
8a25ddc6
P
1#ifndef __CHANFIX_H
2#define __CHANFIX_H
3
4#include "../channel/channel.h"
5
6typedef struct chanfix {
7 chanindex *index;
8 array regops;
9} chanfix;
10
11typedef 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
19extern int cfext;
20extern 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
8a25ddc6
P
43/* chanfix won't ever reop more users than this */
44#define CFMAXOPS 10
45/* where we store our chanfix data */
7fadae2b 46#define CFSTORAGE "data/chanfix"
8a25ddc6
P
47/* how many chanfix files we have */
48#define CFSAVEFILES 5
49/* maximum number of servers which may be split */
50#define CFMAXSPLITSERVERS 10
51
52/* track user by account */
53#define CFACCOUNT 0x1
54/* track user by ident@host */
55#define CFHOST 0x2
56
57/* channel was fixed */
58#define CFX_FIXED 0
59/* no chanfix information available */
60#define CFX_NOCHANFIX 1
61/* channel was fixed but less than CFMAXOPS were opped */
62#define CFX_FIXEDFEWOPS 2
63/* nobody could be found for a reop */
64#define CFX_NOUSERSAVAILABLE 3
65
66regop *cf_findregop(nick *np, chanindex *cip, int type);
67chanfix *cf_findchanfix(chanindex *cip);
68nick *cf_findnick(regop *ro, chanindex *cip);
69int cf_wouldreop(nick *np, channel *cp);
70int cf_fixchannel(channel *cp);
71int cf_getsortedregops(chanfix *cf, int max, regop **list);
72int cf_cmpregopnick(regop *ro, nick *np);
73
74#endif /* __CHANFIX_H */