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

ModuleSafeList Class Reference

Inheritance diagram for ModuleSafeList:

Inheritance graph
[legend]
Collaboration diagram for ModuleSafeList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleSafeList (InspIRCd *Me)
virtual ~ModuleSafeList ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual Version GetVersion ()
 Returns the version number of a Module.
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.
int HandleList (const std::vector< std::string > &parameters, User *user)
virtual void OnBufferFlushed (User *user)
 Called whenever a user's write buffer has been completely sent.
virtual void OnCleanup (int target_type, void *item)
 Called before your module is unloaded to clean up Extensibles.
virtual void On005Numeric (std::string &output)
 Called when a 005 numeric is about to be output.
virtual void OnUserQuit (User *user, const std::string &message, const std::string &oper_message)
 Called when a user quits.

Private Attributes

time_t ThrottleSecs
size_t ServerNameSize
int global_listing
int LimitList

Detailed Description

Definition at line 34 of file m_safelist.cpp.


Constructor & Destructor Documentation

ModuleSafeList::ModuleSafeList InspIRCd Me  )  [inline]
 

Definition at line 41 of file m_safelist.cpp.

References ModuleManager::Attach(), I_On005Numeric, I_OnBufferFlushed, I_OnCleanup, I_OnPreCommand, I_OnRehash, I_OnUserQuit, InspIRCd::Modules, OnRehash(), and Module::ServerInstance.

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

Definition at line 48 of file m_safelist.cpp.


Member Function Documentation

virtual Version ModuleSafeList::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 61 of file m_safelist.cpp.

References API_VERSION, and VF_VENDOR.

int ModuleSafeList::HandleList const std::vector< std::string > &  parameters,
User user
[inline]
 

Definition at line 88 of file m_safelist.cpp.

References DEBUG, Extensible::Extend(), Extensible::GetExt(), global_listing, IS_OPER, LimitList, LogManager::Log(), InspIRCd::Logs, User::nick, Module::ServerInstance, Extensible::Shrink(), ThrottleSecs, InspIRCd::Time(), User::WriteNumeric(), and User::WriteServ().

Referenced by OnPreCommand().

virtual void ModuleSafeList::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 261 of file m_safelist.cpp.

virtual void ModuleSafeList::OnBufferFlushed User user  )  [inline, virtual]
 

Called whenever a user's write buffer has been completely sent.

This is called when the user's write buffer is completely empty, and there are no more pending bytes to be written and no pending write events in the socket engine's queue. This may be used to refill the buffer with data which is being spooled in a controlled manner, e.g. LIST lines.

Parameters:
user The user who's buffer is now empty.

Reimplemented from Module.

Definition at line 162 of file m_safelist.cpp.

References Channel::ChanModes(), InspIRCd::GetChannelIndex(), Extensible::GetExt(), ConnectClass::GetSendqMax(), Channel::GetUserCounter(), ListData::glob, global_listing, User::HasPrivPermission(), Channel::HasUser(), Channel::IsModeSet(), ListData::list_ended, ListData::list_position, InspIRCd::Match(), MAXBUF, ListData::maxusers, ListData::minusers, User::MyClass, Channel::name, User::nick, Module::ServerInstance, ServerNameSize, Extensible::Shrink(), Channel::topic, User::WriteNumeric(), and User::WriteServ().

virtual void ModuleSafeList::OnCleanup int  target_type,
void *  item
[inline, virtual]
 

Called before your module is unloaded to clean up Extensibles.

This method is called once for every user and channel on the network, so that when your module unloads it may clear up any remaining data in the form of Extensibles added using Extensible::Extend(). If the target_type variable is TYPE_USER, then void* item refers to a User*, otherwise it refers to a Channel*.

Parameters:
target_type The type of item being cleaned
item A pointer to the item's class

Reimplemented from Module.

Definition at line 238 of file m_safelist.cpp.

References Extensible::GetExt(), global_listing, Extensible::Shrink(), and TYPE_USER.

Referenced by OnUserQuit().

virtual int ModuleSafeList::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 71 of file m_safelist.cpp.

References HandleList().

virtual void ModuleSafeList::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 52 of file m_safelist.cpp.

References InspIRCd::Config, global_listing, LimitList, ConfigReader::ReadInteger(), Module::ServerInstance, ServerConfig::ServerName, ServerNameSize, and ThrottleSecs.

Referenced by ModuleSafeList().

virtual void ModuleSafeList::OnUserQuit User user,
const std::string message,
const std::string oper_message
[inline, virtual]
 

Called when a user quits.

The details of the exiting user are available to you in the parameter User *user This event is only called when the user is fully registered when they quit. To catch raw disconnections, use the OnUserDisconnect method.

Parameters:
user The user who is quitting
message The user's quit message (as seen by non-opers)
oper_message The user's quit message (as seen by opers)

Reimplemented from Module.

Definition at line 266 of file m_safelist.cpp.

References OnCleanup(), and TYPE_USER.


Member Data Documentation

int ModuleSafeList::global_listing [private]
 

Definition at line 38 of file m_safelist.cpp.

Referenced by HandleList(), OnBufferFlushed(), OnCleanup(), and OnRehash().

int ModuleSafeList::LimitList [private]
 

Definition at line 39 of file m_safelist.cpp.

Referenced by HandleList(), and OnRehash().

size_t ModuleSafeList::ServerNameSize [private]
 

Definition at line 37 of file m_safelist.cpp.

Referenced by OnBufferFlushed(), and OnRehash().

time_t ModuleSafeList::ThrottleSecs [private]
 

Definition at line 36 of file m_safelist.cpp.

Referenced by HandleList(), and OnRehash().


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