#include <channels.h>
Inheritance diagram for chanrec:
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. | |
long | GetUserCounter () |
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. | |
void | AddUser (char *castuser) |
Add a user pointer to the internal reference list. | |
void | DelUser (char *castuser) |
Delete a user pointer to the internal reference list. | |
std::vector< char * > * | GetUsers () |
Obrain the internal reference list The internal reference list contains a list of userrec* cast to char*. | |
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. | |
std::vector< char * > | internal_userlist |
User list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!). | |
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. | |
short int | limit |
Contains the channel user limit. | |
char | key [32] |
Contains the channel key. | |
char | binarymodes |
Contains a bitmask of the CM_* builtin (RFC) binary mode symbols. | |
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 103 of file channels.h.
|
Creates a channel record and initialises it with default values.
Definition at line 74 of file channels.cpp. References binarymodes, created, custom_modes, internal_userlist, key, limit, name, setby, topic, and topicset. 00075 { 00076 strcpy(name,""); 00077 strcpy(custom_modes,""); 00078 strcpy(topic,""); 00079 strcpy(setby,""); 00080 strcpy(key,""); 00081 created = topicset = limit = 0; 00082 binarymodes = 0; 00083 internal_userlist.clear(); 00084 }
|
|
Definition at line 226 of file channels.h.
|
|
Add a user pointer to the internal reference list.
Definition at line 167 of file channels.cpp. References DEBUG, internal_userlist, and log(). Referenced by ForceChan(). 00168 { 00169 internal_userlist.push_back(castuser); 00170 log(DEBUG,"Added casted user to channel's internal list"); 00171 }
|
|
Delete a user pointer to the internal reference list.
Definition at line 173 of file channels.cpp. References DEBUG, internal_userlist, log(), and name. Referenced by del_channel(), and kick_channel(). 00174 { 00175 for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++) 00176 { 00177 if (*a == castuser) 00178 { 00179 log(DEBUG,"Removed casted user from channel's internal list"); 00180 internal_userlist.erase(a); 00181 return; 00182 } 00183 } 00184 log(DEBUG,"BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!",name); 00185 }
|
|
Returns the parameter for a custom mode on a channel.
Definition at line 147 of file channels.cpp. References custom_mode_params. 00148 { 00149 if (custom_mode_params.size()) 00150 { 00151 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 00152 { 00153 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 00154 { 00155 return i->parameter; 00156 } 00157 } 00158 } 00159 return ""; 00160 }
|
|
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 162 of file channels.cpp.
|
|
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 187 of file channels.cpp. References internal_userlist. Referenced by Server::GetUsers(). 00188 { 00189 return &internal_userlist; 00190 }
|
|
Returns true if a custom mode is set on a channel.
Definition at line 142 of file channels.cpp.
|
|
Sets or unsets a custom mode in the channels info.
Definition at line 86 of file channels.cpp. References custom_modes, DEBUG, log(), and SetCustomModeParam(). 00087 { 00088 if (mode_on) { 00089 static char m[3]; 00090 m[0] = mode; 00091 m[1] = '\0'; 00092 if (!strchr(this->custom_modes,mode)) 00093 { 00094 strlcat(custom_modes,m,MAXMODES); 00095 } 00096 log(DEBUG,"Custom mode %c set",mode); 00097 } 00098 else { 00099 00100 std::string a = this->custom_modes; 00101 int pos = a.find(mode); 00102 a.erase(pos,1); 00103 strncpy(this->custom_modes,a.c_str(),MAXMODES); 00104 00105 log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes); 00106 this->SetCustomModeParam(mode,"",false); 00107 } 00108 }
|
|
Sets or unsets the parameters for a custom mode in a channels info.
Definition at line 111 of file channels.cpp. References ModeParameter::channel, custom_mode_params, DEBUG, log(), ModeParameter::mode, and ModeParameter::parameter. Referenced by SetCustomMode(). 00112 { 00113 00114 log(DEBUG,"SetCustomModeParam called"); 00115 ModeParameter M; 00116 M.mode = mode; 00117 strlcpy(M.channel,this->name,CHANMAX); 00118 strlcpy(M.parameter,parameter,MAXBUF); 00119 if (mode_on) 00120 { 00121 log(DEBUG,"Custom mode parameter %c %s added",mode,parameter); 00122 custom_mode_params.push_back(M); 00123 } 00124 else 00125 { 00126 if (custom_mode_params.size()) 00127 { 00128 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) 00129 { 00130 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) 00131 { 00132 log(DEBUG,"Custom mode parameter %c %s removed",mode,parameter); 00133 custom_mode_params.erase(i); 00134 return; 00135 } 00136 } 00137 } 00138 log(DEBUG,"*** BUG *** Attempt to remove non-existent mode parameter!"); 00139 } 00140 }
|
|
The list of all bans set on the channel.
Definition at line 151 of file channels.h. Referenced by add_channel(). |
|
Contains a bitmask of the CM_* builtin (RFC) binary mode symbols.
Definition at line 147 of file channels.h. Referenced by add_channel(), and chanrec(). |
|
Creation time.
Definition at line 125 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 112 of file channels.h. Referenced by chanrec(), and SetCustomMode(). |
|
User list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!).
Definition at line 117 of file channels.h. Referenced by AddUser(), chanrec(), DelUser(), and GetUsers(). |
|
Contains the channel key. If this value is an empty string, there is no channel key in place. Definition at line 143 of file channels.h. Referenced by add_channel(), and chanrec(). |
|
Contains the channel user limit. If this value is zero, there is no limit in place. Definition at line 138 of file channels.h. Referenced by add_channel(), and chanrec(). |
|
The channels name.
Definition at line 108 of file channels.h. Referenced by add_channel(), chanrec(), del_channel(), DelUser(), ForceChan(), kick_channel(), and Server::PseudoToUser(). |
|
The last user to set the topic. If this member is an empty string, no topic was ever set. Definition at line 133 of file channels.h. Referenced by chanrec(), ForceChan(), and Server::PseudoToUser(). |
|
Channel topic. If this is an empty string, no channel topic is set. Definition at line 122 of file channels.h. Referenced by chanrec(), ForceChan(), and Server::PseudoToUser(). |
|
Time topic was set. If no topic was ever set, this will be equal to chanrec::created Definition at line 129 of file channels.h. Referenced by chanrec(), ForceChan(), and Server::PseudoToUser(). |