]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/main.cpp
Fix building on Windows.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / main.cpp
index 1a77237bd6d437686d6c0807774eb132306537bb..21251983cd27b7b9a1f0ae50c65525f8759542c5 100644 (file)
 #include "translate.h"
 
 ModuleSpanningTree::ModuleSpanningTree()
-       : rconnect(this), rsquit(this), map(this)
+       : Stats::EventListener(this)
+       , rconnect(this)
+       , rsquit(this)
+       , map(this)
        , commands(this)
        , currmembid(0)
        , eventprov(this, "event/server")
@@ -200,7 +203,15 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
                return;
        }
 
-       if (strchr(x->IPAddr.c_str(),':'))
+#ifndef _WIN32
+       if (x->IPAddr.find('/') != std::string::npos)
+       {
+               struct stat sb;
+               if (stat(x->IPAddr.c_str(), &sb) == -1 || !S_ISSOCK(sb.st_mode))
+                       ipvalid = false;
+       }
+#endif
+       if (x->IPAddr.find(':') != std::string::npos)
        {
                in6_addr n;
                if (inet_pton(AF_INET6, x->IPAddr.c_str(), &n) < 1)
@@ -240,7 +251,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
                irc::sockets::sockaddrs bind;
                if ((!x->Bind.empty()) && (irc::sockets::aptosa(x->Bind, 0, bind)))
                {
-                       if (bind.sa.sa_family == AF_INET)
+                       if (bind.family() == AF_INET)
                                start_type = DNS::QUERY_A;
                }