From 5a2675d174e661c55843b3795afe2d688e7197f9 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 26 Apr 2005 17:15:49 +0000 Subject: New documentation! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1199 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/classchanrec.html | 654 ++++++++++++++++++++++++++++---------- 1 file changed, 492 insertions(+), 162 deletions(-) (limited to 'docs/module-doc/classchanrec.html') diff --git a/docs/module-doc/classchanrec.html b/docs/module-doc/classchanrec.html index a24f0aad2..9ad664151 100644 --- a/docs/module-doc/classchanrec.html +++ b/docs/module-doc/classchanrec.html @@ -27,10 +27,28 @@ Inherits Extensible. std::string GetModeParameter (char mode)  Returns the parameter for a custom mode on a channel.

chanrec () +void IncUserCounter () - Creates a channel record and initialises it with default values.


-virtual ~chanrec () + Increment the channel "user counter" The channel user counter is a reference counter which holds the number of users on the channel.


+void DecUserCounter () + + Decrement the channel "user counter" The channel user counter is a reference counter which holds the number of users on the 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 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.


+void DelUser (char *castuser) + + 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.


+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] @@ -39,45 +57,51 @@ Inherits Extensible. char custom_modes [MAXMODES]  Custom modes for the channel.


-char topic [MAXBUF] +long users + + Count of users on the channel used for fast user counting.


+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 + Channel topic.


+time_t created - Creation time.


-time_t topicset + Creation time.


+time_t topicset - Time topic was set.


-char setby [NICKMAX] + Time topic was set.


+char setby [NICKMAX] - The last user to set the topic.


-long limit + The last user to set the topic.


+long limit - Contains the channel user limit.


-char key [32] + Contains the channel user limit.


+char key [32] - Contains the channel key.


-short int topiclock + Contains the channel key.


+short int topiclock - Nonzero if the mode +t is set.


-short int noexternal + Nonzero if the mode +t is set.


+short int noexternal - Nonzero if the mode +n is set.


-short int inviteonly + Nonzero if the mode +n is set.


+short int inviteonly - Nonzero if the mode +i is set.


-short int moderated + Nonzero if the mode +i is set.


+short int moderated - Nonzero if the mode +m is set.


-short int secret + 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 +s is set.


+short int c_private - Nonzero if the mode +p is set.


-BanList bans + Nonzero if the mode +p is set.


+BanList bans - The list of all bans set on the channel.


+ The list of all bans set on the channel.



Detailed Description

Holds all relevent information for a channel. @@ -87,7 +111,7 @@ This class represents a channel, and contains its name, modes, time created, top

Definition at line 94 of file channels.h.


Constructor & Destructor Documentation

-

+

@@ -118,7 +142,7 @@ Creates a channel record and initialises it with default values.

Definition at line 113 of file channels.cpp.

-References c_private, created, custom_modes, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, and topicset. +References c_private, created, custom_modes, internal_userlist, inviteonly, key, limit, moderated, name, noexternal, secret, setby, topic, topiclock, topicset, and users.

00114 {
 00115         strcpy(name,"");
@@ -126,13 +150,14 @@ References c_private, "");
 00118         strcpy(setby,"");
 00119         strcpy(key,"");
-00120         created = topicset = limit = 0;
-00121         topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
-00122 }
+00120         created = topicset = limit = users = 0;
+00121         topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
+00122         internal_userlist.clear();
+00123 }
 
-

+

@@ -159,13 +184,144 @@ References c_private,

-Definition at line 185 of file channels.h. +Definition at line 240 of file channels.h.

-

00185 { /* stub */ }
+
00240 { /* stub */ }
 


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void chanrec::AddUser char *  castuser  ) 
+
+ + + + + +
+   + + +

+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 220 of file channels.cpp. +

+References DEBUG, and internal_userlist. +

+

00221 {
+00222         internal_userlist.push_back(castuser);
+00223         log(DEBUG,"Added casted user to channel's internal list");
+00224 }
+
+

+ + + + +
+ + + + + + + + + +
void chanrec::DecUserCounter  ) 
+
+ + + + + +
+   + + +

+Decrement the channel "user counter" The channel user counter is a reference counter which holds the number of users on the channel. +

+If it decremented to 0 then the channel is removed from the system. Modules may alter the reference count to hold channels open which have no users and would normally be deleted once empty. +

+Definition at line 208 of file channels.cpp. +

