]> jfr.im git - irc/quakenet/newserv.git/blob - whowas/whowas.h
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / whowas / whowas.h
1 #ifndef __WHOWAS_H
2 #define __WHOWAS_H
3
4 #define WW_MAXCHANNELS 20
5 #define WW_DEFAULT_MAXENTRIES 1000
6 #define WW_MASKLEN (HOSTLEN + USERLEN + NICKLEN)
7 #define WW_REASONLEN 512
8
9 typedef struct whowas {
10 int type;
11 time_t timestamp;
12 nick nick; /* unlinked nick */
13 chanindex *channels[WW_MAXCHANNELS];
14
15 /* WHOWAS_QUIT or WHOWAS_KILL */
16 sstring *reason;
17
18 /* WHOWAS_RENAME */
19 sstring *newnick;
20
21 unsigned int marker;
22
23 struct whowas *next;
24 struct whowas *prev;
25 } whowas;
26
27 extern whowas *whowasrecs;
28 extern int whowasmax;
29 extern int whowasoffset; /* points to oldest record */
30
31 #define WHOWAS_UNUSED 0
32 #define WHOWAS_USED 1
33 #define WHOWAS_QUIT 2
34 #define WHOWAS_KILL 3
35 #define WHOWAS_RENAME 4
36
37 whowas *whowas_fromnick(nick *np, int standalone);
38 nick *whowas_tonick(whowas *ww);
39 void whowas_freenick(nick *np);
40 whowas *whowas_chase(const char *target, int maxage);
41 const char *whowas_format(whowas *ww);
42 const char *whowas_formatchannels(whowas *ww);
43 void whowas_clean(whowas *ww);
44 void whowas_free(whowas *ww);
45
46 unsigned int nextwhowasmarker(void);
47
48 #endif /* __WHOWAS_H */