X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_pgsql.cpp;h=5d267fc1acce29f481a414efc7aa3c12ecaa3201;hb=d556a4f8740b65e635ff7d2b976faaedbdac51d4;hp=76259a35b4ba9a7ba47f277a66a113dffcd24669;hpb=49ce55f7a38fc9b6beb972442c828429456797a0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 76259a35b..5d267fc1a 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -11,19 +11,14 @@ * --------------------------------------------------- */ +#include "inspircd.h" #include #include -#include -#include -#include #include - #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 */ @@ -803,7 +798,6 @@ class ModulePgSQL : public Module { SQLhost host; int ipvalid; - insp_inaddr blargle; host.id = conf.ReadValue("database", "id", i); host.host = conf.ReadValue("database", "hostname", i); @@ -816,7 +810,18 @@ class ModulePgSQL : public Module 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) { @@ -975,26 +980,5 @@ void SQLConn::DelayReconnect() ((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; -}