+References DEBUG, name, and users. +

+

00209 {
+00210         if (this->users > 0)
+00211                 this->users--;
+00212         log(DEBUG,"Decremented channel user count for %s to %lu",name,(unsigned long)users);
+00213 }
+
+

+ + + + +
+ + + + + + + + + + +
void chanrec::DelUser char *  castuser  ) 
+
+ + + + + +
+   + + +

+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 226 of file channels.cpp. +

+References DEBUG, internal_userlist, and name. +

+

00227 {
+00228         for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++)
+00229         {
+00230                 if (*a == castuser)
+00231                 {
+00232                         log(DEBUG,"Removed casted user from channel's internal list");
+00233                         internal_userlist.erase(a);
+00234                         return;
+00235                 }
+00236         }
+00237         log(DEBUG,"BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!",name);
+00238 }
+

@@ -196,23 +352,141 @@ 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. +Definition at line 187 of file channels.cpp.

References custom_mode_params.

-

00187 {
-00188         if (custom_mode_params.size())
-00189         {
-00190                 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
-00191                 {
-00192                         if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
-00193                         {
-00194                                 return std::string(i->parameter);
-00195                         }
-00196                 }
-00197         }
-00198         return std::string("");
-00199 }
+
00188 {
+00189         if (custom_mode_params.size())
+00190         {
+00191                 for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
+00192                 {
+00193                         if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
+00194                         {
+00195                                 return std::string(i->parameter);
+00196                         }
+00197                 }
+00198         }
+00199         return std::string("");
+00200 }
+
+
+
+

+ + + + +
+ + + + + + + + + +
long chanrec::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. +

+ +

+Definition at line 215 of file channels.cpp. +

+References users. +

+

00216 {
+00217         return (this->users);
+00218 }
+
+

+ + + + +
+ + + + + + + + + +
std::vector< char * > * chanrec::GetUsers  ) 
+
+ + + + + +
+   + + +

+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 240 of file channels.cpp. +

+References internal_userlist. +

+

00241 {
+00242         return &internal_userlist;
+00243 }
+
+

+ + + + +
+ + + + + + + + + +
void chanrec::IncUserCounter  ) 
+
+ + + +
+   + + +

+Increment the channel "user counter" The channel user counter is a reference counter which holds the number of users on the channel. +

+If it decremented to 0 then the channel is removed from the system. +

+Definition at line 202 of file channels.cpp. +

+References DEBUG, name, and users. +

+

00203 {
+00204         this->users++;
+00205         log(DEBUG,"Incremented channel user count for %s to %lu",name,(unsigned long)users);
+00206 }
 
@@ -246,14 +520,14 @@ Returns true if a custom mode is set on a channel.

-Definition at line 180 of file channels.cpp. +Definition at line 181 of file channels.cpp.

References DEBUG.

-

00181 {
-00182         log(DEBUG,"Checking ISCustomModeSet: %c %s",mode,this->custom_modes);
-00183         return (strchr(this->custom_modes,mode) != 0);
-00184 }
+
00182 {
+00183         log(DEBUG,"Checking ISCustomModeSet: %c %s",mode,this->custom_modes);
+00184         return (strchr(this->custom_modes,mode) != 0);
+00185 }
 
@@ -296,32 +570,32 @@ Sets or unsets a custom mode in the channels info.

-Definition at line 124 of file channels.cpp. -

-References custom_modes, DEBUG, and SetCustomModeParam(). -

-

00125 {
-00126         if (mode_on) {
-00127                 char m[3];
-00128                 m[0] = mode;
-00129                 m[1] = '\0';
-00130                 if (!strchr(this->custom_modes,mode))
-00131                 {
-00132                         strlcat(custom_modes,m,MAXMODES);
-00133                 }
-00134                 log(DEBUG,"Custom mode %c set",mode);
-00135         }
-00136         else {
-00137 
-00138                 std::string a = this->custom_modes;
-00139                 int pos = a.find(mode);
-00140                 a.erase(pos,1);
-00141                 strncpy(this->custom_modes,a.c_str(),MAXMODES);
-00142 
-00143                 log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes);
-00144                 this->SetCustomModeParam(mode,"",false);
-00145         }
-00146 }
+Definition at line 125 of file channels.cpp.
+

+References custom_modes, DEBUG, and SetCustomModeParam(). +

+

