#include <channels.h>
Inherits Extensible.
Public Member Functions | |
void | SetCustomMode (char mode, bool mode_on) |
Sets or unsets a custom mode in the channels info. | |
void | SetCustomModeParam (char mode, char *parameter, bool mode_on) |
Sets or unsets the parameters for a custom mode in a channels info. | |
bool | IsCustomModeSet (char mode) |
Returns true if a custom mode is set on a channel. | |
std::string | GetModeParameter (char mode) |
Returns the parameter for a custom mode on a channel. | |
chanrec () | |
Creates a channel record and initialises it with default values. | |
virtual | ~chanrec () |
Public Attributes | |
char | name [CHANMAX] |
The channels name. | |
char | custom_modes [MAXMODES] |
Custom modes for the channel. | |
char | topic [MAXBUF] |
Channel topic. | |
time_t | created |
Creation time. | |
time_t | topicset |
Time topic was set. | |
char | setby [NICKMAX] |
The last user to set the topic. | |
long | limit |
Contains the channel user limit. | |
char | key [32] |
Contains the channel key. | |
short int | topiclock |
Nonzero if the mode +t is set. | |
short int | noexternal |
Nonzero if the mode +n is set. | |
short int | inviteonly |
Nonzero if the mode +i is set. | |
short int | moderated |
Nonzero if the mode +m is set. | |
short int | secret |
Nonzero if the mode +s is set. | |
short int | c_private |
Nonzero if the mode +p is set. | |
BanList | bans |
The list of all bans set on the 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.
Definition at line 94 of file channels.h.
|
Creates a channel record and initialises it with default values.
Definition at line 112 of file channels.cpp. References c_private, created, custom_modes, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, and topicset.
00113 { 00114 strcpy(name,""); 00115 strcpy(custom_modes,""); 00116 strcpy(topic,""); 00117 strcpy(setby,""); 00118 strcpy(key,""); 00119 created = topicset = limit = 0; 00120 topiclock = noexternal = inviteonly = moderated = secret = c_private = false; 00121 } |
|
Definition at line 185 of file channels.h.
00185 { /* stub */ }
|
|
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. References custom_mode_params.
00186 { 00187 if (custom_mode_params.size()) 00188 { 00189 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 00190 { 00191 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 00192 { 00193 return std::string(i->parameter); 00194 } 00195 } 00196 } 00197 return std::string(""); 00198 } |
|
Returns true if a custom mode is set on a channel.
Definition at line 179 of file channels.cpp. References DEBUG.
00180 { 00181 log(DEBUG,"Checking ISCustomModeSet: %c %s",mode,this->custom_modes); 00182 return (strchr(this->custom_modes,mode) != 0); 00183 } |
|
Sets or unsets a custom mode in the channels info.
Definition at line 123 of file channels.cpp. References custom_modes, DEBUG, and SetCustomModeParam().
00124 { 00125 if (mode_on) { 00126 char m[3]; 00127 m[0] = mode; 00128 m[1] = '\0'; 00129 if (!strchr(this->custom_modes,mode)) 00130 { 00131 strlcat(custom_modes,m,MAXMODES); 00132 } 00133 log(DEBUG,"Custom mode %c set",mode); 00134 } 00135 else { 00136 00137 std::string a = this->custom_modes; 00138 int pos = a.find(mode); 00139 a.erase(pos,1); 00140 strncpy(this->custom_modes,a.c_str(),MAXMODES); 00141 00142 log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes); 00143 this->SetCustomModeParam(mode,"",false); 00144 } 00145 } |
|
Sets or unsets the parameters for a custom mode in a channels info.
Definition at line 148 of file channels.cpp. References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter. Referenced by SetCustomMode().
00149 { 00150 00151 log(DEBUG,"SetCustomModeParam called"); 00152 ModeParameter M; 00153 M.mode = mode; 00154 strlcpy(M.channel,this->name,CHANMAX); 00155 strlcpy(M.parameter,parameter,MAXBUF); 00156 if (mode_on) 00157 { 00158 log(DEBUG,"Custom mode parameter %c %s added",mode,parameter); 00159 custom_mode_params.push_back(M); 00160 } 00161 else 00162 { 00163 if (custom_mode_params.size()) 00164 { 00165 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 00166 { 00167 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 00168 { 00169 log(DEBUG,"Custom mode parameter %c %s removed",mode,parameter); 00170 custom_mode_params.erase(i); 00171 return; 00172 } 00173 } 00174 } 00175 log(DEBUG,"*** BUG *** Attempt to remove non-existent mode parameter!"); 00176 } 00177 } |
|
The list of all bans set on the channel.
Definition at line 159 of file channels.h. |
|
Nonzero if the mode +p is set. This value cannot be set at the same time as chanrec::secret Definition at line 155 of file channels.h. Referenced by chanrec(). |
|
Creation time.
Definition at line 111 of file channels.h. Referenced by chanrec(). |
|
Custom modes for the channel. Plugins may use this field in any way they see fit. Definition at line 103 of file channels.h. Referenced by chanrec(), and SetCustomMode(). |
|
Nonzero if the mode +i is set.
Definition at line 141 of file channels.h. Referenced by chanrec(). |
|
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. Referenced by chanrec(). |
|
Contains the channel user limit. If this value is zero, there is no limit in place. Definition at line 124 of file channels.h. Referenced by chanrec(). |
|
Nonzero if the mode +m is set.
Definition at line 145 of file channels.h. Referenced by chanrec(). |
|
The channels name.
Definition at line 99 of file channels.h. Referenced by chanrec(). |
|
Nonzero if the mode +n is set.
Definition at line 137 of file channels.h. Referenced by chanrec(). |
|
Nonzero if the mode +s is set. This value cannot be set at the same time as chanrec::c_private Definition at line 150 of file channels.h. Referenced by chanrec(). |
|
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. Referenced by chanrec(). |
|
Channel topic. If this is an empty string, no channel topic is set. Definition at line 108 of file channels.h. Referenced by chanrec(). |
|
Nonzero if the mode +t is set.
Definition at line 133 of file channels.h. Referenced by chanrec(). |
|
Time topic was set. If no topic was ever set, this will be equal to chanrec::created Definition at line 115 of file channels.h. Referenced by chanrec(). |