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

ModuleSQLOper Class Reference

Inheritance diagram for ModuleSQLOper:

Inheritance graph
[legend]
Collaboration diagram for ModuleSQLOper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleSQLOper (InspIRCd *Me)
bool OneOfMatches (const char *host, const char *ip, const char *hostlist)
virtual void OnLoadModule (Module *mod, const std::string &name)
 Called whenever a module is loaded.
virtual ~ModuleSQLOper ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
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.
bool LookupOper (User *user, const std::string &username, const std::string &password)
virtual const char * OnRequest (Request *request)
 Called whenever a Request class is sent to your module by another module.
void LoginFail (User *user, const std::string &username, const std::string &pass)
bool OperUser (User *user, const std::string &pattern, const std::string &type)
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

ModuleSQLutils
std::string databaseid
irc::string hashtype
hashymodules hashers
bool diduseiface
std::deque< std::stringnames

Detailed Description

Definition at line 25 of file m_sqloper.cpp.


Constructor & Destructor Documentation

ModuleSQLOper::ModuleSQLOper InspIRCd Me  )  [inline]
 

Definition at line 35 of file m_sqloper.cpp.

References ModuleManager::Attach(), diduseiface, ModuleManager::Find(), ModuleManager::FindInterface(), hashers, I_OnLoadModule, I_OnPreCommand, I_OnRehash, I_OnRequest, InspIRCd::Modules, names, OnRehash(), Module::ServerInstance, SQLutils, and ModuleManager::UseInterface().

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

Definition at line 107 of file m_sqloper.cpp.

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


Member Function Documentation

virtual Version ModuleSQLOper::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 327 of file m_sqloper.cpp.

References API_VERSION, and VF_VENDOR.

void ModuleSQLOper::LoginFail User user,
const std::string username,
const std::string pass
[inline]
 

Definition at line 283 of file m_sqloper.cpp.

References DEBUG, CommandParser::GetHandler(), Command::Handle(), LogManager::Log(), InspIRCd::Logs, InspIRCd::Parser, and Module::ServerInstance.

Referenced by OnRequest().

bool ModuleSQLOper::LookupOper User user,
const std::string username,
const std::string password
[inline]
 

Definition at line 141 of file m_sqloper.cpp.

References databaseid, Extensible::Extend(), ModuleManager::FindFeature(), hashers, hashtype, SQLrequest::id, LogManager::Log(), InspIRCd::Logs, InspIRCd::Modules, Request::Send(), Module::ServerInstance, SPARSE, and SQLutils.

Referenced by OnPreCommand().

bool ModuleSQLOper::OneOfMatches const char *  host,
const char *  ip,
const char *  hostlist
[inline]
 

Definition at line 77 of file m_sqloper.cpp.

References InspIRCd::Match(), and InspIRCd::MatchCIDR().

Referenced by OperUser().

virtual void ModuleSQLOper::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 91 of file m_sqloper.cpp.

References DEBUG, diduseiface, hashers, LogManager::Log(), InspIRCd::Logs, ModuleManager::ModuleHasInterface(), InspIRCd::Modules, names, Module::ServerInstance, and ModuleManager::UseInterface().

virtual int ModuleSQLOper::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 124 of file m_sqloper.cpp.

References LookupOper().

virtual void ModuleSQLOper::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 116 of file m_sqloper.cpp.

References assign(), Conf, databaseid, hashtype, ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by ModuleSQLOper().

virtual const char* ModuleSQLOper::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 192 of file m_sqloper.cpp.

References SQLresult::error, Extensible::GetExt(), Request::GetId(), SQLresult::GetRowMap(), SQLerror::Id(), SQLresult::id, LoginFail(), OperUser(), SQLresult::Rows(), SQL_NO_ERROR, SQLRESID, SQLSUCCESS, and SQLutils.

bool ModuleSQLOper::OperUser User user,
const std::string pattern,
const std::string type
[inline]
 

Definition at line 300 of file m_sqloper.cpp.

References User::ChangeDisplayedHost(), Conf, ConfigReader::Enumerate(), User::GetIPString(), User::host, User::ident, OneOfMatches(), User::Oper(), ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by OnRequest().


Member Data Documentation

std::string ModuleSQLOper::databaseid [private]
 

Definition at line 28 of file m_sqloper.cpp.

Referenced by LookupOper(), and OnRehash().

bool ModuleSQLOper::diduseiface [private]
 

Definition at line 31 of file m_sqloper.cpp.

Referenced by ModuleSQLOper(), OnLoadModule(), and ~ModuleSQLOper().

hashymodules ModuleSQLOper::hashers [private]
 

Definition at line 30 of file m_sqloper.cpp.

Referenced by LookupOper(), ModuleSQLOper(), and OnLoadModule().

irc::string ModuleSQLOper::hashtype [private]
 

Definition at line 29 of file m_sqloper.cpp.

Referenced by LookupOper(), and OnRehash().

std::deque<std::string> ModuleSQLOper::names [private]
 

Definition at line 32 of file m_sqloper.cpp.

Referenced by ModuleSQLOper(), and OnLoadModule().

Module* ModuleSQLOper::SQLutils [private]
 

Definition at line 27 of file m_sqloper.cpp.

Referenced by LookupOper(), ModuleSQLOper(), and OnRequest().


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