]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd_io.cpp
Remove uneccessary socket includes now included in socket.h
[user/henk/code/inspircd.git] / src / inspircd_io.cpp
index 84af4bd1650751c129864288ebef236ec340467d..723e5a48a4cce88a51d31e2099724cb312b8b184 100644 (file)
@@ -52,8 +52,8 @@ ServerConfig::ServerConfig()
        *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
        *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
        log_file = NULL;
-       OperSpyWhois = nofork = HideBans = HideSplits = false;
-       AllowHalfop = true;
+       forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
+       writelog = AllowHalfop = true;
        dns_timeout = DieDelay = 5;
        MaxTargets = 20;
        NetBufferSize = 10240;
@@ -267,24 +267,6 @@ bool ValidateServerName(const char* tag, const char* value, void* data)
        return true;
 }
 
-bool ValidateNetworkName(const char* tag, const char* value, void* data)
-{
-       char* x = (char*)data;
-
-       log(DEFAULT,"<server:network> '%s'",x);
-
-       return true;
-}
-
-bool ValidateServerDesc(const char* tag, const char* value, void* data)
-{
-       char* x = (char*)data;
-
-       log(DEFAULT,"<server:description> '%s'",x);
-
-       return true;
-}
-
 bool ValidateNetBufferSize(const char* tag, const char* value, void* data)
 {
        if ((!Config->NetBufferSize) || (Config->NetBufferSize > 65535) || (Config->NetBufferSize < 1024))
@@ -543,8 +525,8 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"options",             "softlimit",                    &this->SoftLimit,               DT_INTEGER, ValidateSoftLimit},
                {"options",             "somaxconn",                    &this->MaxConn,                 DT_INTEGER, ValidateMaxConn},
                {"server",              "name",                         &this->ServerName,              DT_CHARPTR, ValidateServerName},
-               {"server",              "description",                  &this->ServerDesc,              DT_CHARPTR, ValidateServerDesc},
-               {"server",              "network",                      &this->Network,                 DT_CHARPTR, ValidateNetworkName},
+               {"server",              "description",                  &this->ServerDesc,              DT_CHARPTR, NoValidation},
+               {"server",              "network",                      &this->Network,                 DT_CHARPTR, NoValidation},
                {"admin",               "name",                         &this->AdminName,               DT_CHARPTR, NoValidation},
                {"admin",               "email",                        &this->AdminEmail,              DT_CHARPTR, NoValidation},
                {"admin",               "nick",                         &this->AdminNick,               DT_CHARPTR, NoValidation},
@@ -1200,7 +1182,9 @@ bool ServerConfig::ParseLine(ConfigDataHash &target, std::string &line, long lin
                                        {
                                                /* Leaving quotes, we have the value */
                                                results.push_back(KeyVal(current_key, current_value));
-                                               std::cout << "<" << tagname << ":" << current_key << "> " << current_value << std::endl;
+                                               
+                                               // std::cout << "<" << tagname << ":" << current_key << "> " << current_value << std::endl;
+                                               
                                                in_quote = false;
                                                got_key = false;
                                                
@@ -1292,9 +1276,13 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con
                        }
                }
        }
+       else if(pos == 0)
+       {
+               log(DEBUG, "No <%s> tags in config file.", tag.c_str());
+       }
        else
        {
-               log(DEBUG, "ConfValue got an out-of-range index %d", pos);
+               log(DEBUG, "ConfValue got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
        }
        
        return false;
@@ -1332,7 +1320,7 @@ bool ServerConfig::ConfValueBool(ConfigDataHash &target, const std::string &tag,
        
 int ServerConfig::ConfValueEnum(ConfigDataHash &target, const char* tag)
 {
-       return ConfValueEnum(target, std::string(tag));
+       return target.count(tag);
 }
 
 int ServerConfig::ConfValueEnum(ConfigDataHash &target, const std::string &tag)
@@ -1342,7 +1330,7 @@ int ServerConfig::ConfValueEnum(ConfigDataHash &target, const std::string &tag)
        
 int ServerConfig::ConfVarEnum(ConfigDataHash &target, const char* tag, int index)
 {
-       return 1;
+       return ConfVarEnum(target, std::string(tag), index);
 }
 
 int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, int index)
@@ -1358,9 +1346,13 @@ int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, in
                
                return iter->second.size();
        }
+       else if(pos == 0)
+       {
+               log(DEBUG, "No <%s> tags in config file.", tag.c_str());
+       }
        else
        {
-               log(DEBUG, "ConfVarEnum got an out-of-range index %d", pos);
+               log(DEBUG, "ConfVarEnum got an out-of-range index %d, there are only %d occurences of %s", pos, target.count(tag), tag.c_str());
        }
        
        return 0;
@@ -1373,10 +1365,10 @@ int ServerConfig::ConfVarEnum(ConfigDataHash &target, const std::string &tag, in
  * a maximum of one second before it times out, using the DNS
  * server specified in the configuration file.
  */ 
-bool BindSocket(int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr)
+bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr)
 {
        memset(&server,0,sizeof(server));
-       struct in_addr addy;
+       insp_inaddr addy;
        bool resolved = false;
        char resolved_addr[128];
 
@@ -1471,7 +1463,7 @@ bool HasPort(int port, char* addr)
 int BindPorts(bool bail)
 {
        char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF];
-       sockaddr_in client,server;
+       insp_sockaddr client, server;
        int clientportcount = 0;
        int BoundPortCount = 0;