00126 {
+00127         if (mode_on) {
+00128                 char m[3];
+00129                 m[0] = mode;
+00130                 m[1] = '\0';
+00131                 if (!strchr(this->custom_modes,mode))
+00132                 {
+00133                         strlcat(custom_modes,m,MAXMODES);
+00134                 }
+00135                 log(DEBUG,"Custom mode %c set",mode);
+00136         }
+00137         else {
+00138 
+00139                 std::string a = this->custom_modes;
+00140                 int pos = a.find(mode);
+00141                 a.erase(pos,1);
+00142                 strncpy(this->custom_modes,a.c_str(),MAXMODES);
+00143 
+00144                 log(DEBUG,"Custom mode %c removed: modelist='%s'",mode,this->custom_modes);
+00145                 this->SetCustomModeParam(mode,"",false);
+00146         }
+00147 }
 
@@ -370,52 +644,52 @@ Sets or unsets the parameters for a custom mode in a channels info.

-Definition at line 149 of file channels.cpp. +Definition at line 150 of file channels.cpp.

References ModeParameter::channel, custom_mode_params, DEBUG, ModeParameter::mode, and ModeParameter::parameter.

-Referenced by SetCustomMode(). -

-

00150 {
-00151 
-00152         log(DEBUG,"SetCustomModeParam called");
-00153         ModeParameter M;
-00154         M.mode = mode;
-00155         strlcpy(M.channel,this->name,CHANMAX);
-00156         strlcpy(M.parameter,parameter,MAXBUF);
-00157         if (mode_on)
-00158         {
-00159                 log(DEBUG,"Custom mode parameter %c %s added",mode,parameter);
-00160                 custom_mode_params.push_back(M);
-00161         }
-00162         else
-00163         {
-00164                 if (custom_mode_params.size())
-00165                 {
-00166                         for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
-00167                         {
-00168                                 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
-00169                                 {
-00170                                         log(DEBUG,"Custom mode parameter %c %s removed",mode,parameter);
-00171                                         custom_mode_params.erase(i);
-00172                                         return;
-00173                                 }
-00174                         }
-00175                 }
-00176                 log(DEBUG,"*** BUG *** Attempt to remove non-existent mode parameter!");
-00177         }
-00178 }
+Referenced by SetCustomMode().
+

+

00151 {
+00152 
+00153         log(DEBUG,"SetCustomModeParam called");
+00154         ModeParameter M;
+00155         M.mode = mode;
+00156         strlcpy(M.channel,this->name,CHANMAX);
+00157         strlcpy(M.parameter,parameter,MAXBUF);
+00158         if (mode_on)
+00159         {
+00160                 log(DEBUG,"Custom mode parameter %c %s added",mode,parameter);
+00161                 custom_mode_params.push_back(M);
+00162         }
+00163         else
+00164         {
+00165                 if (custom_mode_params.size())
+00166                 {
+00167                         for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++)
+00168                         {
+00169                                 if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
+00170                                 {
+00171                                         log(DEBUG,"Custom mode parameter %c %s removed",mode,parameter);
+00172                                         custom_mode_params.erase(i);
+00173                                         return;
+00174                                 }
+00175                         }
+00176                 }
+00177                 log(DEBUG,"*** BUG *** Attempt to remove non-existent mode parameter!");
+00178         }
+00179 }
 

Member Data Documentation

-

+

@@ -432,16 +706,16 @@ The list of all bans set on the channel.

-Definition at line 159 of file channels.h. +Definition at line 168 of file channels.h.

-
BanList chanrec::bans + BanList chanrec::bans
-

+

@@ -456,20 +730,20 @@ Definition at line 159 o

Nonzero if the mode +p is set.

-This value cannot be set at the same time as chanrec::secret +This value cannot be set at the same time as chanrec::secret

-Definition at line 155 of file channels.h. +Definition at line 164 of file channels.h.

Referenced by chanrec().

-
short int chanrec::c_private + short int chanrec::c_private
-

+

@@ -486,7 +760,7 @@ Creation time.

-Definition at line 111 of file channels.h. +Definition at line 120 of file channels.h.

Referenced by chanrec(). @@ -516,16 +790,44 @@ Plugins may use this field in any way they see fit.

Definition at line 103 of file channels.h.

-Referenced by chanrec(), and SetCustomMode(). +Referenced by chanrec(), and SetCustomMode(). + +

