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

ModulePgSQL Class Reference

Inheritance diagram for ModulePgSQL:

Inheritance graph
[legend]
Collaboration diagram for ModulePgSQL:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModulePgSQL (InspIRCd *Me)
virtual ~ModulePgSQL ()
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
bool HasHost (const SQLhost &host)
bool HostInConf (const SQLhost &h)
void ReadConf ()
void ClearOldConnections ()
void ClearAllConnections ()
void AddConn (const SQLhost &hi)
void ReconnectConn (SQLConn *conn)
virtual const char * OnRequest (Request *request)
 Called whenever a Request class is sent to your module by another module.
virtual void OnUnloadModule (Module *mod, const std::string &name)
 Called whenever a module is unloaded.
unsigned long NewID ()
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

ConnMap connections
unsigned long currid
char * sqlsuccess
ReconnectTimerretimer

Detailed Description

Definition at line 710 of file m_pgsql.cpp.


Constructor & Destructor Documentation

ModulePgSQL::ModulePgSQL InspIRCd Me  )  [inline]
 

Definition at line 719 of file m_pgsql.cpp.

References ModuleManager::Attach(), I_OnCheckReady, I_OnRehash, I_OnRequest, I_OnUnloadModule, I_OnUserDisconnect, I_OnUserRegister, InspIRCd::Modules, ModuleManager::PublishFeature(), ModuleManager::PublishInterface(), ReadConf(), Module::ServerInstance, SQLSUCCESS, sqlsuccess, strlcpy(), and ModuleManager::UseInterface().

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

Definition at line 740 of file m_pgsql.cpp.

References ClearAllConnections(), TimerManager::DelTimer(), ModuleManager::DoneWithInterface(), InspIRCd::Modules, retimer, Module::ServerInstance, sqlsuccess, InspIRCd::Timers, ModuleManager::UnpublishFeature(), and ModuleManager::UnpublishInterface().


Member Function Documentation

void ModulePgSQL::AddConn const SQLhost hi  )  [inline]
 

Definition at line 875 of file m_pgsql.cpp.

References connections, DEFAULT, HasHost(), SQLhost::id, LogManager::Log(), InspIRCd::Logs, and Module::ServerInstance.

Referenced by ReadConf().

void ModulePgSQL::ClearAllConnections  )  [inline]
 

Definition at line 865 of file m_pgsql.cpp.

References connections.

Referenced by ~ModulePgSQL().

void ModulePgSQL::ClearOldConnections  )  [inline]
 

Definition at line 850 of file m_pgsql.cpp.

References connections, and HostInConf().

Referenced by ReadConf().

virtual Version ModulePgSQL::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 951 of file m_pgsql.cpp.

References API_VERSION, VF_SERVICEPROVIDER, and VF_VENDOR.

bool ModulePgSQL::HasHost const SQLhost host  )  [inline]
 

Definition at line 757 of file m_pgsql.cpp.

References connections.

Referenced by AddConn(), and ReadConf().

bool ModulePgSQL::HostInConf const SQLhost h  )  [inline]
 

Definition at line 767 of file m_pgsql.cpp.

References conf, ConfigReader::Enumerate(), SQLhost::host, SQLhost::id, SQLhost::name, SQLhost::pass, SQLhost::port, ConfigReader::ReadFlag(), ConfigReader::ReadInteger(), ConfigReader::ReadValue(), Module::ServerInstance, SQLhost::ssl, and SQLhost::user.

Referenced by ClearOldConnections().

unsigned long ModulePgSQL::NewID  )  [inline]
 

Definition at line 943 of file m_pgsql.cpp.

References currid.

Referenced by OnRequest().

virtual void ModulePgSQL::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 752 of file m_pgsql.cpp.

References ReadConf().

virtual const char* ModulePgSQL::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 906 of file m_pgsql.cpp.

References connections, SQLrequest::dbid, SQLrequest::error, Request::GetId(), SQLerror::Id(), SQLrequest::id, NewID(), SQL_BAD_DBID, SQL_NO_ERROR, SQLREQID, and sqlsuccess.

virtual void ModulePgSQL::OnUnloadModule Module mod,
const std::string name
[inline, virtual]
 

Called whenever a module is unloaded.

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 Pointer to the module being unloaded (still valid)
name The filename of the module being unloaded

Reimplemented from Module.

Definition at line 929 of file m_pgsql.cpp.

References connections.

void ModulePgSQL::ReadConf  )  [inline]
 

Definition at line 786 of file m_pgsql.cpp.

References AddConn(), InspIRCd::AddResolver(), ClearOldConnections(), conf, DEBUG, ConfigReader::Enumerate(), HasHost(), SQLhost::host, SQLhost::id, SQLhost::ip, LogManager::Log(), InspIRCd::Logs, SQLhost::name, SQLhost::pass, SQLhost::port, ConfigReader::ReadFlag(), ConfigReader::ReadInteger(), ConfigReader::ReadValue(), Module::ServerInstance, SQLhost::ssl, and SQLhost::user.

Referenced by ModulePgSQL(), and OnRehash().

void ModulePgSQL::ReconnectConn SQLConn conn  )  [inline]
 

Definition at line 891 of file m_pgsql.cpp.

References TimerManager::AddTimer(), connections, retimer, Module::ServerInstance, and InspIRCd::Timers.


Member Data Documentation

ConnMap ModulePgSQL::connections [private]
 

Definition at line 713 of file m_pgsql.cpp.

Referenced by AddConn(), ClearAllConnections(), ClearOldConnections(), HasHost(), OnRequest(), OnUnloadModule(), and ReconnectConn().

unsigned long ModulePgSQL::currid [private]
 

Definition at line 714 of file m_pgsql.cpp.

Referenced by NewID().

ReconnectTimer* ModulePgSQL::retimer [private]
 

Definition at line 716 of file m_pgsql.cpp.

Referenced by ReconnectConn(), and ~ModulePgSQL().

char* ModulePgSQL::sqlsuccess [private]
 

Definition at line 715 of file m_pgsql.cpp.

Referenced by ModulePgSQL(), OnRequest(), and ~ModulePgSQL().


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