]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/xline.h
Changed to non-conflicting numeric 948 for invalid idle time
[user/henk/code/inspircd.git] / include / xline.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #ifndef __XLINE_H
18 #define __XLINE_H
19
20 // include the common header files
21
22 #include <typeinfo>
23 #include <iostream>
24 #include <string>
25 #include <deque>
26 #include <sstream>
27 #include <vector>
28 #include "users.h"
29 #include "channels.h"
30
31
32 /** XLine is the base class for ban lines such as G lines and K lines.
33  */
34 class XLine : public classbase
35 {
36   public:
37
38         /** The time the line was added.
39          */
40         time_t set_time;
41         
42         /** The duration of the ban, or 0 if permenant
43          */
44         long duration;
45         
46         /** Source of the ban. This can be a servername or an oper nickname
47          */
48         char source[MAXBUF];
49         
50         /** Reason for the ban
51          */
52         char reason[MAXBUF];
53         
54         /** Number of times the core matches the ban, for statistics
55          */
56         long n_matches;
57         
58 };
59
60 /** KLine class
61  */
62 class KLine : public XLine
63 {
64   public:
65         /** Hostmask (ident@host) to match against
66          * May contain wildcards.
67          */
68         char hostmask[MAXBUF];
69 };
70
71 /** GLine class
72  */
73 class GLine : public XLine
74 {
75   public:
76         /** Hostmask (ident@host) to match against
77          * May contain wildcards.
78          */
79         char hostmask[MAXBUF];
80 };
81
82 class ELine : public XLine
83 {
84   public:
85         /** Hostmask (ident@host) to match against
86          * May contain wildcards.
87          */
88         char hostmask[MAXBUF];
89 };
90
91 /** ZLine class
92  */
93 class ZLine : public XLine
94 {
95   public:
96         /** IP Address (xx.yy.zz.aa) to match against
97          * May contain wildcards.
98          */
99         char ipaddr[MAXBUF];
100         /** Set if this is a global Z:line
101          * (e.g. it came from another server)
102          */
103         bool is_global;
104 };
105
106 /** QLine class
107  */
108 class QLine : public XLine
109 {
110   public:
111         /** Nickname to match against.
112          * May contain wildcards.
113          */
114         char nick[MAXBUF];
115         /** Set if this is a global Z:line
116          * (e.g. it came from another server)
117          */
118         bool is_global;
119 };
120
121 void read_xline_defaults();
122
123 void add_gline(long duration, const char* source, const char* reason, const char* hostmask);
124 void add_qline(long duration, const char* source, const char* reason, const char* nickname);
125 void add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
126 void add_kline(long duration, const char* source, const char* reason, const char* hostmask);
127 void add_eline(long duration, const char* source, const char* reason, const char* hostmask);
128
129 bool del_gline(const char* hostmask);
130 bool del_qline(const char* nickname);
131 bool del_zline(const char* ipaddr);
132 bool del_kline(const char* hostmask);
133 bool del_eline(const char* hostmask);
134
135 char* matches_qline(const char* nick);
136 char* matches_gline(const char* host);
137 char* matches_zline(const char* ipaddr);
138 char* matches_kline(const char* host);
139 char* matches_exception(const char* host);
140
141 void expire_lines();
142 void apply_lines();
143
144 void stats_k(userrec* user);
145 void stats_g(userrec* user);
146 void stats_q(userrec* user);
147 void stats_z(userrec* user);
148 void stats_e(userrec* user);
149
150 void gline_set_creation_time(char* host, time_t create_time);
151 void qline_set_creation_time(char* nick, time_t create_time);
152 void zline_set_creation_time(char* ip, time_t create_time);
153
154 bool zline_make_global(const char* ipaddr);
155 bool qline_make_global(const char* nickname);
156
157 void sync_xlines(serverrec* serv, char* tcp_host);
158
159 #endif