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 bool InitXLine(const char* tag);
127 bool DoneXLine(const char* tag);
129 bool DoZLine(const char* tag, char** entries, void** values, int* types);
130 bool DoQLine(const char* tag, char** entries, void** values, int* types);
131 bool DoKLine(const char* tag, char** entries, void** values, int* types);
132 bool DoELine(const char* tag, char** entries, void** values, int* types);
134 bool add_gline(long duration, const char* source, const char* reason, const char* hostmask);
135 bool add_qline(long duration, const char* source, const char* reason, const char* nickname);
136 bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
137 bool add_kline(long duration, const char* source, const char* reason, const char* hostmask);
138 bool add_eline(long duration, const char* source, const char* reason, const char* hostmask);
140 bool del_gline(const char* hostmask);
141 bool del_qline(const char* nickname);
142 bool del_zline(const char* ipaddr);
143 bool del_kline(const char* hostmask);
144 bool del_eline(const char* hostmask);
146 char* matches_qline(const char* nick);
147 char* matches_gline(const char* host);
148 char* matches_zline(const char* ipaddr);
149 char* matches_kline(const char* host);
150 char* matches_exception(const char* host);
153 void apply_lines(const int What);
155 void stats_k(userrec* user);
156 void stats_g(userrec* user);
157 void stats_q(userrec* user);
158 void stats_z(userrec* user);
159 void stats_e(userrec* user);
161 void gline_set_creation_time(const char* host, time_t create_time);
162 void qline_set_creation_time(const char* nick, time_t create_time);
163 void zline_set_creation_time(const char* ip, time_t create_time);
164 void eline_set_creation_time(const char* host, time_t create_time);
166 bool zline_make_global(const char* ipaddr);
167 bool qline_make_global(const char* nickname);