.TH "chanrec" 3 "7 Apr 2005" "InspIRCd" \" -*- nroff -*- .ad l .nh .SH NAME chanrec \- Holds all relevent information for a channel. .PP .SH SYNOPSIS .br .PP \fC#include \fP .PP Inherits \fBExtensible\fP. .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "void \fBSetCustomMode\fP (char mode, bool mode_on)" .br .RI "\fISets or unsets a custom mode in the channels info. \fP" .ti -1c .RI "void \fBSetCustomModeParam\fP (char mode, char *parameter, bool mode_on)" .br .RI "\fISets or unsets the parameters for a custom mode in a channels info. \fP" .ti -1c .RI "bool \fBIsCustomModeSet\fP (char mode)" .br .RI "\fIReturns true if a custom mode is set on a channel. \fP" .ti -1c .RI "std::string \fBGetModeParameter\fP (char mode)" .br .RI "\fIReturns the parameter for a custom mode on a channel. \fP" .ti -1c .RI "\fBchanrec\fP ()" .br .RI "\fICreates a channel record and initialises it with default values. \fP" .ti -1c .RI "virtual \fB~chanrec\fP ()" .br .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "char \fBname\fP [CHANMAX]" .br .RI "\fIThe channels name. \fP" .ti -1c .RI "char \fBcustom_modes\fP [MAXMODES]" .br .RI "\fICustom modes for the channel. \fP" .ti -1c .RI "char \fBtopic\fP [MAXBUF]" .br .RI "\fIChannel topic. \fP" .ti -1c .RI "time_t \fBcreated\fP" .br .RI "\fICreation time. \fP" .ti -1c .RI "time_t \fBtopicset\fP" .br .RI "\fITime topic was set. \fP" .ti -1c .RI "char \fBsetby\fP [NICKMAX]" .br .RI "\fIThe last user to set the topic. \fP" .ti -1c .RI "long \fBlimit\fP" .br .RI "\fIContains the channel user limit. \fP" .ti -1c .RI "char \fBkey\fP [32]" .br .RI "\fIContains the channel key. \fP" .ti -1c .RI "short int \fBtopiclock\fP" .br .RI "\fINonzero if the mode +t is set. \fP" .ti -1c .RI "short int \fBnoexternal\fP" .br .RI "\fINonzero if the mode +n is set. \fP" .ti -1c .RI "short int \fBinviteonly\fP" .br .RI "\fINonzero if the mode +i is set. \fP" .ti -1c .RI "short int \fBmoderated\fP" .br .RI "\fINonzero if the mode +m is set. \fP" .ti -1c .RI "short int \fBsecret\fP" .br .RI "\fINonzero if the mode +s is set. \fP" .ti -1c .RI "short int \fBc_private\fP" .br .RI "\fINonzero if the mode +p is set. \fP" .ti -1c .RI "\fBBanList\fP \fBbans\fP" .br .RI "\fIThe list of all bans set on the channel. \fP" .in -1c .SH "Detailed Description" .PP Holds all relevent information for a channel. This class represents a channel, and contains its name, modes, time created, topic, topic set time, etc, and an instance of the BanList type. .PP Definition at line 94 of file channels.h. .SH "Constructor & Destructor Documentation" .PP .SS "chanrec::chanrec ()" .PP Creates a channel record and initialises it with default values. Definition at line 113 of file channels.cpp. .PP References c_private, created, custom_modes, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, and topicset. .PP .nf 114 { 115 strcpy(name,''); 116 strcpy(custom_modes,''); 117 strcpy(topic,''); 118 strcpy(setby,''); 119 strcpy(key,''); 120 created = topicset = limit = 0; 121 topiclock = noexternal = inviteonly = moderated = secret = c_private = false; 122 } .fi .SS "virtual chanrec::~\fBchanrec\fP ()\fC [inline, virtual]\fP" .PP Definition at line 185 of file channels.h. .PP .nf 185 { /* stub */ } .fi .SH "Member Function Documentation" .PP .SS "std::string chanrec::GetModeParameter (char mode)" .PP 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. .PP References custom_mode_params. .PP .nf 187 { 188 if (custom_mode_params.size()) 189 { 190 for (vector::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 191 { 192 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 193 { 194 return std::string(i->parameter); 195 } 196 } 197 } 198 return std::string(''); 199 } .fi .SS "bool chanrec::IsCustomModeSet (char mode)" .PP Returns true if a custom mode is set on a channel. Definition at line 180 of file channels.cpp. .PP References DEBUG. .PP .nf 181 { 182 log(DEBUG,'Checking ISCustomModeSet: %c %s',mode,this->custom_modes); 183 return (strchr(this->custom_modes,mode) != 0); 184 } .fi .SS "void chanrec::SetCustomMode (char mode, bool mode_on)" .PP Sets or unsets a custom mode in the channels info. Definition at line 124 of file channels.cpp. .PP References custom_modes, DEBUG, and SetCustomModeParam(). .PP .nf 125 { 126 if (mode_on) { 127 char m[3]; 128 m[0] = mode; 129 m[1] = '\0'; 130 if (!strchr(this->custom_modes,mode)) 131 { 132 strlcat(custom_modes,m,MAXMODES); 133 } 134 log(DEBUG,'Custom mode %c set',mode); 135 } 136 else { 137 138 std::string a = this->custom_modes; 139 int pos = a.find(mode); 140 a.erase(pos,1); 141 strncpy(this->custom_modes,a.c_str(),MAXMODES); 142 143 log(DEBUG,'Custom mode %c removed: modelist='%s'',mode,this->custom_modes); 144 this->SetCustomModeParam(mode,'',false); 145 } 146 } .fi .SS "void chanrec::SetCustomModeParam (char mode, char * parameter, bool mode_on)" .PP Sets or unsets the parameters for a custom mode in a channels info. Definition at line 149 of file channels.cpp. .PP References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter. .PP Referenced by SetCustomMode(). .PP .nf 150 { 151 152 log(DEBUG,'SetCustomModeParam called'); 153 ModeParameter M; 154 M.mode = mode; 155 strlcpy(M.channel,this->name,CHANMAX); 156 strlcpy(M.parameter,parameter,MAXBUF); 157 if (mode_on) 158 { 159 log(DEBUG,'Custom mode parameter %c %s added',mode,parameter); 160 custom_mode_params.push_back(M); 161 } 162 else 163 { 164 if (custom_mode_params.size()) 165 { 166 for (vector::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 167 { 168 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 169 { 170 log(DEBUG,'Custom mode parameter %c %s removed',mode,parameter); 171 custom_mode_params.erase(i); 172 return; 173 } 174 } 175 } 176 log(DEBUG,'*** BUG *** Attempt to remove non-existent mode parameter!'); 177 } 178 } .fi .SH "Member Data Documentation" .PP .SS "\fBBanList\fP \fBchanrec::bans\fP" .PP The list of all bans set on the channel. Definition at line 159 of file channels.h. .SS "short int \fBchanrec::c_private\fP" .PP 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. .PP Referenced by chanrec(). .SS "time_t \fBchanrec::created\fP" .PP Creation time. Definition at line 111 of file channels.h. .PP Referenced by chanrec(). .SS "char \fBchanrec::custom_modes\fP[MAXMODES]" .PP Custom modes for the channel. Plugins may use this field in any way they see fit.Definition at line 103 of file channels.h. .PP Referenced by chanrec(), and SetCustomMode(). .SS "short int \fBchanrec::inviteonly\fP" .PP Nonzero if the mode +i is set. Definition at line 141 of file channels.h. .PP Referenced by chanrec(). .SS "char \fBchanrec::key\fP[32]" .PP 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. .PP Referenced by chanrec(). .SS "long \fBchanrec::limit\fP" .PP Contains the channel user limit. If this value is zero, there is no limit in place.Definition at line 124 of file channels.h. .PP Referenced by chanrec(). .SS "short int \fBchanrec::moderated\fP" .PP Nonzero if the mode +m is set. Definition at line 145 of file channels.h. .PP Referenced by chanrec(). .SS "char \fBchanrec::name\fP[CHANMAX]" .PP The channels name. Definition at line 99 of file channels.h. .PP Referenced by chanrec(). .SS "short int \fBchanrec::noexternal\fP" .PP Nonzero if the mode +n is set. Definition at line 137 of file channels.h. .PP Referenced by chanrec(). .SS "short int \fBchanrec::secret\fP" .PP 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. .PP Referenced by chanrec(). .SS "char \fBchanrec::setby\fP[NICKMAX]" .PP 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. .PP Referenced by chanrec(). .SS "char \fBchanrec::topic\fP[MAXBUF]" .PP Channel topic. If this is an empty string, no channel topic is set.Definition at line 108 of file channels.h. .PP Referenced by chanrec(). .SS "short int \fBchanrec::topiclock\fP" .PP Nonzero if the mode +t is set. Definition at line 133 of file channels.h. .PP Referenced by chanrec(). .SS "time_t \fBchanrec::topicset\fP" .PP 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. .PP Referenced by chanrec(). .SH "Author" .PP Generated automatically by Doxygen for InspIRCd from the source code.