From f62de63955ff77e800360eb140f108b5d2c6c075 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 19 Dec 2005 18:32:09 +0000 Subject: Design flaw my ass. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2580 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/channels_8h.html | 958 --------------------------------------- 1 file changed, 958 deletions(-) delete mode 100644 docs/module-doc/channels_8h.html (limited to 'docs/module-doc/channels_8h.html') diff --git a/docs/module-doc/channels_8h.html b/docs/module-doc/channels_8h.html deleted file mode 100644 index 2fcef2201..000000000 --- a/docs/module-doc/channels_8h.html +++ /dev/null @@ -1,958 +0,0 @@ - - -InspIRCd: channels.h File Reference - - - -
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members
- -

channels.h File Reference

#include "inspircd_config.h"
-#include "base.h"
-#include <time.h>
-#include <vector>
-#include <string>
- -

-Include dependency graph for channels.h:

- - - - -

-This graph shows which files directly or indirectly include this file:

- - - - - - - - - - - - - -

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Classes

class  HostItem
 Holds an entry for a ban list, exemption list, or invite list. More...
class  BanItem
 A subclass of HostItem designed to hold channel bans (+b). More...
class  ExemptItem
 A subclass of HostItem designed to hold channel exempts (+e). More...
class  InviteItem
 A subclass of HostItem designed to hold channel invites (+I). More...
class  ModeParameter
 Holds a custom parameter to a module-defined channel mode e.g. More...
class  chanrec
 Holds all relevent information for a channel. More...
class  ucrec
 Holds a user's modes on a channel This class associates a users privilages with a channel by creating a pointer link between a userrec and chanrec class. More...

Defines

#define CM_TOPICLOCK   1
#define CM_NOEXTERNAL   2
#define CM_INVITEONLY   4
#define CM_MODERATED   8
#define CM_SECRET   16
#define CM_PRIVATE   32
#define UCMODE_OP   1
#define UCMODE_VOICE   2
#define UCMODE_HOP   4
#define UCMODE_PROTECT   8
#define UCMODE_FOUNDER   16

Typedefs

typedef std::vector< BanItemBanList
 Holds a complete ban list.
typedef std::vector< ExemptItemExemptList
 Holds a complete exempt list.
typedef std::vector< InviteItemInviteList
 Holds a complete invite list.

Functions

chanrecadd_channel (userrec *user, const char *cn, const char *key, bool override)
chanrecdel_channel (userrec *user, const char *cname, const char *reason, bool local)
void kick_channel (userrec *src, userrec *user, chanrec *Ptr, char *reason)
-


Define Documentation

-

- - - - -
- - - - -
#define CM_INVITEONLY   4
-
- - - - - -
-   - - -

- -

-Definition at line 28 of file channels.h. -

-Referenced by add_channel().

-

- - - - -
- - - - -
#define CM_MODERATED   8
-
- - - - - -
-   - - -

- -

-Definition at line 29 of file channels.h.

-

- - - - -
- - - - -
#define CM_NOEXTERNAL   2
-
- - - - - -
-   - - -

- -

-Definition at line 27 of file channels.h. -

-Referenced by add_channel().

-

- - - - -
- - - - -
#define CM_PRIVATE   32
-
- - - - - -
-   - - -

- -

-Definition at line 31 of file channels.h.

-

- - - - -
- - - - -
#define CM_SECRET   16
-
- - - - - -
-   - - -

- -

-Definition at line 30 of file channels.h.

-

- - - - -
- - - - -
#define CM_TOPICLOCK   1
-
- - - - - -
-   - - -

- -

-Definition at line 26 of file channels.h. -

-Referenced by add_channel().

-

- - - - -
- - - - -
#define UCMODE_FOUNDER   16
-
- - - - - -
-   - - -

- -

-Definition at line 236 of file channels.h.

-

- - - - -
- - - - -
#define UCMODE_HOP   4
-
- - - - - -
-   - - -

- -

-Definition at line 234 of file channels.h.

-

- - - - -
- - - - -
#define UCMODE_OP   1
-
- - - - - -
-   - - -

- -

-Definition at line 232 of file channels.h. -

-Referenced by ForceChan().

-

- - - - -
- - - - -
#define UCMODE_PROTECT   8
-
- - - - - -
-   - - -

- -

-Definition at line 235 of file channels.h.

-

- - - - -
- - - - -
#define UCMODE_VOICE   2
-
- - - - - -
-   - - -

- -

-Definition at line 233 of file channels.h.

-


Typedef Documentation

-

- - - - -
- - - - -
typedef std::vector<BanItem> BanList
-
- - - - - -
-   - - -

-Holds a complete ban list. -

- -

-Definition at line 89 of file channels.h.

