]> jfr.im git - irc/quakenet/newserv.git/blame_incremental - whowas/whowas.h
whowas: Use a ring buffer for the whowas records.
[irc/quakenet/newserv.git] / whowas / whowas.h
... / ...
CommitLineData
1#ifndef __WHOWAS_H
2#define __WHOWAS_H
3
4#define WW_MAXAGE 3600
5#define WW_MAXENTRIES 100000
6#define WW_MASKLEN (HOSTLEN + USERLEN + NICKLEN)
7#define WW_REASONLEN 512
8
9typedef struct whowas {
10 int type;
11 time_t timestamp;
12 nick nick; /* unlinked nick */
13
14 /* WHOWAS_QUIT or WHOWAS_KILL */
15 sstring *reason;
16
17 /* WHOWAS_RENAME */
18 sstring *newnick;
19
20 unsigned int marker;
21
22 struct whowas *next;
23 struct whowas *prev;
24} whowas;
25
26extern whowas whowasrecs[WW_MAXENTRIES];
27extern int whowasoffset; /* points to oldest record */
28
29#define WHOWAS_UNUSED 0
30#define WHOWAS_QUIT 1
31#define WHOWAS_KILL 2
32#define WHOWAS_RENAME 3
33
34whowas *whowas_fromnick(nick *np, int standalone);
35nick *whowas_tonick(whowas *ww);
36void whowas_freenick(nick *np);
37whowas *whowas_chase(const char *target, int maxage);
38const char *whowas_format(whowas *ww);
39void whowas_clean(whowas *ww);
40void whowas_free(whowas *ww);
41
42unsigned int nextwhowasmarker(void);
43
44#endif /* __WHOWAS_H */