6 #include "inspircd_config.h"
12 #ifndef __CHANNELS_H__
13 #define __CHANNELS_H__
15 /** Holds an entry for a ban list, exemption list, or invite list.
16 * This class contains a single element in a channel list, such as a banlist.
18 class HostItem : public classbase
25 HostItem() { /* stub */ }
26 virtual ~HostItem() { /* stub */ }
29 // banlist is inherited from HostList mainly for readability
32 /** A subclass of HostItem designed to hold channel bans (+b)
34 class BanItem : public HostItem
40 /** A subclass of HostItem designed to hold channel exempts (+e)
42 class ExemptItem : public HostItem
48 /** A subclass of HostItem designed to hold channel invites (+I)
50 class InviteItem : public HostItem
55 /** Holds a custom parameter to a module-defined channel mode
56 * e.g. for +L this would hold the channel name.
59 class ModeParameter : public classbase
63 char parameter[MAXBUF];
64 char channel[CHANMAX];
67 /** Holds a complete ban list
69 typedef std::vector<BanItem> BanList;
71 /** Holds a complete exempt list
73 typedef std::vector<ExemptItem> ExemptList;
75 /** Holds a complete invite list
77 typedef std::vector<InviteItem> InviteList;
79 /** Holds all relevent information for a channel.
80 * This class represents a channel, and contains its name, modes, time created, topic, topic set time,
81 * etc, and an instance of the BanList type.
83 class chanrec : public Extensible
86 /** The channels name.
88 char name[CHANMAX]; /* channel name */
89 /** Custom modes for the channel.
90 * Plugins may use this field in any way they see fit.
92 char custom_modes[MAXMODES]; /* modes handled by modules */
95 * If this is an empty string, no channel topic is set.
101 /** Time topic was set.
102 * If no topic was ever set, this will be equal to chanrec::created
105 /** The last user to set the topic.
106 * If this member is an empty string, no topic was ever set.
110 /** Contains the channel user limit.
111 * If this value is zero, there is no limit in place.
115 /** Contains the channel key.
116 * If this value is an empty string, there is no channel key in place.
120 /** Nonzero if the mode +t is set.
124 /** Nonzero if the mode +n is set.
126 short int noexternal;
128 /** Nonzero if the mode +i is set.
130 short int inviteonly;
132 /** Nonzero if the mode +m is set.
136 /** Nonzero if the mode +s is set.
137 * This value cannot be set at the same time as chanrec::c_private
141 /** Nonzero if the mode +p is set.
142 * This value cannot be set at the same time as chanrec::secret
146 /** The list of all bans set on the channel.
150 /** Sets or unsets a custom mode in the channels info
152 void SetCustomMode(char mode,bool mode_on);
154 /** Sets or unsets the parameters for a custom mode in a channels info
156 void SetCustomModeParam(char mode,char* parameter,bool mode_on);
158 /** Returns true if a custom mode is set on a channel
160 bool IsCustomModeSet(char mode);
162 /** Returns the parameter for a custom mode on a channel.
163 * For example if "+L #foo" is set, and you pass this method
164 * 'L', it will return '#foo'. If the mode is not set on the
165 * channel, or the mode has no parameters associated with it,
166 * it will return an empty string.
168 std::string GetModeParameter(char mode);
170 /** Creates a channel record and initialises it with default values
174 virtual ~chanrec() { /* stub */ }
177 /* used to hold a channel and a users modes on that channel, e.g. +v, +h, +o
178 * needs to come AFTER struct chanrec */
181 #define UCMODE_VOICE 2
183 #define UCMODE_PROTECT 8
184 #define UCMODE_FOUNDER 16
186 /** Holds a user's modes on a channel
187 * This class associates a users privilages with a channel by creating a pointer link between
188 * a userrec and chanrec class. The uc_modes member holds a bitmask of which privilages the user
189 * has on the channel, such as op, voice, etc.
191 class ucrec : public Extensible
194 /** Contains a bitmask of the UCMODE_OP ... UCMODE_FOUNDER values.
195 * If this value is zero, the user has no privilages upon the channel.
199 /** Points to the channel record where the given modes apply.
200 * If the record is not in use, this value will be NULL.
204 ucrec() { /* stub */ }
205 virtual ~ucrec() { /* stub */ }