-

- - - - -
- - - - -
typedef std::vector<ExemptItem> ExemptList
-
- - - - - -
-   - - -

-Holds a complete exempt list. -

- -

-Definition at line 93 of file channels.h.

-

- - - - -
- - - - -
typedef std::vector<InviteItem> InviteList
-
- - - - - -
-   - - -

-Holds a complete invite list. -

- -

-Definition at line 97 of file channels.h.

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
chanrec* add_channel userrec user,
const char *  cn,
const char *  key,
bool  override
-
- - - - - -
-   - - -

- -

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

-References chanrec::bans, chanrec::binarymodes, chanlist, userrec::chans, CM_INVITEONLY, CM_NOEXTERNAL, CM_TOPICLOCK, DEBUG, DEFAULT, connection::fd, FindChan(), ForceChan(), FOREACH_RESULT, userrec::GetFullHost(), has_channel(), userrec::IsInvited(), chanrec::key, chanrec::limit, log(), userrec::modes, chanrec::name, userrec::nick, userrec::RemoveInvite(), TIME, and WriteServ(). -

-Referenced by Server::JoinUserToChannel().

00195 {
-00196         if ((!user) || (!cn))
-00197         {
-00198                 log(DEFAULT,"*** BUG *** add_channel was given an invalid parameter");
-00199                 return 0;
-00200         }
-00201 
-00202         int created = 0;
-00203         char cname[MAXBUF];
-00204         int MOD_RESULT = 0;
-00205         strncpy(cname,cn,CHANMAX);
-00206 
-00207         log(DEBUG,"add_channel: %s %s",user->nick,cname);
-00208 
-00209         chanrec* Ptr = FindChan(cname);
-00210 
-00211         if (!Ptr)
-00212         {
-00213                 if (user->fd > -1)
-00214                 {
-00215                         MOD_RESULT = 0;
-00216                         FOREACH_RESULT(OnUserPreJoin(user,NULL,cname));
-00217                         if (MOD_RESULT == 1)
-00218                                 return NULL;
-00219                 }
-00220                 /* create a new one */
-00221                 chanlist[cname] = new chanrec();
-00222                 strlcpy(chanlist[cname]->name, cname,CHANMAX);
-00223                 chanlist[cname]->binarymodes = CM_TOPICLOCK | CM_NOEXTERNAL;
-00224                 chanlist[cname]->created = TIME;
-00225                 strcpy(chanlist[cname]->topic, "");
-00226                 strncpy(chanlist[cname]->setby, user->nick,NICKMAX);
-00227                 chanlist[cname]->topicset = 0;
-00228                 Ptr = chanlist[cname];
-00229                 log(DEBUG,"add_channel: created: %s",cname);
-00230                 /* set created to 2 to indicate user
-00231                  * is the first in the channel
-00232                  * and should be given ops */
-00233                 created = 2;
-00234         }
-00235         else
-00236         {
-00237                 /* Already on the channel */
-00238                 if (has_channel(user,Ptr))
-00239                         return NULL;
-00240 
-00241                 // remote users are allowed us to bypass channel modes
-00242                 // and bans (used by servers)
-00243                 if (user->fd > -1)
-00244                 {
-00245                         MOD_RESULT = 0;
-00246                         FOREACH_RESULT(OnUserPreJoin(user,Ptr,cname));
-00247                         if (MOD_RESULT == 1)
-00248                         {
-00249                                 return NULL;
-00250                         }
-00251                         else
-00252                         {
-00253                                 if (*Ptr->key)
-00254                                 {
-00255                                         MOD_RESULT = 0;
-00256                                         FOREACH_RESULT(OnCheckKey(user, Ptr, key ? key : ""));
-00257                                         if (!MOD_RESULT)
-00258                                         {
-00259                                                 if (!key)
-00260                                                 {
-00261                                                         log(DEBUG,"add_channel: no key given in JOIN");
-00262                                                         WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
-00263                                                         return NULL;
-00264                                                 }
-00265                                                 else
-00266                                                 {
-00267                                                         if (strcasecmp(key,Ptr->key))
-00268                                                         {
-00269                                                                 log(DEBUG,"add_channel: bad key given in JOIN");
-00270                                                                 WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
-00271                                                                 return NULL;
-00272                                                         }
-00273                                                 }
-00274                                         }
-00275                                 }
-00276                                 if (Ptr->binarymodes & CM_INVITEONLY)
-00277                                 {
-00278                                         MOD_RESULT = 0;
-00279                                         irc::string xname(Ptr->name);
-00280                                         FOREACH_RESULT(OnCheckInvite(user, Ptr));
-00281                                         if (!MOD_RESULT)
-00282                                         {
-00283                                                 log(DEBUG,"add_channel: channel is +i");
-00284                                                 if (user->IsInvited(xname))
-00285                                                 {
-00286                                                         /* user was invited to channel */
-00287                                                         /* there may be an optional channel NOTICE here */
-00288                                                 }
-00289                                                 else
-00290                                                 {
-00291                                                         WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name);
-00292                                                         return NULL;
-00293                                                 }
-00294                                         }
-00295                                         user->RemoveInvite(xname);
-00296                                 }
-00297                                 if (Ptr->limit)
-00298                                 {
-00299                                         MOD_RESULT = 0;
-00300                                         FOREACH_RESULT(OnCheckLimit(user, Ptr));
-00301                                         if (!MOD_RESULT)
-00302                                         {
-00303                                                 if (usercount(Ptr) >= Ptr->limit)
-00304                                                 {
-00305                                                         WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name);
-00306                                                         return NULL;
-00307                                                 }
-00308                                         }
-00309                                 }
-00310                                 if (Ptr->bans.size())
-00311                                 {
-00312                                         log(DEBUG,"add_channel: about to walk banlist");
-00313                                         MOD_RESULT = 0;
-00314                                         FOREACH_RESULT(OnCheckBan(user, Ptr));
-00315                                         if (!MOD_RESULT)
-00316                                         {
-00317                                                 for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++)
-00318                                                 {
-00319                                                         if (match(user->GetFullHost(),i->data))
-00320                                                         {
-00321                                                                 WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
-00322                                                                 return NULL;
-00323                                                         }
-00324                                                 }
-00325                                         }
-00326                                 }
-00327                         }
-00328                 }
-00329                 else
-00330                 {
-00331                         log(DEBUG,"Overridden checks");
-00332                 }
-00333                 created = 1;
-00334         }
-00335 
-00336         log(DEBUG,"Passed channel checks");
-00337 
-00338         for (unsigned int index =0; index < user->chans.size(); index++)
-00339         {
-00340                 if (user->chans[index].channel == NULL)
-00341                 {
-00342                         return ForceChan(Ptr,user->chans[index],user,created);
-00343                 }
-00344         }
-00345         /* XXX: If the user is an oper here, we can just extend their user->chans vector by one
-00346          * and put the channel in here. Same for remote users which are not bound by
-00347          * the channel limits. Otherwise, nope, youre boned.
-00348          */
-00349         if (user->fd < 0)
-00350         {
-00351                 ucrec a;
-00352                 chanrec* c = ForceChan(Ptr,a,user,created);
-00353                 user->chans.push_back(a);
-00354                 return c;
-00355         }
-00356         else if (strchr(user->modes,'o'))
-00357         {
-00358                 /* Oper allows extension up to the OPERMAXCHANS value */
-00359                 if (user->chans.size() < OPERMAXCHANS)
-00360                 {
-00361                         ucrec a;
-00362                         chanrec* c = ForceChan(Ptr,a,user,created);
-00363                         user->chans.push_back(a);
-00364                         return c;
-00365                 }
-00366         }
-00367         log(DEBUG,"add_channel: user channel max exceeded: %s %s",user->nick,cname);
-00368         WriteServ(user->fd,"405 %s %s :You are on too many channels",user->nick, cname);
-00369         return NULL;
-00370 }
-
-

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
chanrec* del_channel userrec user,
const char *  cname,
const char *  reason,
bool  local
-
- - - - - -
-   - - -

