]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/chanrec.3
Updated documentation (manpages)
[user/henk/code/inspircd.git] / docs / man / man3 / chanrec.3
1 .TH "chanrec" 3 "28 Mar 2005" "InspIRCd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 chanrec \- Holds all relevent information for a channel.  
6
7 .PP
8 .SH SYNOPSIS
9 .br
10 .PP
11 \fC#include <channels.h>\fP
12 .PP
13 Inherits \fBExtensible\fP.
14 .PP
15 .SS "Public Member Functions"
16
17 .in +1c
18 .ti -1c
19 .RI "void \fBSetCustomMode\fP (char mode, bool mode_on)"
20 .br
21 .RI "\fISets or unsets a custom mode in the channels info. \fP"
22 .ti -1c
23 .RI "void \fBSetCustomModeParam\fP (char mode, char *parameter, bool mode_on)"
24 .br
25 .RI "\fISets or unsets the parameters for a custom mode in a channels info. \fP"
26 .ti -1c
27 .RI "bool \fBIsCustomModeSet\fP (char mode)"
28 .br
29 .RI "\fIReturns true if a custom mode is set on a channel. \fP"
30 .ti -1c
31 .RI "std::string \fBGetModeParameter\fP (char mode)"
32 .br
33 .RI "\fIReturns the parameter for a custom mode on a channel. \fP"
34 .ti -1c
35 .RI "\fBchanrec\fP ()"
36 .br
37 .RI "\fICreates a channel record and initialises it with default values. \fP"
38 .ti -1c
39 .RI "virtual \fB~chanrec\fP ()"
40 .br
41 .in -1c
42 .SS "Public Attributes"
43
44 .in +1c
45 .ti -1c
46 .RI "char \fBname\fP [CHANMAX]"
47 .br
48 .RI "\fIThe channels name. \fP"
49 .ti -1c
50 .RI "char \fBcustom_modes\fP [MAXMODES]"
51 .br
52 .RI "\fICustom modes for the channel. \fP"
53 .ti -1c
54 .RI "char \fBtopic\fP [MAXBUF]"
55 .br
56 .RI "\fIChannel topic. \fP"
57 .ti -1c
58 .RI "time_t \fBcreated\fP"
59 .br
60 .RI "\fICreation time. \fP"
61 .ti -1c
62 .RI "time_t \fBtopicset\fP"
63 .br
64 .RI "\fITime topic was set. \fP"
65 .ti -1c
66 .RI "char \fBsetby\fP [NICKMAX]"
67 .br
68 .RI "\fIThe last user to set the topic. \fP"
69 .ti -1c
70 .RI "long \fBlimit\fP"
71 .br
72 .RI "\fIContains the channel user limit. \fP"
73 .ti -1c
74 .RI "char \fBkey\fP [32]"
75 .br
76 .RI "\fIContains the channel key. \fP"
77 .ti -1c
78 .RI "short int \fBtopiclock\fP"
79 .br
80 .RI "\fINonzero if the mode +t is set. \fP"
81 .ti -1c
82 .RI "short int \fBnoexternal\fP"
83 .br
84 .RI "\fINonzero if the mode +n is set. \fP"
85 .ti -1c
86 .RI "short int \fBinviteonly\fP"
87 .br
88 .RI "\fINonzero if the mode +i is set. \fP"
89 .ti -1c
90 .RI "short int \fBmoderated\fP"
91 .br
92 .RI "\fINonzero if the mode +m is set. \fP"
93 .ti -1c
94 .RI "short int \fBsecret\fP"
95 .br
96 .RI "\fINonzero if the mode +s is set. \fP"
97 .ti -1c
98 .RI "short int \fBc_private\fP"
99 .br
100 .RI "\fINonzero if the mode +p is set. \fP"
101 .ti -1c
102 .RI "\fBBanList\fP \fBbans\fP"
103 .br
104 .RI "\fIThe list of all bans set on the channel. \fP"
105 .in -1c
106 .SH "Detailed Description"
107 .PP 
108 Holds all relevent information for a channel. 
109
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. 
111 .PP
112 Definition at line 94 of file channels.h.
113 .SH "Constructor & Destructor Documentation"
114 .PP 
115 .SS "chanrec::chanrec ()"
116 .PP
117 Creates a channel record and initialises it with default values. Definition at line 112 of file channels.cpp.
118 .PP
119 References c_private, created, custom_modes, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, and topicset.
120 .PP
121 .nf
122 113 {
123 114         strcpy(name,'');
124 115         strcpy(custom_modes,'');
125 116         strcpy(topic,'');
126 117         strcpy(setby,'');
127 118         strcpy(key,'');
128 119         created = topicset = limit = 0;
129 120         topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
130 121 }
131 .fi
132 .SS "virtual chanrec::~\fBchanrec\fP ()\fC [inline, virtual]\fP"
133 .PP
134 Definition at line 185 of file channels.h.
135 .PP
136 .nf
137 185 { /* stub */ }
138 .fi
139 .SH "Member Function Documentation"
140 .PP 
141 .SS "std::string chanrec::GetModeParameter (char mode)"
142 .PP
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 185 of file channels.cpp.
144 .PP
145 References custom_mode_params.
146 .PP
147 .nf
148 186 {
149 187         if (custom_mode_params.size())
150 188         {
151 189                 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
152 190                 {
153 191                         if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
154 192                         {
155 193                                 return std::string(i->parameter);
156 194                         }
157 195                 }
158 196         }
159 197         return std::string('');
160 198 }
161 .fi
162 .SS "bool chanrec::IsCustomModeSet (char mode)"
163 .PP
164 Returns true if a custom mode is set on a channel. Definition at line 179 of file channels.cpp.
165 .PP
166 References DEBUG.
167 .PP
168 .nf
169 180 {
170 181         log(DEBUG,'Checking ISCustomModeSet: %c %s',mode,this->custom_modes);
171 182         return (strchr(this->custom_modes,mode) != 0);
172 183 }
173 .fi
174 .SS "void chanrec::SetCustomMode (char mode, bool mode_on)"
175 .PP
176 Sets or unsets a custom mode in the channels info. Definition at line 123 of file channels.cpp.
177 .PP
178 References custom_modes, DEBUG, and SetCustomModeParam().
179 .PP
180 .nf
181 124 {
182 125         if (mode_on) {
183 126                 char m[3];
184 127                 m[0] = mode;
185 128                 m[1] = '\0';
186 129                 if (!strchr(this->custom_modes,mode))
187 130                 {
188 131                         strlcat(custom_modes,m,MAXMODES);
189 132                 }
190 133                 log(DEBUG,'Custom mode %c set',mode);
191 134         }
192 135         else {
193 136 
194 137                 std::string a = this->custom_modes;
195 138                 int pos = a.find(mode);
196 139                 a.erase(pos,1);
197 140                 strncpy(this->custom_modes,a.c_str(),MAXMODES);
198 141 
199 142                 log(DEBUG,'Custom mode %c removed: modelist='%s'',mode,this->custom_modes);
200 143                 this->SetCustomModeParam(mode,'',false);
201 144         }
202 145 }
203 .fi
204 .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)"
205 .PP
206 Sets or unsets the parameters for a custom mode in a channels info. Definition at line 148 of file channels.cpp.
207 .PP
208 References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter.
209 .PP
210 Referenced by SetCustomMode().
211 .PP
212 .nf
213 149 {
214 150 
215 151         log(DEBUG,'SetCustomModeParam called');
216 152         ModeParameter M;
217 153         M.mode = mode;
218 154         strlcpy(M.channel,this->name,CHANMAX);
219 155         strlcpy(M.parameter,parameter,MAXBUF);
220 156         if (mode_on)
221 157         {
222 158                 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter);
223 159                 custom_mode_params.push_back(M);
224 160         }
225 161         else
226 162         {
227 163                 if (custom_mode_params.size())
228 164                 {
229 165                         for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
230 166                         {
231 167                                 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
232 168                                 {
233 169                                         log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter);
234 170                                         custom_mode_params.erase(i);
235 171                                         return;
236 172                                 }
237 173                         }
238 174                 }
239 175                 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!');
240 176         }
241 177 }
242 .fi
243 .SH "Member Data Documentation"
244 .PP 
245 .SS "\fBBanList\fP \fBchanrec::bans\fP"
246 .PP
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"
249 .PP
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.
251 .PP
252 Referenced by chanrec().
253 .SS "time_t \fBchanrec::created\fP"
254 .PP
255 Creation time. Definition at line 111 of file channels.h.
256 .PP
257 Referenced by chanrec().
258 .SS "char \fBchanrec::custom_modes\fP[MAXMODES]"
259 .PP
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.
261 .PP
262 Referenced by chanrec(), and SetCustomMode().
263 .SS "short int \fBchanrec::inviteonly\fP"
264 .PP
265 Nonzero if the mode +i is set. Definition at line 141 of file channels.h.
266 .PP
267 Referenced by chanrec().
268 .SS "char \fBchanrec::key\fP[32]"
269 .PP
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.
271 .PP
272 Referenced by chanrec().
273 .SS "long \fBchanrec::limit\fP"
274 .PP
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.
276 .PP
277 Referenced by chanrec().
278 .SS "short int \fBchanrec::moderated\fP"
279 .PP
280 Nonzero if the mode +m is set. Definition at line 145 of file channels.h.
281 .PP
282 Referenced by chanrec().
283 .SS "char \fBchanrec::name\fP[CHANMAX]"
284 .PP
285 The channels name. Definition at line 99 of file channels.h.
286 .PP
287 Referenced by chanrec().
288 .SS "short int \fBchanrec::noexternal\fP"
289 .PP
290 Nonzero if the mode +n is set. Definition at line 137 of file channels.h.
291 .PP
292 Referenced by chanrec().
293 .SS "short int \fBchanrec::secret\fP"
294 .PP
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.
296 .PP
297 Referenced by chanrec().
298 .SS "char \fBchanrec::setby\fP[NICKMAX]"
299 .PP
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.
301 .PP
302 Referenced by chanrec().
303 .SS "char \fBchanrec::topic\fP[MAXBUF]"
304 .PP
305 Channel topic. If this is an empty string, no channel topic is set.Definition at line 108 of file channels.h.
306 .PP
307 Referenced by chanrec().
308 .SS "short int \fBchanrec::topiclock\fP"
309 .PP
310 Nonzero if the mode +t is set. Definition at line 133 of file channels.h.
311 .PP
312 Referenced by chanrec().
313 .SS "time_t \fBchanrec::topicset\fP"
314 .PP
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.
316 .PP
317 Referenced by chanrec().
318
319 .SH "Author"
320 .PP 
321 Generated automatically by Doxygen for InspIRCd from the source code.