]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/xline.h
Updated header comments
[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 /** ZLine class
83  */
84 class ZLine : public XLine
85 {
86   public:
87         /** IP Address (xx.yy.zz.aa) to match against
88          * May contain wildcards.
89          */
90         char ipaddr[MAXBUF];
91         /** Set if this is a global Z:line
92          * (e.g. it came from another server)
93          */
94         bool is_global;
95 };
96
97 /** QLine class
98  */
99 class QLine : public XLine
100 {
101   public:
102         /** Nickname to match against.
103          * May contain wildcards.
104          */
105         char nick[MAXBUF];
106         /** Set if this is a global Z:line
107          * (e.g. it came from another server)
108          */
109         bool is_global;
110 };
111
112 void read_xline_defaults();
113
114 void add_gline(long duration, char* source, char* reason, char* hostmask);
115 void add_qline(long duration, char* source, char* reason, char* nickname);
116 void add_zline(long duration, char* source, char* reason, char* ipaddr);
117 void add_kline(long duration, char* source, char* reason, char* hostmask);
118
119 bool del_gline(char* hostmask);
120 bool del_qline(char* nickname);
121 bool del_zline(char* ipaddr);
122 bool del_kline(char* hostmask);
123
124 char* matches_qline(const char* nick);
125 char* matches_gline(const char* host);
126 char* matches_zline(const char* ipaddr);
127 char* matches_kline(const char* host);
128
129 void expire_lines();
130 void apply_lines();
131
132 void stats_k(userrec* user);
133 void stats_g(userrec* user);
134 void stats_q(userrec* user);
135 void stats_z(userrec* user);
136
137 void gline_set_creation_time(char* host, time_t create_time);
138 void qline_set_creation_time(char* nick, time_t create_time);
139 void zline_set_creation_time(char* ip, time_t create_time);
140
141 bool zline_make_global(char* ipaddr);
142 bool qline_make_global(char* nickname);
143
144 void sync_xlines(serverrec* serv, char* tcp_host);
145
146 #endif
147
148