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

ModuleShun Class Reference

Inheritance diagram for ModuleShun:

Inheritance graph
[legend]
Collaboration diagram for ModuleShun:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleShun (InspIRCd *Me)
virtual ~ModuleShun ()
virtual int OnStats (char symbol, User *user, string_list &out)
 Called on all /STATS commands This method is triggered for all /STATS use, including stats symbols handled by the core.
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual void OnUserConnect (User *user)
 Called when a user connects.
virtual int OnPreCommand (std::string &command, std::vector< std::string > &parameters, User *user, bool validated, const std::string &original_line)
 Called whenever any command is about to be executed.
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

cmd_shunmycommand
ShunFactoryf
std::map< std::string, bool > ShunEnabledCommands
bool NotifyOfShun

Detailed Description

Definition at line 144 of file m_shun.cpp.


Constructor & Destructor Documentation

ModuleShun::ModuleShun InspIRCd Me  )  [inline]
 

Definition at line 152 of file m_shun.cpp.

References InspIRCd::AddCommand(), ModuleManager::Attach(), f, I_OnPreCommand, I_OnRehash, I_OnStats, I_OnUserConnect, InspIRCd::Modules, mycommand, OnRehash(), XLineManager::RegisterFactory(), Module::ServerInstance, and InspIRCd::XLines.

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

Definition at line 165 of file m_shun.cpp.

References XLineManager::DelAll(), f, Module::ServerInstance, XLineManager::UnregisterFactory(), and InspIRCd::XLines.


Member Function Documentation

virtual Version ModuleShun::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 251 of file m_shun.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

virtual int ModuleShun::OnPreCommand std::string command,
std::vector< std::string > &  parameters,
User user,
bool  validated,
const std::string original_line
[inline, virtual]
 

Called whenever any command is about to be executed.

This event occurs for all registered commands, wether they are registered in the core, or another module, and for invalid commands. Invalid commands may only be sent to this function when the value of validated is false. By returning 1 from this method you may prevent the command being executed. If you do this, no output is created by the core, and it is down to your module to produce any output neccessary. Note that unless you return 1, you should not destroy any structures (e.g. by using InspIRCd::QuitUser) otherwise when the command's handler function executes after your method returns, it will be passed an invalid pointer to the user object and crash!)

Parameters:
command The command being executed
parameters An array of array of characters containing the parameters for the command
pcnt The nuimber of parameters passed to the command
user the user issuing the command
validated True if the command has passed all checks, e.g. it is recognised, has enough parameters, the user has permission to execute it, etc. You should only change the parameter list and command string if validated == false (e.g. before the command lookup occurs).
original_line The entire original line as passed to the parser from the user
Returns:
1 to block the command, 0 to allow

Reimplemented from Module.

Definition at line 217 of file m_shun.cpp.

References Extensible::GetExt(), XLineManager::MatchesLine(), User::nick, Module::ServerInstance, Extensible::Shrink(), ShunEnabledCommands, User::WriteServ(), and InspIRCd::XLines.

virtual void ModuleShun::OnRehash User user,
const std::string parameter
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 180 of file m_shun.cpp.

References NotifyOfShun, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), Module::ServerInstance, and ShunEnabledCommands.

Referenced by ModuleShun().

virtual int ModuleShun::OnStats char  symbol,
User user,
string_list out
[inline, virtual]
 

Called on all /STATS commands This method is triggered for all /STATS use, including stats symbols handled by the core.

Parameters:
symbol the symbol provided to /STATS
user the user issuing the /STATS command
results A string_list to append results into. You should put all your results into this string_list, rather than displaying them directly, so that your handler will work when remote STATS queries are received.
Returns:
1 to block the /STATS from being processed by the core, 0 to allow it

Reimplemented from Module.

Definition at line 171 of file m_shun.cpp.

References XLineManager::InvokeStats(), Module::ServerInstance, and InspIRCd::XLines.

virtual void ModuleShun::OnUserConnect User user  )  [inline, virtual]
 

Called when a user connects.

The details of the connecting user are available to you in the parameter User *user

Parameters:
user The user who is connecting

Reimplemented from Module.

Definition at line 202 of file m_shun.cpp.

References XLine::Apply(), IS_LOCAL, XLineManager::MatchesLine(), Module::ServerInstance, and InspIRCd::XLines.


Member Data Documentation

ShunFactory* ModuleShun::f [private]
 

Definition at line 147 of file m_shun.cpp.

Referenced by ModuleShun(), and ~ModuleShun().

cmd_shun* ModuleShun::mycommand [private]
 

Definition at line 146 of file m_shun.cpp.

Referenced by ModuleShun().

bool ModuleShun::NotifyOfShun [private]
 

Definition at line 149 of file m_shun.cpp.

Referenced by OnRehash().

std::map<std::string, bool> ModuleShun::ShunEnabledCommands [private]
 

Definition at line 148 of file m_shun.cpp.

Referenced by OnPreCommand(), and OnRehash().


The documentation for this class was generated from the following file: