e7def4e3568bf5ab7a8c271eae5d98da48a2dd0c
[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
20 #ifndef WHOWAS_H
21 #define WHOWAS_H
22
23 /*=============================================================================
24  * General defines
25  */
26
27 #define BITS_PER_COL            3
28 #define BITS_PER_COL_MASK       0x7
29 #define WW_MAX_INITIAL          16
30
31 #define MAX_SUB (1 << BITS_PER_COL)
32 #define WW_MAX_INITIAL_MASK (WW_MAX_INITIAL - 1)
33 #define WW_MAX (WW_MAX_INITIAL * MAX_SUB)
34
35 /*=============================================================================
36  * Structures
37  */
38
39 struct Whowas {
40   unsigned int hashv;
41   char *name;
42   char *username;
43   char *hostname;
44   char *servername;
45   char *realname;
46   char *away;
47   time_t logoff;
48   struct Client *online;        /* Needed for get_history() (nick chasing) */
49   struct Whowas *hnext;         /* Next entry with the same hash value */
50   struct Whowas **hprevnextp;   /* Pointer to previous next pointer */
51   struct Whowas *cnext;         /* Next entry with the same 'online' pointer */
52   struct Whowas **cprevnextp;   /* Pointer to previous next pointer */
53 };
54
55 /*=============================================================================
56  * Proto types
57  */
58
59 extern aClient *get_history(const char *nick, time_t timelimit);
60 extern void add_history(aClient *cptr, int still_on);
61 extern void off_history(const aClient *cptr);
62 extern void initwhowas(void);
63 extern int m_whowas(aClient *cptr, aClient *sptr, int parc, char *parv[]);
64 extern void count_whowas_memory(int *wwu, size_t *wwm, int *wwa, size_t *wwam);
65
66 #endif /* WHOWAS_H */