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

ModuleSQLAuth Class Reference

Inheritance diagram for ModuleSQLAuth:

Inheritance graph
[legend]
Collaboration diagram for ModuleSQLAuth:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleSQLAuth (InspIRCd *Me)
virtual ~ModuleSQLAuth ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual int OnUserRegister (User *user)
 Called whenever a user is about to register their connection (e.g.
void SearchAndReplace (std::string &newline, const std::string &find, const std::string &replace)
bool CheckCredentials (User *user)
virtual const char * OnRequest (Request *request)
 Called whenever a Request class is sent to your module by another module.
virtual void OnUserDisconnect (User *user)
 Called whenever a user's socket is closed.
virtual bool OnCheckReady (User *user)
 Called to check if a user who is connecting can now be allowed to register If any modules return false for this function, the user is held in the waiting state until all modules return true.
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

ModuleSQLutils
ModuleSQLprovider
std::string freeformquery
std::string killreason
std::string allowpattern
std::string databaseid
bool verbose

Detailed Description

Definition at line 22 of file m_sqlauth.cpp.


Constructor & Destructor Documentation

ModuleSQLAuth::ModuleSQLAuth InspIRCd Me  )  [inline]
 

Definition at line 35 of file m_sqlauth.cpp.

References ModuleManager::Attach(), ModuleManager::Find(), ModuleManager::FindFeature(), I_OnCheckReady, I_OnRehash, I_OnRequest, I_OnUserDisconnect, I_OnUserRegister, InspIRCd::Modules, OnRehash(), Module::ServerInstance, SQLprovider, SQLutils, and ModuleManager::UseInterface().

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

Definition at line 54 of file m_sqlauth.cpp.

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


Member Function Documentation

bool ModuleSQLAuth::CheckCredentials User user  )  [inline]
 

Definition at line 100 of file m_sqlauth.cpp.

References databaseid, SQLrequest::error, ModuleManager::Find(), freeformquery, User::GetIPString(), User::host, SQLrequest::id, User::ident, InspIRCd::Modules, User::nick, User::password, SearchAndReplace(), Request::Send(), Module::ServerInstance, InspIRCd::SNO, SQLprovider, SQLutils, SQLerror::Str(), verbose, and SnomaskManager::WriteToSnoMask().

Referenced by OnUserRegister().

virtual Version ModuleSQLAuth::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 210 of file m_sqlauth.cpp.

References API_VERSION, and VF_VENDOR.

virtual bool ModuleSQLAuth::OnCheckReady User user  )  [inline, virtual]
 

Called to check if a user who is connecting can now be allowed to register If any modules return false for this function, the user is held in the waiting state until all modules return true.

For example a module which implements ident lookups will continue to return false for a user until their ident lookup is completed. Note that the registration timeout for a user overrides these checks, if the registration timeout is reached, the user is disconnected even if modules report that the user is not ready to connect.

Parameters:
user The user to check
Returns:
true to indicate readiness, false if otherwise

Reimplemented from Module.

Definition at line 205 of file m_sqlauth.cpp.

References Extensible::GetExt().

virtual void ModuleSQLAuth::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 61 of file m_sqlauth.cpp.

References allowpattern, Conf, databaseid, freeformquery, killreason, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), Module::ServerInstance, and verbose.

Referenced by ModuleSQLAuth().

virtual const char* ModuleSQLAuth::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 154 of file m_sqlauth.cpp.

References SQLresult::error, Extensible::Extend(), Extensible::GetExt(), Request::GetId(), User::host, SQLerror::Id(), SQLresult::id, User::ident, killreason, User::nick, UserManager::QuitUser(), SQLresult::Rows(), Module::ServerInstance, InspIRCd::SNO, SQL_NO_ERROR, SQLRESID, SQLSUCCESS, SQLutils, SQLerror::Str(), InspIRCd::Users, verbose, and SnomaskManager::WriteToSnoMask().

virtual void ModuleSQLAuth::OnUserDisconnect User user  )  [inline, virtual]
 

Called whenever a user's socket is closed.

The details of the exiting user are available to you in the parameter User *user This event is called for all users, registered or not, as a cleanup method for modules which might assign resources to user, such as dns lookups, objects and sockets.

Parameters:
user The user who is disconnecting

Reimplemented from Module.

Definition at line 199 of file m_sqlauth.cpp.

References Extensible::Shrink().

virtual int ModuleSQLAuth::OnUserRegister User user  )  [inline, virtual]
 

Called whenever a user is about to register their connection (e.g.

before the user is sent the MOTD etc). Modules can use this method if they are performing a function which must be done before the actual connection is completed (e.g. ident lookups, dnsbl lookups, etc). Note that you should NOT delete the user record here by causing a disconnection! Use OnUserConnect for that instead.

Parameters:
user The user registering
Returns:
1 to indicate user quit, 0 to continue

Reimplemented from Module.

Definition at line 72 of file m_sqlauth.cpp.

References allowpattern, CheckCredentials(), Extensible::Extend(), killreason, InspIRCd::Match(), User::nick, UserManager::QuitUser(), Module::ServerInstance, and InspIRCd::Users.

void ModuleSQLAuth::SearchAndReplace std::string newline,
const std::string find,
const std::string replace
[inline]
 

Definition at line 88 of file m_sqlauth.cpp.

Referenced by CheckCredentials().


Member Data Documentation

std::string ModuleSQLAuth::allowpattern [private]
 

Definition at line 29 of file m_sqlauth.cpp.

Referenced by OnRehash(), and OnUserRegister().

std::string ModuleSQLAuth::databaseid [private]
 

Definition at line 30 of file m_sqlauth.cpp.

Referenced by CheckCredentials(), and OnRehash().

std::string ModuleSQLAuth::freeformquery [private]
 

Definition at line 27 of file m_sqlauth.cpp.

Referenced by CheckCredentials(), and OnRehash().

std::string ModuleSQLAuth::killreason [private]
 

Definition at line 28 of file m_sqlauth.cpp.

Referenced by OnRehash(), OnRequest(), and OnUserRegister().

Module* ModuleSQLAuth::SQLprovider [private]
 

Definition at line 25 of file m_sqlauth.cpp.

Referenced by CheckCredentials(), and ModuleSQLAuth().

Module* ModuleSQLAuth::SQLutils [private]
 

Definition at line 24 of file m_sqlauth.cpp.

Referenced by CheckCredentials(), ModuleSQLAuth(), and OnRequest().

bool ModuleSQLAuth::verbose [private]
 

Definition at line 32 of file m_sqlauth.cpp.

Referenced by CheckCredentials(), OnRehash(), and OnRequest().


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