* ---------------------------------------------------
*/
+#include "inspircd.h"
#include <cstdlib>
#include <sstream>
-#include <string>
-#include <deque>
-#include <map>
#include <libpq-fe.h>
-
#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "inspircd.h"
#include "configreader.h"
-
#include "m_sqlv2.h"
/* $ModDesc: PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API */
{
SQLhost host;
int ipvalid;
- insp_inaddr blargle;
host.id = conf.ReadValue("database", "id", i);
host.host = conf.ReadValue("database", "hostname", i);
if (HasHost(host))
continue;
- ipvalid = insp_aton(host.host.c_str(), &blargle);
+#ifdef IPV6
+ if (strchr(host.host.c_str(),':'))
+ {
+ in6_addr blargle;
+ ipvalid = inet_pton(AF_INET6, host.host.c_str(), &blargle);
+ }
+ else
+#endif
+ {
+ in_addr blargle;
+ ipvalid = inet_aton(host.host.c_str(), &blargle);
+ }
if(ipvalid > 0)
{
((ModulePgSQL*)us)->ReconnectConn(this);
}
+MODULE_INIT(ModulePgSQL);
-class ModulePgSQLFactory : public ModuleFactory
-{
- public:
- ModulePgSQLFactory()
- {
- }
-
- ~ModulePgSQLFactory()
- {
- }
-
- virtual Module * CreateModule(InspIRCd* Me)
- {
- return new ModulePgSQL(Me);
- }
-};
-
-
-extern "C" void * init_module( void )
-{
- return new ModulePgSQLFactory;
-}