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

ModuleSQLLog Class Reference

Inheritance diagram for ModuleSQLLog:

Inheritance graph
[legend]
Collaboration diagram for ModuleSQLLog:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleSQLLog (InspIRCd *Me)
virtual ~ModuleSQLLog ()
void ReadConfig ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual const char * OnRequest (Request *request)
 Called whenever a Request class is sent to your module by another module.
void AddLogEntry (int category, const std::string &nick, const std::string &host, const std::string &source)
virtual void OnOper (User *user, const std::string &opertype)
 Called whenever a user opers locally.
virtual void OnGlobalOper (User *user)
 Called whenever a user is given usermode +o, anywhere on the network.
virtual int OnKill (User *source, User *dest, const std::string &reason)
 Called when a client is disconnected by KILL.
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 void OnUserConnect (User *user)
 Called when a user connects.
virtual void OnUserQuit (User *user, const std::string &reason, const std::string &oper_message)
 Called when a user quits.
virtual void OnLoadModule (Module *mod, const std::string &name)
 Called whenever a module is loaded.
virtual Version GetVersion ()
 Returns the version number of a Module.

Detailed Description

Definition at line 182 of file m_sqllog.cpp.


Constructor & Destructor Documentation

ModuleSQLLog::ModuleSQLLog InspIRCd Me  )  [inline]
 

Definition at line 186 of file m_sqllog.cpp.

References active_queries, ModuleManager::Attach(), ModuleManager::Find(), ModuleManager::FindFeature(), I_OnGlobalOper, I_OnKill, I_OnLoadModule, I_OnOper, I_OnPreCommand, I_OnRehash, I_OnRequest, I_OnUserConnect, I_OnUserQuit, InspIRCd::Modules, OnRehash(), Module::ServerInstance, and ModuleManager::UseInterface().

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

Definition at line 207 of file m_sqllog.cpp.

References ModuleManager::DoneWithInterface(), InspIRCd::Modules, and Module::ServerInstance.


Member Function Documentation

void ModuleSQLLog::AddLogEntry int  category,
const std::string nick,
const std::string host,
const std::string source
[inline]
 

Definition at line 247 of file m_sqllog.cpp.

References active_queries, dbid, FIND_SOURCE, SQLrequest::id, QueryInfo::qs, Request::Send(), and Module::ServerInstance.

Referenced by OnGlobalOper(), OnKill(), OnLoadModule(), OnOper(), OnPreCommand(), OnUserConnect(), and OnUserQuit().

virtual Version ModuleSQLLog::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 302 of file m_sqllog.cpp.

References API_VERSION, and VF_VENDOR.

virtual void ModuleSQLLog::OnGlobalOper User user  )  [inline, virtual]
 

Called whenever a user is given usermode +o, anywhere on the network.

You cannot override this and prevent it from happening as it is already happened and such a task must be performed by another server. You can however bounce modes by sending servermodes out to reverse mode changes.

Parameters:
user The user who is opering

Reimplemented from Module.

Definition at line 267 of file m_sqllog.cpp.

References AddLogEntry(), User::host, LT_OPER, User::nick, and User::server.

virtual int ModuleSQLLog::OnKill User source,
User dest,
const std::string reason
[inline, virtual]
 

Called when a client is disconnected by KILL.

If a client is killed by a server, e.g. a nickname collision or protocol error, source is NULL. Return 1 from this function to prevent the kill, and 0 from this function to allow it as normal. If you prevent the kill no output will be sent to the client, it is down to your module to generate this information. NOTE: It is NOT advisable to stop kills which originate from servers or remote users. If you do so youre risking race conditions, desyncs and worse!

Parameters:
source The user sending the KILL
dest The user being killed
reason The kill reason
Returns:
1 to prevent the kill, 0 to allow

Reimplemented from Module.

Definition at line 272 of file m_sqllog.cpp.

References AddLogEntry(), User::host, LT_KILL, and User::nick.

virtual void ModuleSQLLog::OnLoadModule Module mod,
const std::string name
[inline, virtual]
 

Called whenever a module is loaded.

mod will contain a pointer to the module, and string will contain its name, for example m_widgets.so. This function is primary for dependency checking, your module may decide to enable some extra features if it sees that you have for example loaded "m_killwidgets.so" with "m_makewidgets.so". It is highly recommended that modules do *NOT* bail if they cannot satisfy dependencies, but instead operate under reduced functionality, unless the dependency is absolutely neccessary (e.g. a module that extends the features of another module).

Parameters:
mod A pointer to the new module
name The new module's filename

Reimplemented from Module.

Definition at line 297 of file m_sqllog.cpp.

References AddLogEntry(), InspIRCd::Config, LT_LOADMODULE, Module::ServerInstance, and ServerConfig::ServerName.

virtual void ModuleSQLLog::OnOper User user,
const std::string opertype
[inline, virtual]
 

Called whenever a user opers locally.

The User will contain the oper mode 'o' as this function is called after any modifications are made to the user's structure by the core.

Parameters:
user The user who is opering up
opertype The opers type name

Reimplemented from Module.

Definition at line 262 of file m_sqllog.cpp.

References AddLogEntry(), User::host, LT_OPER, User::nick, and User::server.

virtual int ModuleSQLLog::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 278 of file m_sqllog.cpp.

References AddLogEntry(), LT_XLINE, User::nick, and User::server.

virtual void ModuleSQLLog::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 220 of file m_sqllog.cpp.

References ReadConfig().

Referenced by ModuleSQLLog().

virtual const char* ModuleSQLLog::OnRequest Request request  )  [inline, virtual]
 

Called whenever a Request class is sent to your module by another module.

Please see the documentation of Request::Send() for further information. The Request sent can always be assumed to be non-NULL, you should not change the request object or its data. Your method may return arbitary data in the char* result which the requesting module may be able to use for pre-determined purposes (e.g. the results of an SQL query, etc).

Parameters:
request The Request class being received

Reimplemented from Module.

Definition at line 225 of file m_sqllog.cpp.

References active_queries, Request::GetId(), SQLresult::id, SQLRESID, and SQLSUCCESS.

virtual void ModuleSQLLog::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 287 of file m_sqllog.cpp.

References AddLogEntry(), User::host, LT_CONNECT, User::nick, and User::server.

virtual void ModuleSQLLog::OnUserQuit User user,
const std::string reason,
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 292 of file m_sqllog.cpp.

References AddLogEntry(), User::host, LT_DISCONNECT, User::nick, and User::server.

void ModuleSQLLog::ReadConfig  )  [inline]
 

Definition at line 214 of file m_sqllog.cpp.

References Conf, dbid, ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by OnRehash().


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