]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Cut down on debug on restart
[user/henk/code/inspircd.git] / src / configreader.cpp
index 8e2aa497fb2f7c6b640ec25de9a24901ffa54caf..dde2d04db0793bbe64b974208a449d1c8224318d 100644 (file)
@@ -416,45 +416,13 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
 
        if (*allow)
        {
-               c.host = allow;
-               c.type = CC_ALLOW;
-               c.pass = password;
-               c.registration_timeout = timeout;
-               c.pingtime = pingfreq;
-               c.flood = flood;
-               c.threshold = threshold;
-               c.sendqmax = sendq;
-               c.recvqmax = recvq;
-               c.maxlocal = localmax;
-               c.maxglobal = globalmax;
-
-
-               if (c.maxlocal == 0)
-                       c.maxlocal = 3;
-               if (c.maxglobal == 0)
-                       c.maxglobal = 3;
-               if (c.threshold == 0)
-               {
-                       c.threshold = 1;
-                       c.flood = 999;
-                       conf->GetInstance()->Log(DEFAULT,"Warning: Connect allow line '%s' has no flood/threshold settings. Setting this tag to 999 lines in 1 second.",c.host.c_str());
-               }
-               if (c.sendqmax == 0)
-                       c.sendqmax = 262114;
-               if (c.recvqmax == 0)
-                       c.recvqmax = 4096;
-               if (c.registration_timeout == 0)
-                       c.registration_timeout = 90;
-               if (c.pingtime == 0)
-                       c.pingtime = 120;
+               ConnectClass c(timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax);
                conf->Classes.push_back(c);
        }
        else
        {
-               c.host = deny;
-               c.type = CC_DENY;
+               ConnectClass c(deny);
                conf->Classes.push_back(c);
-               conf->GetInstance()->Log(DEBUG,"Read connect class type DENY, host=%s",deny);
        }
 
        return true;
@@ -659,6 +627,7 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"options",             "nouserdns",                    new ValueContainerBool (&this->NoUserDns),              DT_BOOLEAN, NoValidation},
                {"options",             "syntaxhints",                  new ValueContainerBool (&this->SyntaxHints),            DT_BOOLEAN, NoValidation},
                {"options",             "cyclehosts",                   new ValueContainerBool (&this->CycleHosts),             DT_BOOLEAN, NoValidation},
+               {"options",             "ircumsgprefix",                new ValueContainerBool (&this->UndernetMsgPrefix),      DT_BOOLEAN, NoValidation},
                {"pid",                 "file",                         new ValueContainerChar (this->PID),                     DT_CHARPTR, NoValidation},
                {"whowas",              "groupsize",                    new ValueContainerInt  (&this->WhoWasGroupSize),        DT_INTEGER, NoValidation},
                {"whowas",              "maxgroups",                    new ValueContainerInt  (&this->WhoWasMaxGroups),        DT_INTEGER, NoValidation},
@@ -823,15 +792,19 @@ void ServerConfig::Read(bool bail, userrec* user)
                                                case DT_CHARPTR:
                                                {
                                                        char item[MAXBUF];
-                                                       ConfValue(this->config_data, MultiValues[Index].tag, MultiValues[Index].items[valuenum], tagnum, item, MAXBUF, allow_newlines);
-                                                       vl.push_back(ValueItem(item));
+                                                       if (ConfValue(this->config_data, MultiValues[Index].tag, MultiValues[Index].items[valuenum], tagnum, item, MAXBUF, allow_newlines))
+                                                               vl.push_back(ValueItem(item));
+                                                       else
+                                                               vl.push_back(ValueItem(""));
                                                }
                                                break;
                                                case DT_INTEGER:
                                                {
-                                                       int item;
-                                                       ConfValueInteger(this->config_data, MultiValues[Index].tag, MultiValues[Index].items[valuenum], tagnum, item);
-                                                       vl.push_back(ValueItem(item));
+                                                       int item = 0;
+                                                       if (ConfValueInteger(this->config_data, MultiValues[Index].tag, MultiValues[Index].items[valuenum], tagnum, item))
+                                                               vl.push_back(ValueItem(item));
+                                                       else
+                                                               vl.push_back(ValueItem(0));
                                                }
                                                break;
                                                case DT_BOOLEAN:
@@ -1299,18 +1272,21 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con
        ConfigDataHash::size_type pos = index;
        if((pos >= 0) && (pos < target.count(tag)))
        {
-               ConfigDataHash::const_iterator iter = target.find(tag);
+               ConfigDataHash::iterator iter = target.find(tag);
 
                for(int i = 0; i < index; i++)
                        iter++;
 
-               for(KeyValList::const_iterator j = iter->second.begin(); j != iter->second.end(); j++)
+               for(KeyValList::iterator j = iter->second.begin(); j != iter->second.end(); j++)
                {
                        if(j->first == var)
                        {
                                if ((!allow_linefeeds) && (j->second.find('\n') != std::string::npos))
                                {
-                                       throw CoreException("Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted");
+                                       ServerInstance->Log(DEFAULT, "Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces.");
+                                       for (std::string::iterator n = j->second.begin(); n != j->second.end(); n++)
+                                               if (*n == '\n')
+                                                       *n = ' ';
                                }
                                else
                                {
@@ -1607,6 +1583,8 @@ void ValueItem::Set(int value)
 
 int ValueItem::GetInteger()
 {
+       if (v.empty())
+               return 0;
        return atoi(v.c_str());
 }