Author: Bleep <tomh@inxpress.net>
[ircu2.10.12-pk.git] / include / whowas.h
1 /*
2  * IRC - Internet Relay Chat, include/whowas.h
3  * Copyright (C) 1990 Markku Savela
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 1, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * $Id$
20  */
21 #ifndef INCLUDED_whowas_h
22 #define INCLUDED_whowas_h
23 #ifndef INCLUDED_sys_types_h
24 #include <sys/types.h>        /* size_t */
25 #define INCLUDED_sys_types_h
26 #endif
27
28 struct Client;
29
30 /*
31  * General defines
32  */
33
34 #define BITS_PER_COL            3
35 #define BITS_PER_COL_MASK       0x7
36 #define WW_MAX_INITIAL          16
37
38 #define MAX_SUB (1 << BITS_PER_COL)
39 #define WW_MAX_INITIAL_MASK (WW_MAX_INITIAL - 1)
40 #define WW_MAX (WW_MAX_INITIAL * MAX_SUB)
41
42 /*
43  * Structures
44  */
45
46 struct Whowas {
47   unsigned int hashv;
48   char *name;
49   char *username;
50   char *hostname;
51   char *servername;
52   char *realname;
53   char *away;
54   time_t logoff;
55   struct Client *online;        /* Needed for get_history() (nick chasing) */
56   struct Whowas *hnext;         /* Next entry with the same hash value */
57   struct Whowas **hprevnextp;   /* Pointer to previous next pointer */
58   struct Whowas *cnext;         /* Next entry with the same 'online' pointer */
59   struct Whowas **cprevnextp;   /* Pointer to previous next pointer */
60 };
61
62 /*
63  * Proto types
64  */
65 extern struct Whowas* whowashash[];
66
67 extern unsigned int hash_whowas_name(const char *name);
68
69 extern struct Client *get_history(const char *nick, time_t timelimit);
70 extern void add_history(struct Client *cptr, int still_on);
71 extern void off_history(const struct Client *cptr);
72 extern void initwhowas(void);
73 extern void count_whowas_memory(int *wwu, size_t *wwm, int *wwa, size_t *wwam);
74
75 #endif /* INCLUDED_whowas_h */