]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/chanrec.3
Re-added the dot graphs again
[user/henk/code/inspircd.git] / docs / man / man3 / chanrec.3
1 .TH "chanrec" 3 "13 May 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 "long \fBGetUserCounter\fP ()"
36 .br
37 .RI "\fIObtain the channel 'user counter' This returns the channel reference counter, which is initialized to 0 when the channel is created and incremented/decremented upon joins, parts quits and kicks. \fP"
38 .ti -1c
39 .RI "void \fBAddUser\fP (char *castuser)"
40 .br
41 .RI "\fIAdd a user pointer to the internal reference list The data inserted into the reference list is a table as it is an arbitary pointer compared to other users by its memory address, as this is a very fast 32 or 64 bit integer comparison. \fP"
42 .ti -1c
43 .RI "void \fBDelUser\fP (char *castuser)"
44 .br
45 .RI "\fIDelete a user pointer to the internal reference list The data removed from the reference list is a table as it is an arbitary pointer compared to other users by its memory address, as this is a very fast 32 or 64 bit integer comparison. \fP"
46 .ti -1c
47 .RI "std::vector< char * > * \fBGetUsers\fP ()"
48 .br
49 .RI "\fIObrain the internal reference list The internal reference list contains a list of userrec* cast to char*. \fP"
50 .ti -1c
51 .RI "\fBchanrec\fP ()"
52 .br
53 .RI "\fICreates a channel record and initialises it with default values. \fP"
54 .ti -1c
55 .RI "virtual \fB~chanrec\fP ()"
56 .br
57 .in -1c
58 .SS "Public Attributes"
59
60 .in +1c
61 .ti -1c
62 .RI "char \fBname\fP [CHANMAX]"
63 .br
64 .RI "\fIThe channels name. \fP"
65 .ti -1c
66 .RI "char \fBcustom_modes\fP [MAXMODES]"
67 .br
68 .RI "\fICustom modes for the channel. \fP"
69 .ti -1c
70 .RI "std::vector< char * > \fBinternal_userlist\fP"
71 .br
72 .RI "\fIUser list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!). \fP"
73 .ti -1c
74 .RI "char \fBtopic\fP [MAXBUF]"
75 .br
76 .RI "\fIChannel topic. \fP"
77 .ti -1c
78 .RI "time_t \fBcreated\fP"
79 .br
80 .RI "\fICreation time. \fP"
81 .ti -1c
82 .RI "time_t \fBtopicset\fP"
83 .br
84 .RI "\fITime topic was set. \fP"
85 .ti -1c
86 .RI "char \fBsetby\fP [NICKMAX]"
87 .br
88 .RI "\fIThe last user to set the topic. \fP"
89 .ti -1c
90 .RI "short int \fBlimit\fP"
91 .br
92 .RI "\fIContains the channel user limit. \fP"
93 .ti -1c
94 .RI "char \fBkey\fP [32]"
95 .br
96 .RI "\fIContains the channel key. \fP"
97 .ti -1c
98 .RI "char \fBbinarymodes\fP"
99 .br
100 .RI "\fIContains a bitmask of the CM_* builtin (RFC) binary mode symbols. \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 101 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 113 of file channels.cpp.
118 .PP
119 References binarymodes, created, custom_modes, internal_userlist, key, limit, name, setby, topic, and topicset.
120 .PP
121 .nf
122 114 {
123 115         strcpy(name,'');
124 116         strcpy(custom_modes,'');
125 117         strcpy(topic,'');
126 118         strcpy(setby,'');
127 119         strcpy(key,'');
128 120         created = topicset = limit = 0;
129 121         binarymodes = 0;
130 122         internal_userlist.clear();
131 123 }
132 .fi
133 .SS "virtual chanrec::~\fBchanrec\fP ()\fC [inline, virtual]\fP"
134 .PP
135 Definition at line 205 of file channels.h.
136 .PP
137 .nf
138 205 { /* stub */ }
139 .fi
140 .SH "Member Function Documentation"
141 .PP 
142 .SS "void chanrec::AddUser (char * castuser)"
143 .PP
144 Add a user pointer to the internal reference list The data inserted into the reference list is a table as it is an arbitary pointer compared to other users by its memory address, as this is a very fast 32 or 64 bit integer comparison. Definition at line 207 of file channels.cpp.
145 .PP
146 References DEBUG, and internal_userlist.
147 .PP
148 .nf
149 208 {
150 209         internal_userlist.push_back(castuser);
151 210         log(DEBUG,'Added casted user to channel's internal list');
152 211 }
153 .fi
154 .SS "void chanrec::DelUser (char * castuser)"
155 .PP
156 Delete a user pointer to the internal reference list The data removed from the reference list is a table as it is an arbitary pointer compared to other users by its memory address, as this is a very fast 32 or 64 bit integer comparison. Definition at line 213 of file channels.cpp.
157 .PP
158 References DEBUG, internal_userlist, and name.
159 .PP
160 .nf
161 214 {
162 215         for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++)
163 216         {
164 217                 if (*a == castuser)
165 218                 {
166 219                         log(DEBUG,'Removed casted user from channel's internal list');
167 220                         internal_userlist.erase(a);
168 221                         return;
169 222                 }
170 223         }
171 224         log(DEBUG,'BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!',name);
172 225 }
173 .fi
174 .SS "std::string chanrec::GetModeParameter (char mode)"
175 .PP
176 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 187 of file channels.cpp.
177 .PP
178 References custom_mode_params.
179 .PP
180 .nf
181 188 {
182 189         if (custom_mode_params.size())
183 190         {
184 191                 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
185 192                 {
186 193                         if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
187 194                         {
188 195                                 return i->parameter;
189 196                         }
190 197                 }
191 198         }
192 199         return '';
193 200 }
194 .fi
195 .SS "long chanrec::GetUserCounter ()"
196 .PP
197 Obtain the channel 'user counter' This returns the channel reference counter, which is initialized to 0 when the channel is created and incremented/decremented upon joins, parts quits and kicks. Definition at line 202 of file channels.cpp.
198 .PP
199 References internal_userlist.
200 .PP
201 .nf
202 203 {
203 204         return (this->internal_userlist.size());
204 205 }
205 .fi
206 .SS "std::vector< char * > * chanrec::GetUsers ()"
207 .PP
208 Obrain the internal reference list The internal reference list contains a list of userrec* cast to char*. These are used for rapid comparison to determine channel membership for PRIVMSG, NOTICE, QUIT, PART etc. The resulting pointer to the vector should be considered readonly and only modified via AddUser and DelUser.Definition at line 227 of file channels.cpp.
209 .PP
210 References internal_userlist.
211 .PP
212 Referenced by Server::GetUsers().
213 .PP
214 .nf
215 228 {
216 229         return &internal_userlist;
217 230 }
218 .fi
219 .SS "bool chanrec::IsCustomModeSet (char mode)"
220 .PP
221 Returns true if a custom mode is set on a channel. Definition at line 181 of file channels.cpp.
222 .PP
223 References DEBUG.
224 .PP
225 .nf
226 182 {
227 183         log(DEBUG,'Checking ISCustomModeSet: %c %s',mode,this->custom_modes);
228 184         return (strchr(this->custom_modes,mode) != 0);
229 185 }
230 .fi
231 .SS "void chanrec::SetCustomMode (char mode, bool mode_on)"
232 .PP
233 Sets or unsets a custom mode in the channels info. Definition at line 125 of file channels.cpp.
234 .PP
235 References custom_modes, DEBUG, and SetCustomModeParam().
236 .PP
237 .nf
238 126 {
239 127         if (mode_on) {
240 128                 static char m[3];
241 129                 m[0] = mode;
242 130                 m[1] = '\0';
243 131                 if (!strchr(this->custom_modes,mode))
244 132                 {
245 133                         strlcat(custom_modes,m,MAXMODES);
246 134                 }
247 135                 log(DEBUG,'Custom mode %c set',mode);
248 136         }
249 137         else {
250 138 
251 139                 std::string a = this->custom_modes;
252 140                 int pos = a.find(mode);
253 141                 a.erase(pos,1);
254 142                 strncpy(this->custom_modes,a.c_str(),MAXMODES);
255 143 
256 144                 log(DEBUG,'Custom mode %c removed: modelist='%s'',mode,this->custom_modes);
257 145                 this->SetCustomModeParam(mode,'',false);
258 146         }
259 147 }
260 .fi
261 .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)"
262 .PP
263 Sets or unsets the parameters for a custom mode in a channels info. Definition at line 150 of file channels.cpp.
264 .PP
265 References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter.
266 .PP
267 Referenced by SetCustomMode().
268 .PP
269 .nf
270 151 {
271 152 
272 153         log(DEBUG,'SetCustomModeParam called');
273 154         ModeParameter M;
274 155         M.mode = mode;
275 156         strlcpy(M.channel,this->name,CHANMAX);
276 157         strlcpy(M.parameter,parameter,MAXBUF);
277 158         if (mode_on)
278 159         {
279 160                 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter);
280 161                 custom_mode_params.push_back(M);
281 162         }
282 163         else
283 164         {
284 165                 if (custom_mode_params.size())
285 166                 {
286 167                         for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
287 168                         {
288 169                                 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
289 170                                 {
290 171                                         log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter);
291 172                                         custom_mode_params.erase(i);
292 173                                         return;
293 174                                 }
294 175                         }
295 176                 }
296 177                 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!');
297 178         }
298 179 }
299 .fi
300 .SH "Member Data Documentation"
301 .PP 
302 .SS "\fBBanList\fP \fBchanrec::bans\fP"
303 .PP
304 The list of all bans set on the channel. Definition at line 149 of file channels.h.
305 .SS "char \fBchanrec::binarymodes\fP"
306 .PP
307 Contains a bitmask of the CM_* builtin (RFC) binary mode symbols. Definition at line 145 of file channels.h.
308 .PP
309 Referenced by chanrec().
310 .SS "time_t \fBchanrec::created\fP"
311 .PP
312 Creation time. Definition at line 123 of file channels.h.
313 .PP
314 Referenced by chanrec().
315 .SS "char \fBchanrec::custom_modes\fP[MAXMODES]"
316 .PP
317 Custom modes for the channel. Plugins may use this field in any way they see fit.Definition at line 110 of file channels.h.
318 .PP
319 Referenced by chanrec(), and SetCustomMode().
320 .SS "std::vector<char*> \fBchanrec::internal_userlist\fP"
321 .PP
322 User list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!). Definition at line 115 of file channels.h.
323 .PP
324 Referenced by AddUser(), chanrec(), DelUser(), GetUserCounter(), and GetUsers().
325 .SS "char \fBchanrec::key\fP[32]"
326 .PP
327 Contains the channel key. If this value is an empty string, there is no channel key in place.Definition at line 141 of file channels.h.
328 .PP
329 Referenced by chanrec().
330 .SS "short int \fBchanrec::limit\fP"
331 .PP
332 Contains the channel user limit. If this value is zero, there is no limit in place.Definition at line 136 of file channels.h.
333 .PP
334 Referenced by chanrec().
335 .SS "char \fBchanrec::name\fP[CHANMAX]"
336 .PP
337 The channels name. Definition at line 106 of file channels.h.
338 .PP
339 Referenced by chanrec(), DelUser(), and Server::PseudoToUser().
340 .SS "char \fBchanrec::setby\fP[NICKMAX]"
341 .PP
342 The last user to set the topic. If this member is an empty string, no topic was ever set.Definition at line 131 of file channels.h.
343 .PP
344 Referenced by chanrec(), and Server::PseudoToUser().
345 .SS "char \fBchanrec::topic\fP[MAXBUF]"
346 .PP
347 Channel topic. If this is an empty string, no channel topic is set.Definition at line 120 of file channels.h.
348 .PP
349 Referenced by chanrec(), and Server::PseudoToUser().
350 .SS "time_t \fBchanrec::topicset\fP"
351 .PP
352 Time topic was set. If no topic was ever set, this will be equal to \fBchanrec::created\fPDefinition at line 127 of file channels.h.
353 .PP
354 Referenced by chanrec(), and Server::PseudoToUser().
355
356 .SH "Author"
357 .PP 
358 Generated automatically by Doxygen for InspIRCd from the source code.