-
time_t chanrec::created + time_t chanrec::created
+

+ + + + +
+ + +
std::vector<char*> chanrec::internal_userlist +
+
+ + + +
+   + + +

+User list (casted to char*'s to stop forward declaration stuff) (chicken and egg scenario!). +

+ +

+Definition at line 112 of file channels.h. +

+Referenced by AddUser(), chanrec(), DelUser(), and GetUsers().

-

+

@@ -542,18 +844,18 @@ Nonzero if the mode +i is set.

-Definition at line 141 of file channels.h. +Definition at line 150 of file channels.h.

Referenced by chanrec().

-
short int chanrec::inviteonly + short int chanrec::inviteonly
-

+

@@ -570,18 +872,18 @@ 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. +Definition at line 138 of file channels.h.

Referenced by chanrec().

-
char chanrec::key[32] + char chanrec::key[32]
-

+

@@ -598,18 +900,18 @@ Contains the channel user limit.

If this value is zero, there is no limit in place.

-Definition at line 124 of file channels.h. +Definition at line 133 of file channels.h.

Referenced by chanrec().

-
long chanrec::limit + long chanrec::limit
-

+

@@ -626,7 +928,7 @@ Nonzero if the mode +m is set.

-Definition at line 145 of file channels.h. +Definition at line 154 of file channels.h.

Referenced by chanrec(). @@ -656,16 +958,16 @@ The channels name.

Definition at line 99 of file channels.h.

-Referenced by chanrec(), and Server::PseudoToUser(). +Referenced by chanrec(), DecUserCounter(), DelUser(), IncUserCounter(), and Server::PseudoToUser().

-
short int chanrec::moderated + short int chanrec::moderated
-

+

@@ -682,18 +984,18 @@ Nonzero if the mode +n is set.

-Definition at line 137 of file channels.h. +Definition at line 146 of file channels.h.

Referenced by chanrec().

-
short int chanrec::noexternal + short int chanrec::noexternal
-

+

@@ -708,20 +1010,20 @@ Referenced by chanrec() Nonzero if the mode +s is set.

-This value cannot be set at the same time as chanrec::c_private +This value cannot be set at the same time as chanrec::c_private

-Definition at line 150 of file channels.h. +Definition at line 159 of file channels.h.

Referenced by chanrec().

-
short int chanrec::secret + short int chanrec::secret
-

+

@@ -738,18 +1040,18 @@ 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. +Definition at line 128 of file channels.h.

-Referenced by chanrec(), and Server::PseudoToUser(). +Referenced by chanrec(), and Server::PseudoToUser().

-
char chanrec::setby[NICKMAX] + char chanrec::setby[NICKMAX]
-

+

@@ -766,18 +1068,18 @@ Channel topic.

If this is an empty string, no channel topic is set.

-Definition at line 108 of file channels.h. +Definition at line 117 of file channels.h.

-Referenced by chanrec(), and Server::PseudoToUser(). +Referenced by chanrec(), and Server::PseudoToUser().

-
char chanrec::topic[MAXBUF] + char chanrec::topic[MAXBUF]
-

+

@@ -794,18 +1096,18 @@ Nonzero if the mode +t is set.

-Definition at line 133 of file channels.h. +Definition at line 142 of file channels.h.

Referenced by chanrec().

-
short int chanrec::topiclock + short int chanrec::topiclock
-

+

@@ -820,16 +1122,44 @@ Referenced by chanrec() Time topic was set.

-If no topic was ever set, this will be equal to chanrec::created +If no topic was ever set, this will be equal to chanrec::created +

+Definition at line 124 of file channels.h. +

+Referenced by chanrec(), and Server::PseudoToUser(). + +

-
time_t chanrec::topicset + time_t chanrec::topicset
+

+ + + + +
+ + +
long chanrec::users +
+
+ + + + +Referenced by chanrec(), DecUserCounter(), GetUserCounter(), and IncUserCounter().
+   + + +

+Count of users on the channel used for fast user counting. +

+

-Definition at line 115 of file channels.h. +Definition at line 107 of file channels.h.

-Referenced by chanrec(), and Server::PseudoToUser().


The documentation for this class was generated from the following files: -
Generated on Wed Apr 20 15:47:00 2005 for InspIRCd by +
Generated on Tue Apr 26 17:11:47 2005 for InspIRCd by doxygen 1.3.3
-- cgit v1.2.3