1 .TH "chanrec" 3 "15 Dec 2005" "Version 1.0Betareleases" "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 "\fBstd::string\fP \fBGetModeParameter\fP (char mode)"
33 .RI "\fIReturns the parameter for a custom mode on a channel. \fP"
35 .RI "long \fBGetUserCounter\fP ()"
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"
39 .RI "void \fBAddUser\fP (char *castuser)"
41 .RI "\fIAdd a user pointer to the internal reference list. \fP"
43 .RI "void \fBDelUser\fP (char *castuser)"
45 .RI "\fIDelete a user pointer to the internal reference list. \fP"
47 .RI "std::vector< char * > * \fBGetUsers\fP ()"
49 .RI "\fIObrain the internal reference list The internal reference list contains a list of userrec* cast to char*. \fP"
51 .RI "\fBchanrec\fP ()"
53 .RI "\fICreates a channel record and initialises it with default values. \fP"
55 .RI "virtual \fB~chanrec\fP ()"
58 .SS "Public Attributes"
62 .RI "char \fBname\fP [CHANMAX]"
64 .RI "\fIThe channels name. \fP"
66 .RI "char \fBcustom_modes\fP [MAXMODES]"
68 .RI "\fICustom modes for the channel. \fP"
70 .RI "std::vector< char * > \fBinternal_userlist\fP"
72 .RI "\fIUser list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!). \fP"
74 .RI "char \fBtopic\fP [MAXBUF]"
76 .RI "\fIChannel topic. \fP"
78 .RI "time_t \fBcreated\fP"
80 .RI "\fICreation time. \fP"
82 .RI "time_t \fBtopicset\fP"
84 .RI "\fITime topic was set. \fP"
86 .RI "char \fBsetby\fP [NICKMAX]"
88 .RI "\fIThe last user to set the topic. \fP"
90 .RI "short int \fBlimit\fP"
92 .RI "\fIContains the channel user limit. \fP"
94 .RI "char \fBkey\fP [32]"
96 .RI "\fIContains the channel key. \fP"
98 .RI "char \fBbinarymodes\fP"
100 .RI "\fIContains a bitmask of the CM_* builtin (RFC) binary mode symbols. \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 103 of file channels.h.
113 .SH "Constructor & Destructor Documentation"
115 .SS "chanrec::chanrec ()"
117 Creates a channel record and initialises it with default values.
119 Definition at line 74 of file channels.cpp.
121 References binarymodes, created, custom_modes, internal_userlist, key, limit, name, setby, topic, and topicset.
126 77 strcpy(custom_modes,'');
130 81 created = topicset = limit = 0;
132 83 internal_userlist.clear();
136 .SS "virtual chanrec::~chanrec ()\fC [inline, virtual]\fP"
138 Definition at line 226 of file channels.h.
144 .SH "Member Function Documentation"
146 .SS "void chanrec::AddUser (char * castuser)"
148 Add a user pointer to the internal reference list.
152 \fIcastuser\fP This should be a pointer to a userrec, casted to char*
155 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.
157 Definition at line 167 of file channels.cpp.
159 References DEBUG, internal_userlist, and log().
161 Referenced by ForceChan().
165 169 internal_userlist.push_back(castuser);
166 170 log(DEBUG,'Added casted user to channel's internal list');
170 .SS "void chanrec::DelUser (char * castuser)"
172 Delete a user pointer to the internal reference list.
176 \fIcastuser\fP This should be a pointer to a userrec, casted to char*
179 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.
181 Definition at line 173 of file channels.cpp.
183 References DEBUG, internal_userlist, log(), and name.
185 Referenced by del_channel(), and kick_channel().
189 175 for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++)
191 177 if (*a == castuser)
193 179 log(DEBUG,'Removed casted user from channel's internal list');
194 180 internal_userlist.erase(a);
198 184 log(DEBUG,'BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!',name);
202 .SS "\fBstd::string\fP chanrec::GetModeParameter (char mode)"
204 Returns the parameter for a custom mode on a channel.
208 \fImode\fP The mode character you wish to query
211 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.
215 The parameter for this mode is returned, or an empty string
220 Definition at line 147 of file channels.cpp.
222 References custom_mode_params.
226 149 if (custom_mode_params.size())
228 151 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
230 153 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
232 155 return i->parameter;
240 .SS "long chanrec::GetUserCounter ()"
242 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.
246 The number of users on this channel
251 Definition at line 162 of file channels.cpp.
255 164 return (this->internal_userlist.size());
259 .SS "std::vector< char * > * chanrec::GetUsers ()"
261 Obrain the internal reference list The internal reference list contains a list of userrec* cast to char*.
263 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.
267 This function returns a vector of userrec pointers, each of which has been casted to char* to prevent circular references
272 Definition at line 187 of file channels.cpp.
274 References internal_userlist.
276 Referenced by Server::GetUsers().
280 189 return &internal_userlist;
284 .SS "bool chanrec::IsCustomModeSet (char mode)"
286 Returns true if a custom mode is set on a channel.
290 \fImode\fP The mode character you wish to query
295 True if the custom mode is set, false if otherwise
300 Definition at line 142 of file channels.cpp.
304 144 return (strchr(this->custom_modes,mode));
308 .SS "void chanrec::SetCustomMode (char mode, bool mode_on)"
310 Sets or unsets a custom mode in the channels info.
314 \fImode\fP The mode character to set or unset
316 \fImode_on\fP True if you want to set the mode or false if you want to remove it
321 Definition at line 86 of file channels.cpp.
323 References custom_modes, DEBUG, log(), and SetCustomModeParam().
331 92 if (!strchr(this->custom_modes,mode))
333 94 strlcat(custom_modes,m,MAXMODES);
335 96 log(DEBUG,'Custom mode %c set',mode);
339 100 std::string a = this->custom_modes;
340 101 int pos = a.find(mode);
342 103 strncpy(this->custom_modes,a.c_str(),MAXMODES);
344 105 log(DEBUG,'Custom mode %c removed: modelist='%s'',mode,this->custom_modes);
345 106 this->SetCustomModeParam(mode,'',false);
350 .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)"
352 Sets or unsets the parameters for a custom mode in a channels info.
356 \fImode\fP The mode character to set or unset
358 \fIparameter\fP The parameter string to associate with this mode character
360 \fImode_on\fP True if you want to set the mode or false if you want to remove it
365 Definition at line 111 of file channels.cpp.
367 References ModeParameter::channel, custom_mode_params, DEBUG, log(), ModeParameter::mode, and ModeParameter::parameter.
369 Referenced by SetCustomMode().
374 114 log(DEBUG,'SetCustomModeParam called');
377 117 strlcpy(M.channel,this->name,CHANMAX);
378 118 strlcpy(M.parameter,parameter,MAXBUF);
381 121 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter);
382 122 custom_mode_params.push_back(M);
386 126 if (custom_mode_params.size())
388 128 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
390 130 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
392 132 log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter);
393 133 custom_mode_params.erase(i);
398 138 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!');
403 .SH "Member Data Documentation"
405 .SS "\fBBanList\fP \fBchanrec::bans\fP"
407 The list of all bans set on the channel.
409 Definition at line 151 of file channels.h.
411 Referenced by add_channel().
412 .SS "char \fBchanrec::binarymodes\fP"
414 Contains a bitmask of the CM_* builtin (RFC) binary mode symbols.
416 Definition at line 147 of file channels.h.
418 Referenced by add_channel(), and chanrec().
419 .SS "time_t \fBchanrec::created\fP"
423 Definition at line 125 of file channels.h.
425 Referenced by chanrec().
426 .SS "char \fBchanrec::custom_modes\fP[MAXMODES]"
428 Custom modes for the channel.
430 Plugins may use this field in any way they see fit.
432 Definition at line 112 of file channels.h.
434 Referenced by chanrec(), and SetCustomMode().
435 .SS "std::vector<char*> \fBchanrec::internal_userlist\fP"
437 User list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!).
439 Definition at line 117 of file channels.h.
441 Referenced by AddUser(), chanrec(), DelUser(), and GetUsers().
442 .SS "char \fBchanrec::key\fP[32]"
444 Contains the channel key.
446 If this value is an empty string, there is no channel key in place.
448 Definition at line 143 of file channels.h.
450 Referenced by add_channel(), and chanrec().
451 .SS "short int \fBchanrec::limit\fP"
453 Contains the channel user limit.
455 If this value is zero, there is no limit in place.
457 Definition at line 138 of file channels.h.
459 Referenced by add_channel(), and chanrec().
460 .SS "char \fBchanrec::name\fP[CHANMAX]"
464 Definition at line 108 of file channels.h.
466 Referenced by add_channel(), chanrec(), del_channel(), DelUser(), ForceChan(), kick_channel(), and Server::PseudoToUser().
467 .SS "char \fBchanrec::setby\fP[NICKMAX]"
469 The last user to set the topic.
471 If this member is an empty string, no topic was ever set.
473 Definition at line 133 of file channels.h.
475 Referenced by chanrec(), ForceChan(), and Server::PseudoToUser().
476 .SS "char \fBchanrec::topic\fP[MAXBUF]"
480 If this is an empty string, no channel topic is set.
482 Definition at line 122 of file channels.h.
484 Referenced by chanrec(), ForceChan(), and Server::PseudoToUser().
485 .SS "time_t \fBchanrec::topicset\fP"
489 If no topic was ever set, this will be equal to \fBchanrec::created\fP
491 Definition at line 129 of file channels.h.
493 Referenced by chanrec(), ForceChan(), and Server::PseudoToUser().
497 Generated automatically by Doxygen for InspIRCd from the source code.