1 .TH "chanrec" 3 "20 Apr 2005" "InspIRCd" \" -*- nroff -*-
5 chanrec \- Holds all relevent information for a channel.
11 \fC#include <channels.h>\fP
13 Inherits \fBExtensible\fP.
15 .SS "Public Member Functions"
19 .RI "void \fBSetCustomMode\fP (char mode, bool mode_on)"
21 .RI "\fISets or unsets a custom mode in the channels info. \fP"
23 .RI "void \fBSetCustomModeParam\fP (char mode, char *parameter, bool mode_on)"
25 .RI "\fISets or unsets the parameters for a custom mode in a channels info. \fP"
27 .RI "bool \fBIsCustomModeSet\fP (char mode)"
29 .RI "\fIReturns true if a custom mode is set on a channel. \fP"
31 .RI "std::string \fBGetModeParameter\fP (char mode)"
33 .RI "\fIReturns the parameter for a custom mode on a channel. \fP"
35 .RI "\fBchanrec\fP ()"
37 .RI "\fICreates a channel record and initialises it with default values. \fP"
39 .RI "virtual \fB~chanrec\fP ()"
42 .SS "Public Attributes"
46 .RI "char \fBname\fP [CHANMAX]"
48 .RI "\fIThe channels name. \fP"
50 .RI "char \fBcustom_modes\fP [MAXMODES]"
52 .RI "\fICustom modes for the channel. \fP"
54 .RI "char \fBtopic\fP [MAXBUF]"
56 .RI "\fIChannel topic. \fP"
58 .RI "time_t \fBcreated\fP"
60 .RI "\fICreation time. \fP"
62 .RI "time_t \fBtopicset\fP"
64 .RI "\fITime topic was set. \fP"
66 .RI "char \fBsetby\fP [NICKMAX]"
68 .RI "\fIThe last user to set the topic. \fP"
70 .RI "long \fBlimit\fP"
72 .RI "\fIContains the channel user limit. \fP"
74 .RI "char \fBkey\fP [32]"
76 .RI "\fIContains the channel key. \fP"
78 .RI "short int \fBtopiclock\fP"
80 .RI "\fINonzero if the mode +t is set. \fP"
82 .RI "short int \fBnoexternal\fP"
84 .RI "\fINonzero if the mode +n is set. \fP"
86 .RI "short int \fBinviteonly\fP"
88 .RI "\fINonzero if the mode +i is set. \fP"
90 .RI "short int \fBmoderated\fP"
92 .RI "\fINonzero if the mode +m is set. \fP"
94 .RI "short int \fBsecret\fP"
96 .RI "\fINonzero if the mode +s is set. \fP"
98 .RI "short int \fBc_private\fP"
100 .RI "\fINonzero if the mode +p is set. \fP"
102 .RI "\fBBanList\fP \fBbans\fP"
104 .RI "\fIThe list of all bans set on the channel. \fP"
106 .SH "Detailed Description"
108 Holds all relevent information for a channel.
110 This class represents a channel, and contains its name, modes, time created, topic, topic set time, etc, and an instance of the BanList type.
112 Definition at line 94 of file channels.h.
113 .SH "Constructor & Destructor Documentation"
115 .SS "chanrec::chanrec ()"
117 Creates a channel record and initialises it with default values. Definition at line 113 of file channels.cpp.
119 References c_private, created, custom_modes, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, and topicset.
124 116 strcpy(custom_modes,'');
125 117 strcpy(topic,'');
126 118 strcpy(setby,'');
128 120 created = topicset = limit = 0;
129 121 topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
132 .SS "virtual chanrec::~\fBchanrec\fP ()\fC [inline, virtual]\fP"
134 Definition at line 185 of file channels.h.
139 .SH "Member Function Documentation"
141 .SS "std::string chanrec::GetModeParameter (char mode)"
143 Returns the parameter for a custom mode on a channel. For example if '+L #foo' is set, and you pass this method 'L', it will return '#foo'. If the mode is not set on the channel, or the mode has no parameters associated with it, it will return an empty string.Definition at line 186 of file channels.cpp.
145 References custom_mode_params.
149 188 if (custom_mode_params.size())
151 190 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
153 192 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
155 194 return std::string(i->parameter);
159 198 return std::string('');
162 .SS "bool chanrec::IsCustomModeSet (char mode)"
164 Returns true if a custom mode is set on a channel. Definition at line 180 of file channels.cpp.
170 182 log(DEBUG,'Checking ISCustomModeSet: %c %s',mode,this->custom_modes);
171 183 return (strchr(this->custom_modes,mode) != 0);
174 .SS "void chanrec::SetCustomMode (char mode, bool mode_on)"
176 Sets or unsets a custom mode in the channels info. Definition at line 124 of file channels.cpp.
178 References custom_modes, DEBUG, and SetCustomModeParam().
186 130 if (!strchr(this->custom_modes,mode))
188 132 strlcat(custom_modes,m,MAXMODES);
190 134 log(DEBUG,'Custom mode %c set',mode);
194 138 std::string a = this->custom_modes;
195 139 int pos = a.find(mode);
197 141 strncpy(this->custom_modes,a.c_str(),MAXMODES);
199 143 log(DEBUG,'Custom mode %c removed: modelist='%s'',mode,this->custom_modes);
200 144 this->SetCustomModeParam(mode,'',false);
204 .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)"
206 Sets or unsets the parameters for a custom mode in a channels info. Definition at line 149 of file channels.cpp.
208 References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter.
210 Referenced by SetCustomMode().
215 152 log(DEBUG,'SetCustomModeParam called');
218 155 strlcpy(M.channel,this->name,CHANMAX);
219 156 strlcpy(M.parameter,parameter,MAXBUF);
222 159 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter);
223 160 custom_mode_params.push_back(M);
227 164 if (custom_mode_params.size())
229 166 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
231 168 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
233 170 log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter);
234 171 custom_mode_params.erase(i);
239 176 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!');
243 .SH "Member Data Documentation"
245 .SS "\fBBanList\fP \fBchanrec::bans\fP"
247 The list of all bans set on the channel. Definition at line 159 of file channels.h.
248 .SS "short int \fBchanrec::c_private\fP"
250 Nonzero if the mode +p is set. This value cannot be set at the same time as \fBchanrec::secret\fPDefinition at line 155 of file channels.h.
252 Referenced by chanrec().
253 .SS "time_t \fBchanrec::created\fP"
255 Creation time. Definition at line 111 of file channels.h.
257 Referenced by chanrec().
258 .SS "char \fBchanrec::custom_modes\fP[MAXMODES]"
260 Custom modes for the channel. Plugins may use this field in any way they see fit.Definition at line 103 of file channels.h.
262 Referenced by chanrec(), and SetCustomMode().
263 .SS "short int \fBchanrec::inviteonly\fP"
265 Nonzero if the mode +i is set. Definition at line 141 of file channels.h.
267 Referenced by chanrec().
268 .SS "char \fBchanrec::key\fP[32]"
270 Contains the channel key. If this value is an empty string, there is no channel key in place.Definition at line 129 of file channels.h.
272 Referenced by chanrec().
273 .SS "long \fBchanrec::limit\fP"
275 Contains the channel user limit. If this value is zero, there is no limit in place.Definition at line 124 of file channels.h.
277 Referenced by chanrec().
278 .SS "short int \fBchanrec::moderated\fP"
280 Nonzero if the mode +m is set. Definition at line 145 of file channels.h.
282 Referenced by chanrec().
283 .SS "char \fBchanrec::name\fP[CHANMAX]"
285 The channels name. Definition at line 99 of file channels.h.
287 Referenced by chanrec(), and Server::PseudoToUser().
288 .SS "short int \fBchanrec::noexternal\fP"
290 Nonzero if the mode +n is set. Definition at line 137 of file channels.h.
292 Referenced by chanrec().
293 .SS "short int \fBchanrec::secret\fP"
295 Nonzero if the mode +s is set. This value cannot be set at the same time as \fBchanrec::c_private\fPDefinition at line 150 of file channels.h.
297 Referenced by chanrec().
298 .SS "char \fBchanrec::setby\fP[NICKMAX]"
300 The last user to set the topic. If this member is an empty string, no topic was ever set.Definition at line 119 of file channels.h.
302 Referenced by chanrec(), and Server::PseudoToUser().
303 .SS "char \fBchanrec::topic\fP[MAXBUF]"
305 Channel topic. If this is an empty string, no channel topic is set.Definition at line 108 of file channels.h.
307 Referenced by chanrec(), and Server::PseudoToUser().
308 .SS "short int \fBchanrec::topiclock\fP"
310 Nonzero if the mode +t is set. Definition at line 133 of file channels.h.
312 Referenced by chanrec().
313 .SS "time_t \fBchanrec::topicset\fP"
315 Time topic was set. If no topic was ever set, this will be equal to \fBchanrec::created\fPDefinition at line 115 of file channels.h.
317 Referenced by chanrec(), and Server::PseudoToUser().
321 Generated automatically by Doxygen for InspIRCd from the source code.