1 .TH "chanrec" 3 "30 Apr 2004" "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 83 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 12 of file channels.cpp.
119 References c_private, created, inviteonly, limit, moderated, noexternal, secret, topiclock, and topicset.
124 15 strcpy(custom_modes,'');
128 19 created = topicset = limit = 0;
129 20 topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
132 .SS "virtual chanrec::~chanrec ()\fC [inline, virtual]\fP"
134 Definition at line 174 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 87 of file channels.cpp.
145 References custom_mode_params.
149 89 if (custom_mode_params.size())
151 91 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
153 93 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
155 95 return std::string(i->parameter);
159 99 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 81 of file channels.cpp.
168 83 log(DEBUG,'Checking ISCustomModeSet: %c %s',mode,this->custom_modes);
169 84 return (strchr(this->custom_modes,mode) != 0);
172 .SS "void chanrec::SetCustomMode (char mode, bool mode_on)"
174 Sets or unsets a custom mode in the channels info.Definition at line 23 of file channels.cpp.
176 References custom_modes, and SetCustomModeParam().
184 29 if (!strchr(this->custom_modes,mode))
186 31 strncat(custom_modes,m,MAXMODES);
188 33 log(DEBUG,'Custom mode %c set',mode);
191 36 char temp[MAXBUF];
193 38 for (int q = 0; q < strlen(custom_modes); q++) {
194 39 if (custom_modes[q] != mode) {
195 40 temp[count++] = mode;
198 43 temp[count] = '\0';
199 44 strncpy(custom_modes,temp,MAXMODES);
200 45 log(DEBUG,'Custom mode %c removed',mode);
201 46 this->SetCustomModeParam(mode,'',false);
205 .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)"
207 Sets or unsets the parameters for a custom mode in a channels info.Definition at line 50 of file channels.cpp.
209 References ModeParameter::channel, custom_mode_params, ModeParameter::mode, and ModeParameter::parameter.
211 Referenced by SetCustomMode().
216 53 log(DEBUG,'SetCustomModeParam called');
219 56 strcpy(M.channel,this->name);
220 57 strcpy(M.parameter,parameter);
223 60 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter);
224 61 custom_mode_params.push_back(M);
228 65 if (custom_mode_params.size())
230 67 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
232 69 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
234 71 log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter);
235 72 custom_mode_params.erase(i);
240 77 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!');
244 .SH "Member Data Documentation"
246 .SS "\fBBanList\fP chanrec::bans"
248 The list of all bans set on the channel.Definition at line 148 of file channels.h.
249 .SS "short int chanrec::c_private"
251 Nonzero if the mode +p is set.This value cannot be set at the same time as \fBchanrec::secret\fPDefinition at line 144 of file channels.h.
253 Referenced by chanrec().
254 .SS "time_t chanrec::created"
256 Creation time.Definition at line 100 of file channels.h.
258 Referenced by chanrec().
259 .SS "char chanrec::custom_modes[MAXMODES]"
261 Custom modes for the channel.Plugins may use this field in any way they see fit.Definition at line 92 of file channels.h.
263 Referenced by SetCustomMode().
264 .SS "short int chanrec::inviteonly"
266 Nonzero if the mode +i is set.Definition at line 130 of file channels.h.
268 Referenced by chanrec().
269 .SS "char chanrec::key[32]"
271 Contains the channel key.If this value is an empty string, there is no channel key in place.Definition at line 118 of file channels.h.
272 .SS "long chanrec::limit"
274 Contains the channel user limit.If this value is zero, there is no limit in place.Definition at line 113 of file channels.h.
276 Referenced by chanrec().
277 .SS "short int chanrec::moderated"
279 Nonzero if the mode +m is set.Definition at line 134 of file channels.h.
281 Referenced by chanrec().
282 .SS "char chanrec::name[CHANMAX]"
284 The channels name.Definition at line 88 of file channels.h.
285 .SS "short int chanrec::noexternal"
287 Nonzero if the mode +n is set.Definition at line 126 of file channels.h.
289 Referenced by chanrec().
290 .SS "short int chanrec::secret"
292 Nonzero if the mode +s is set.This value cannot be set at the same time as \fBchanrec::c_private\fPDefinition at line 139 of file channels.h.
294 Referenced by chanrec().
295 .SS "char chanrec::setby[NICKMAX]"
297 The last user to set the topic.If this member is an empty string, no topic was ever set.Definition at line 108 of file channels.h.
298 .SS "char chanrec::topic[MAXBUF]"
300 Channel topic.If this is an empty string, no channel topic is set.Definition at line 97 of file channels.h.
301 .SS "short int chanrec::topiclock"
303 Nonzero if the mode +t is set.Definition at line 122 of file channels.h.
305 Referenced by chanrec().
306 .SS "time_t chanrec::topicset"
308 Time topic was set.If no topic was ever set, this will be equal to \fBchanrec::created\fPDefinition at line 104 of file channels.h.
310 Referenced by chanrec().
314 Generated automatically by Doxygen for InspIRCd from the source code.