Author: Bleep <tomh@inxpress.net>
[ircu2.10.12-pk.git] / include / gline.h
1 #ifndef INCLUDED_gline_h
2 #define INCLUDED_gline_h
3 /*
4  * IRC - Internet Relay Chat, include/gline.h
5  * Copyright (C) 1990 Jarkko Oikarinen and
6  *                    University of Oulu, Computing Center
7  * Copyright (C) 1996 -1997 Carlo Wood
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id$
24  */
25 #ifndef INCLUDED_config_h
26 #include "config.h"
27 #endif
28 #ifndef INCLUDED_sys_types_h
29 #include <sys/types.h>
30 #define INCLUDED_sys_types_h
31 #endif
32
33
34 struct Client;
35
36 /*
37  * gflags
38  */
39 #define GLINE_ACTIVE    1
40 #define GLINE_IPMASK    2
41 #define GLINE_LOCAL     4
42
43 #define GlineIsActive(g)    ((g)->gflags & GLINE_ACTIVE)
44 #define GlineIsIpMask(g)    ((g)->gflags & GLINE_IPMASK)
45 #define GlineIsLocal(g)     ((g)->gflags & GLINE_LOCAL)
46
47 #define SetActive(g)        ((g)->gflags |= GLINE_ACTIVE)
48 #define ClearActive(g)      ((g)->gflags &= ~GLINE_ACTIVE)
49 #define SetGlineIsIpMask(g) ((g)->gflags |= GLINE_IPMASK)
50 #define SetGlineIsLocal(g)  ((g)->gflags |= GLINE_LOCAL)
51
52 struct Gline {
53   struct Gline*  next;
54   struct Gline*  prev;
55   char*          host;
56   char*          reason;
57   char*          name;
58   time_t         expire;
59   unsigned int   gflags;
60 };
61
62 extern struct Gline* GlobalGlineList;
63 extern struct Gline* BadChanGlineList;
64
65 extern void gline_remove_expired(time_t now);
66
67 extern void add_gline(struct Client *sptr, int ip_mask,
68                       char *host, char *comment, char *user,
69                       time_t expire, int local);
70 extern struct Gline* make_gline(int is_ipmask, char *host, char *reason,
71                                 char *name, time_t expire);
72 extern struct Gline* find_gline(struct Client *cptr, struct Gline **pgline);
73 extern void free_gline(struct Gline *gline, struct Gline *prev);
74
75 #ifdef BADCHAN
76 extern int bad_channel(const char* name);
77 extern void bad_channel_remove_expired(time_t now);
78 #endif
79
80 #endif /* INCLUDED_gline_h */