1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 // include the common header files
31 const int APPLY_GLINES = 1;
32 const int APPLY_KLINES = 2;
33 const int APPLY_QLINES = 4;
34 const int APPLY_ZLINES = 8;
35 const int APPLY_ALL = APPLY_GLINES | APPLY_KLINES | APPLY_QLINES | APPLY_ZLINES;
37 /** XLine is the base class for ban lines such as G lines and K lines.
39 class XLine : public classbase
43 /** The time the line was added.
47 /** The duration of the ban, or 0 if permenant
51 /** Source of the ban. This can be a servername or an oper nickname
55 /** Reason for the ban
59 /** Number of times the core matches the ban, for statistics
67 class KLine : public XLine
70 /** Hostmask (ident@host) to match against
71 * May contain wildcards.
78 class GLine : public XLine
81 /** Hostmask (ident@host) to match against
82 * May contain wildcards.
87 class ELine : public XLine
90 /** Hostmask (ident@host) to match against
91 * May contain wildcards.
98 class ZLine : public XLine
101 /** IP Address (xx.yy.zz.aa) to match against
102 * May contain wildcards.
105 /** Set if this is a global Z:line
106 * (e.g. it came from another server)
113 class QLine : public XLine
116 /** Nickname to match against.
117 * May contain wildcards.
120 /** Set if this is a global Z:line
121 * (e.g. it came from another server)
126 void read_xline_defaults();
128 void add_gline(long duration, const char* source, const char* reason, const char* hostmask);
129 void add_qline(long duration, const char* source, const char* reason, const char* nickname);
130 void add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
131 void add_kline(long duration, const char* source, const char* reason, const char* hostmask);
132 void add_eline(long duration, const char* source, const char* reason, const char* hostmask);
134 bool del_gline(const char* hostmask);
135 bool del_qline(const char* nickname);
136 bool del_zline(const char* ipaddr);
137 bool del_kline(const char* hostmask);
138 bool del_eline(const char* hostmask);
140 char* matches_qline(const char* nick);
141 char* matches_gline(const char* host);
142 char* matches_zline(const char* ipaddr);
143 char* matches_kline(const char* host);
144 char* matches_exception(const char* host);
147 void apply_lines(const int What);
149 void stats_k(userrec* user);
150 void stats_g(userrec* user);
151 void stats_q(userrec* user);
152 void stats_z(userrec* user);
153 void stats_e(userrec* user);
155 void gline_set_creation_time(char* host, time_t create_time);
156 void qline_set_creation_time(char* nick, time_t create_time);
157 void zline_set_creation_time(char* ip, time_t create_time);
158 void eline_set_creation_time(char* host, time_t create_time);
160 bool zline_make_global(const char* ipaddr);
161 bool qline_make_global(const char* nickname);