The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ModuleBanException Class Reference

Inheritance diagram for ModuleBanException:

Inheritance graph
[legend]
Collaboration diagram for ModuleBanException:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleBanException (InspIRCd *Me)
virtual void Implements (char *List)
 The Implements function specifies which methods a module should receive events for.
virtual void On005Numeric (std::string &output)
 Called when a 005 numeric is about to be output.
virtual int OnCheckBan (userrec *user, chanrec *chan)
 Called whenever a user joins a channel, to determine if banlist checks should go ahead or not.
virtual void OnCleanup (int target_type, void *item)
 Called before your module is unloaded to clean up Extensibles.
virtual void OnSyncChannel (chanrec *chan, Module *proto, void *opaque)
 Allows modules to synchronize data which relates to channels during a netburst.
virtual void OnChannelDelete (chanrec *chan)
 Called whenever a channel is deleted, either by QUIT, KICK or PART.
virtual void OnRehash (userrec *user, const std::string &param)
 Called on rehash.
virtual char * OnRequest (Request *request)
 Called whenever a Request class is sent to your module by another module.
virtual Version GetVersion ()
 Returns the version number of a Module.
virtual ~ModuleBanException ()

Private Attributes

BanExceptionbe

Detailed Description

Definition at line 43 of file m_banexception.cpp.


Constructor & Destructor Documentation

ModuleBanException::ModuleBanException InspIRCd Me  )  [inline]
 

Definition at line 49 of file m_banexception.cpp.

References InspIRCd::AddMode(), be, InspIRCd::PublishInterface(), and Module::ServerInstance.

00050         : Module(Me)
00051         {
00052                 be = new BanException(ServerInstance);
00053                 if (!ServerInstance->AddMode(be, 'e'))
00054                         throw ModuleException("Could not add new modes!");
00055                 ServerInstance->PublishInterface("ChannelBanList", this);
00056         }

virtual ModuleBanException::~ModuleBanException  )  [inline, virtual]
 

Definition at line 145 of file m_banexception.cpp.

References be, DELETE(), ModeParser::DelMode(), InspIRCd::Modes, Module::ServerInstance, and InspIRCd::UnpublishInterface().

00146         {
00147                 ServerInstance->Modes->DelMode(be);
00148                 DELETE(be);
00149                 ServerInstance->UnpublishInterface("ChannelBanList", this);
00150         }


Member Function Documentation

virtual Version ModuleBanException::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 140 of file m_banexception.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

00141         {
00142                 return Version(1, 1, 0, 3, VF_COMMON | VF_VENDOR, API_VERSION);
00143         }

virtual void ModuleBanException::Implements char *  List  )  [inline, virtual]
 

The Implements function specifies which methods a module should receive events for.

The char* parameter passed to this function contains a set of true or false values (1 or 0) which indicate wether each function is implemented. You must use the Iimplementation enum (documented elsewhere on this page) to mark functions as active. For example, to receive events for OnUserJoin():

Implements[I_OnUserJoin] = 1;

Parameters:
The implement list

Reimplemented from Module.

Definition at line 58 of file m_banexception.cpp.

References be, ListModeBase::DoImplements(), I_On005Numeric, I_OnCheckBan, I_OnRehash, and I_OnRequest.

00059         {
00060                 be->DoImplements(List);
00061                 List[I_OnRehash] = List[I_OnRequest] = List[I_On005Numeric] = List[I_OnCheckBan] = 1;
00062         }

virtual void ModuleBanException::On005Numeric std::string output  )  [inline, virtual]
 

Called when a 005 numeric is about to be output.

The module should modify the 005 numeric if needed to indicate its features.

Parameters:
output The 005 string to be modified if neccessary.

Reimplemented from Module.

Definition at line 64 of file m_banexception.cpp.

00065         {
00066                 output.append(" EXCEPTS=e");
00067         }

virtual void ModuleBanException::OnChannelDelete chanrec chan  )  [inline, virtual]
 

Called whenever a channel is deleted, either by QUIT, KICK or PART.

Parameters:
chan The channel being deleted

Reimplemented from Module.

Definition at line 105 of file m_banexception.cpp.

References be, and ListModeBase::DoChannelDelete().

00106         {
00107                 be->DoChannelDelete(chan);
00108         }

virtual int ModuleBanException::OnCheckBan userrec user,
chanrec chan
[inline, virtual]
 

Called whenever a user joins a channel, to determine if banlist checks should go ahead or not.

This method will always be called for each join, wether or not the user actually matches a channel ban, and determines the outcome of an if statement around the whole section of ban checking code. return 1 to explicitly allow the join to go ahead or 0 to ignore the event.

Parameters:
user The user joining the channel
chan The channel being joined
Returns:
1 to explicitly allow the join, 0 to proceed as normal

Reimplemented from Module.

Definition at line 69 of file m_banexception.cpp.

References be, Extensible::GetExt(), userrec::GetFullHost(), userrec::GetFullRealHost(), ListModeBase::GetInfoKey(), userrec::GetIPString(), userrec::ident, match(), MAXBUF, and userrec::nick.

00070         {
00071                 if (chan != NULL)
00072                 {
00073                         modelist* list;
00074                         chan->GetExt(be->GetInfoKey(), list);
00075                         
00076                         if (list)
00077                         {
00078                                 char mask[MAXBUF];
00079                                 snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString());
00080                                 for (modelist::iterator it = list->begin(); it != list->end(); it++)
00081                                 {
00082                                         if (match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str()) || (match(mask, it->mask.c_str(), true)))
00083                                         {
00084                                                 // They match an entry on the list, so let them in.
00085                                                 return 1;
00086                                         }
00087                                 }
00088                                 return 0;
00089                         }
00090                         // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
00091                 }
00092                 return 0;       
00093         }

virtual void ModuleBanException::OnCleanup