]>
jfr.im git - irc/quakenet/newserv.git/blob - chanstats/chanstats.h
6 #include "../lib/sstring.h"
7 #include "../channel/channel.h"
8 #include "../parser/parser.h"
10 #define SAVEINTERVAL 3600
11 #define SAMPLEINTERVAL 360
12 #define SAMPLEHISTORY 10
13 #define HISTORYDAYS 14
15 /* The main stats structure. Everything except the "lastsamples" array needs to be saved/restored */
17 typedef struct chanstats
{
18 chanindex
*index
; /* Channel index pointer */
19 unsigned short lastdays
[HISTORYDAYS
]; /* Average user counts for the last 14 days, stored as (average users * 10) */
20 unsigned char lastdaysamples
[HISTORYDAYS
]; /* Number of samples taken on each of the last 14 days */
21 unsigned short lastmax
[HISTORYDAYS
]; /* Max users seen on each of the last 14 days */
22 unsigned short lastsamples
[SAMPLEHISTORY
]; /* Number of users for the last 10 samples (i.e. 1 hour) */
23 unsigned char todaysamples
; /* Number of samples taken today */
24 unsigned int todayusers
; /* Total of all of today's samples */
25 unsigned short todaymax
; /* Max users seen today */
26 time_t lastsampled
; /* When this channel was last sampled */
27 struct chanstats
*nextsorted
; /* Next channel in sorted order */
30 /* These sample counts need to be saved and restored */
31 extern unsigned int totaltodaysamples
;
32 extern unsigned int totallastdaysamples
[HISTORYDAYS
];
37 extern unsigned int lastdaysamples
[HISTORYDAYS
];
38 extern unsigned int todaysamples
;
40 extern time_t chanstats_lastsample
;
43 chanstats
*findchanstats(const char *channame
);
44 chanstats
*findchanstatsifexists(const char *channame
);
46 /* chanstatsalloc.c */
48 void initchanstatsalloc();
49 chanstats
*getchanstats();
50 void freechanstats(chanstats
*csp
);
53 void initchansearch();
54 void finichansearch();
55 void regchansearchfunc(const char *name
, int args
, CommandHandler handler
);
56 void unregchansearchfunc(const char *name
, CommandHandler handler
);
57 int dochansearch(void *source
, int cargc
, char **cargv
);