]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/channels.h
Possible Bugfix.. stop the IRCd from launching if the quotes file aint
[user/henk/code/inspircd.git] / include / channels.h
1 /*
2
3    
4 */
5
6 #include "inspircd_config.h"
7 #include "base.h"
8 #include <time.h>
9 #include <vector>
10
11 #ifndef __CHANNELS_H__
12 #define __CHANNELS_H__
13
14 /** Holds an entry for a ban list, exemption list, or invite list.
15  * This class contains a single element in a channel list, such as a banlist.
16  */
17 class HostItem : public classbase
18 {
19  public:
20         time_t set_time;
21         char set_by[NICKMAX];
22         char data[MAXBUF];
23
24         HostItem() { /* stub */ }
25         virtual ~HostItem() { /* stub */ }
26 };
27
28 // banlist is inherited from HostList mainly for readability
29 // reasons only
30
31 /** A subclass of HostItem designed to hold channel bans (+b)
32  */
33 class BanItem : public HostItem
34 {
35 };
36
37 // same with this...
38
39 /** A subclass of HostItem designed to hold channel exempts (+e)
40  */
41 class ExemptItem : public HostItem
42 {
43 };
44
45 // and this...
46
47 /** A subclass of HostItem designed to hold channel invites (+I)
48  */
49 class InviteItem : public HostItem
50 {
51 };
52
53
54 /** Holds a complete ban list
55  */
56 typedef std::vector<BanItem>    BanList;
57
58 /** Holds a complete exempt list
59  */
60 typedef std::vector<ExemptItem> ExemptList;
61
62 /** Holds a complete invite list
63  */
64 typedef std::vector<InviteItem> InviteList;
65
66 /** Holds all relevent information for a channel.
67  * This class represents a channel, and contains its name, modes, time created, topic, topic set time,
68  * etc, and an instance of the BanList type.
69  */
70 class chanrec : public classbase
71 {
72  public:
73         /** The channels name.
74          */
75         char name[CHANMAX]; /* channel name */
76         /** Custom modes for the channel.
77          * Plugins may use this field in any way they see fit.
78          */
79         char custom_modes[MAXMODES];     /* modes handled by modules */
80         /** Channel topic.
81          * If this is an empty string, no channel topic is set.
82          */
83         char topic[MAXBUF];
84         /** Creation time.
85          */
86         time_t created;
87         /** Time topic was set.
88          * If no topic was ever set, this will be equal to chanrec::created
89          */
90         time_t topicset;
91         /** The last user to set the topic.
92          * If this member is an empty string, no topic was ever set.
93          */
94         char setby[NICKMAX];
95
96         /** Contains the channel user limit.
97          * If this value is zero, there is no limit in place.
98          */
99         long limit;
100         
101         /** Contains the channel key.
102          * If this value is an empty string, there is no channel key in place.
103          */
104         char key[32];
105         
106         /** Nonzero if the mode +t is set.
107          */
108         short int topiclock;
109         
110         /** Nonzero if the mode +n is set.
111          */
112         short int noexternal;
113         
114         /** Nonzero if the mode +i is set.
115          */
116         short int inviteonly;
117         
118         /** Nonzero if the mode +m is set.
119          */
120         short int moderated;
121         
122         /** Nonzero if the mode +s is set.
123          * This value cannot be set at the same time as chanrec::c_private
124          */
125         short int secret;
126         
127         /** Nonzero if the mode +p is set.
128          * This value cannot be set at the same time as chanrec::secret
129          */
130         short int c_private;
131         
132         /** The list of all bans set on the channel.
133          */
134         BanList bans;
135
136         /** Sets or unsets a custom mode in the channels info
137          */
138         void SetCustomMode(char mode,bool mode_on);
139
140         /** Sets or unsets the parameterrs for a custom mode in a channels info
141          */
142         void SetCustomModeParam(char mode,char* parameter,bool mode_on);
143  
144         /** Creates a channel record and initialises it with default values
145          */
146         chanrec();
147
148         virtual ~chanrec() { /* stub */ }
149 };
150
151 /* used to hold a channel and a users modes on that channel, e.g. +v, +h, +o
152  * needs to come AFTER struct chanrec */
153
154 #define UCMODE_OP      1
155 #define UCMODE_VOICE   2
156 #define UCMODE_HOP     4
157 #define UCMODE_PROTECT 8
158 #define UCMODE_FOUNDER 16
159  
160 /** Holds a user's modes on a channel
161  * This class associates a users privilages with a channel by creating a pointer link between
162  * a userrec and chanrec class. The uc_modes member holds a bitmask of which privilages the user
163  * has on the channel, such as op, voice, etc.
164  */
165 class ucrec : public classbase
166 {
167  public:
168         /** Contains a bitmask of the UCMODE_OP ... UCMODE_FOUNDER values.
169          * If this value is zero, the user has no privilages upon the channel.
170          */
171         long uc_modes;
172         
173         /** Points to the channel record where the given modes apply.
174          * If the record is not in use, this value will be NULL.
175          */
176         chanrec *channel;
177
178         ucrec() { /* stub */ }
179         virtual ~ucrec() { /* stub */ }
180 };
181
182 #endif
183