- -

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

-References chanlist, userrec::chans, DEBUG, DEFAULT, chanrec::DelUser(), FindChan(), FOREACH_MOD, log(), chanrec::name, userrec::nick, and WriteChannel(). -

-Referenced by Server::PartUserFromChannel().

00402 {
-00403         if ((!user) || (!cname))
-00404         {
-00405                 log(DEFAULT,"*** BUG *** del_channel was given an invalid parameter");
-00406                 return NULL;
-00407         }
-00408 
-00409         chanrec* Ptr = FindChan(cname);
-00410 
-00411         if (!Ptr)
-00412                 return NULL;
-00413 
-00414         FOREACH_MOD OnUserPart(user,Ptr);
-00415         log(DEBUG,"del_channel: removing: %s %s",user->nick,Ptr->name);
-00416 
-00417         for (unsigned int i =0; i < user->chans.size(); i++)
-00418         {
-00419                 /* zap it from the channel list of the user */
-00420                 if (user->chans[i].channel == Ptr)
-00421                 {
-00422                         if (reason)
-00423                         {
-00424                                 WriteChannel(Ptr,user,"PART %s :%s",Ptr->name, reason);
-00425                         }
-00426                         else
-00427                         {
-00428                                 WriteChannel(Ptr,user,"PART :%s",Ptr->name);
-00429                         }
-00430                         user->chans[i].uc_modes = 0;
-00431                         user->chans[i].channel = NULL;
-00432                         log(DEBUG,"del_channel: unlinked: %s %s",user->nick,Ptr->name);
-00433                         break;
-00434                 }
-00435         }
-00436 
-00437         Ptr->DelUser((char*)user);
-00438 
-00439         /* if there are no users left on the channel */
-00440         if (!usercount(Ptr))
-00441         {
-00442                 chan_hash::iterator iter = chanlist.find(Ptr->name);
-00443 
-00444                 log(DEBUG,"del_channel: destroying channel: %s",Ptr->name);
-00445 
-00446                 /* kill the record */
-00447                 if (iter != chanlist.end())
-00448                 {
-00449                         log(DEBUG,"del_channel: destroyed: %s",Ptr->name);
-00450                         delete Ptr;
-00451                         chanlist.erase(iter);
-00452                 }
-00453         }
-00454 
-00455         return NULL;
-00456 }
-
-

