]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/xline.h
Q-lines fully working, can add and remove other types of ban (but not enforced yet)
[user/henk/code/inspircd.git] / include / xline.h
1 #ifndef __XLINE_H
2 #define __XLINE_H
3
4 // include the common header files
5
6 #include <typeinfo>
7 #include <iostream>
8 #include <string>
9 #include <deque>
10 #include <sstream>
11 #include <vector>
12 #include "users.h"
13 #include "channels.h"
14
15
16 /** XLine is the base class for ban lines such as G lines and K lines.
17  */
18 class XLine : public classbase
19 {
20   public:
21
22         /** The time the line was added.
23          */
24         time_t set_time;
25         
26         /** The duration of the ban, or 0 if permenant
27          */
28         long duration;
29         
30         /** Source of the ban. This can be a servername or an oper nickname
31          */
32         char source[MAXBUF];
33         
34         /** Reason for the ban
35          */
36         char reason[MAXBUF];
37         
38         /** Number of times the core matches the ban, for statistics
39          */
40         long n_matches;
41         
42 };
43
44 /** KLine class
45  */
46 class KLine : public XLine
47 {
48   public:
49         /** Hostmask (ident@host) to match against
50          * May contain wildcards.
51          */
52         char hostmask[MAXBUF];
53 };
54
55 /** GLine class
56  */
57 class GLine : public XLine
58 {
59   public:
60         /** Hostmask (ident@host) to match against
61          * May contain wildcards.
62          */
63         char hostmask[MAXBUF];
64 };
65
66 /** ZLine class
67  */
68 class ZLine : public XLine
69 {
70   public:
71         /** IP Address (xx.yy.zz.aa) to match against
72          * May contain wildcards.
73          */
74         char ipaddr[MAXBUF];
75 };
76
77 /** QLine class
78  */
79 class QLine : public XLine
80 {
81   public:
82         /** Nickname to match against.
83          * May contain wildcards.
84          */
85         char nick[MAXBUF];
86 };
87
88 void read_xline_defaults();
89
90 void add_gline(long duration, char* source, char* reason, char* hostmask);
91 void add_qline(long duration, char* source, char* reason, char* nickname);
92 void add_zline(long duration, char* source, char* reason, char* ipaddr);
93 void add_kline(long duration, char* source, char* reason, char* hostmask);
94
95 bool del_gline(char* hostmask);
96 bool del_qline(char* nickname);
97 bool del_zline(char* ipaddr);
98 bool del_kline(char* hostmask);
99
100 char* matches_qline(const char* nick);
101 char* matches_gline(const char* host);
102 char* matches_zline(const char* ipaddr);
103 char* matches_kline(const char* host);
104
105 void expire_lines();
106 void apply_lines();
107
108 void stats_k(userrec* user);
109 void stats_g(userrec* user);
110 void stats_q(userrec* user);
111 void stats_z(userrec* user);
112
113 #endif
114