]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_pgsql.cpp
We were already sending FMODE +nt after each channel creation to keep services happy...
[user/henk/code/inspircd.git] / src / modules / extra / m_pgsql.cpp
index 76259a35b4ba9a7ba47f277a66a113dffcd24669..9ec369859b4c8769d03d267169f31bf1cb8c7136 100644 (file)
  * ---------------------------------------------------
  */
 
+#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 */
@@ -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,21 @@ 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
+                       {
+                               in_addr blargle;
+                               ipvalid = inet_aton(host.host.c_str(), &blargle);
+                       }
+#else
+                       in_addr blargle;
+                       ipvalid = inet_aton(host.host.c_str(), &blargle);
+#endif
 
                        if(ipvalid > 0)
                        {