-

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void kick_channel userrec src,
userrec user,
chanrec Ptr,
char *  reason
-
- - - - - -
-   - - -

- -

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

-References AC_KICK, ACR_DEFAULT, ACR_DENY, chanlist, userrec::chans, cstatus(), DEBUG, DEFAULT, chanrec::DelUser(), connection::fd, FOREACH_MOD, FOREACH_RESULT, has_channel(), is_uline(), log(), chanrec::name, userrec::nick, userrec::server, STATUS_HOP, WriteChannel(), and WriteServ().

00460 {
-00461         if ((!src) || (!user) || (!Ptr) || (!reason))
-00462         {
-00463                 log(DEFAULT,"*** BUG *** kick_channel was given an invalid parameter");
-00464                 return;
-00465         }
-00466 
-00467         if ((!Ptr) || (!user) || (!src))
-00468         {
-00469                 return;
-00470         }
-00471 
-00472         log(DEBUG,"kick_channel: removing: %s %s %s",user->nick,Ptr->name,src->nick);
-00473 
-00474         if (!has_channel(user,Ptr))
-00475         {
-00476                 WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name);
-00477                 return;
-00478         }
-00479 
-00480         int MOD_RESULT = 0;
-00481         FOREACH_RESULT(OnAccessCheck(src,user,Ptr,AC_KICK));
-00482         if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
-00483                 return;
-00484 
-00485         if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
-00486         {
-00487                 if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
-00488                 {
-00489                         if (cstatus(src,Ptr) == STATUS_HOP)
-00490                         {
-00491                                 WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
-00492                         }
-00493                         else
-00494                         {
-00495                                 WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
-00496                         }
-00497 
-00498                         return;
-00499                 }
-00500         }
-00501 
-00502         if (!is_uline(src->server))
-00503         {
-00504                 MOD_RESULT = 0;
-00505                 FOREACH_RESULT(OnUserPreKick(src,user,Ptr,reason));
-00506                 if (MOD_RESULT)
-00507                         return;
-00508         }
-00509 
-00510         FOREACH_MOD OnUserKick(src,user,Ptr,reason);
-00511 
-00512         for (unsigned int i =0; i < user->chans.size(); i++)
-00513         {
-00514                 /* zap it from the channel list of the user */
-00515                 if (user->chans[i].channel)
-00516                 if (!strcasecmp(user->chans[i].channel->name,Ptr->name))
-00517                 {
-00518                         WriteChannel(Ptr,src,"KICK %s %s :%s",Ptr->name, user->nick, reason);
-00519                         user->chans[i].uc_modes = 0;
-00520                         user->chans[i].channel = NULL;
-00521                         log(DEBUG,"del_channel: unlinked: %s %s",user->nick,Ptr->name);
-00522                         break;
-00523                 }
-00524         }
-00525 
-00526         Ptr->DelUser((char*)user);
-00527 
-00528         /* if there are no users left on the channel */
-00529         if (!usercount(Ptr))
-00530         {
-00531                 chan_hash::iterator iter = chanlist.find(Ptr->name);
-00532 
-00533                 log(DEBUG,"del_channel: destroying channel: %s",Ptr->name);
-00534 
-00535                 /* kill the record */
-00536                 if (iter != chanlist.end())
-00537                 {
-00538                         log(DEBUG,"del_channel: destroyed: %s",Ptr->name);
-00539                         delete Ptr;
-00540                         chanlist.erase(iter);
-00541                 }
-00542         }
-00543 }
-
-

-

-


Generated on Mon Dec 19 18:05:20 2005 for InspIRCd by  - -doxygen 1.4.4-20050815
- - -- cgit v1.2.3