X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigreader.cpp;h=a81a1b646f8ea81cc911eae6f2ad2835e21b911f;hb=63aa8d0d42f619c52d382bde3e6ba2e5e23b12ac;hp=54c32d8464f60811c121b52f0dd54e4f26314833;hpb=3a3ff949670c61a4a8856e1391222e156eb1cd17;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configreader.cpp b/src/configreader.cpp index 54c32d846..a81a1b646 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -29,10 +29,34 @@ #include "configparser.h" #include +ServerLimits::ServerLimits(ConfigTag* tag) + : NickMax(tag->getInt("maxnick", 32)) + , ChanMax(tag->getInt("maxchan", 64)) + , MaxModes(tag->getInt("maxmodes", 20)) + , IdentMax(tag->getInt("maxident", 11)) + , MaxQuit(tag->getInt("maxquit", 255)) + , MaxTopic(tag->getInt("maxtopic", 307)) + , MaxKick(tag->getInt("maxkick", 255)) + , MaxGecos(tag->getInt("maxgecos", 128)) + , MaxAway(tag->getInt("maxaway", 200)) + , MaxLine(tag->getInt("maxline", 512)) + , MaxHost(tag->getInt("maxhost", 64)) +{ +} + +static ConfigTag* CreateEmptyTag() +{ + std::vector* items; + return ConfigTag::create("empty", "", 0, items); +} + ServerConfig::ServerConfig() + : EmptyTag(CreateEmptyTag()) + , Limits(EmptyTag) + , NoSnoticeStack(false) { RawLog = HideBans = HideSplits = UndernetMsgPrefix = false; - WildcardIPv6 = InvBypassModes = true; + WildcardIPv6 = true; dns_timeout = 5; MaxTargets = 20; NetBufferSize = 10240; @@ -41,9 +65,6 @@ ServerConfig::ServerConfig() OperMaxChans = 30; c_ipv4_range = 32; c_ipv6_range = 128; - - std::vector* items; - EmptyTag = ConfigTag::create("empty", "", 0, items); } ServerConfig::~ServerConfig() @@ -401,22 +422,11 @@ void ServerConfig::Fill() OperMaxChans = ConfValue("channels")->getInt("opers"); c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32); c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128); - Limits.NickMax = ConfValue("limits")->getInt("maxnick", 32); - Limits.ChanMax = ConfValue("limits")->getInt("maxchan", 64); - Limits.MaxModes = ConfValue("limits")->getInt("maxmodes", 20); - Limits.IdentMax = ConfValue("limits")->getInt("maxident", 11); - Limits.MaxHost = ConfValue("limits")->getInt("maxhost", 64); - Limits.MaxQuit = ConfValue("limits")->getInt("maxquit", 255); - Limits.MaxTopic = ConfValue("limits")->getInt("maxtopic", 307); - Limits.MaxKick = ConfValue("limits")->getInt("maxkick", 255); - Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos", 128); - Limits.MaxAway = ConfValue("limits")->getInt("maxaway", 200); - Limits.MaxLine = ConfValue("limits")->getInt("maxline", 512); + Limits = ServerLimits(ConfValue("limits")); Paths.Config = ConfValue("path")->getString("configdir", INSPIRCD_CONFIG_PATH); Paths.Data = ConfValue("path")->getString("datadir", INSPIRCD_DATA_PATH); Paths.Log = ConfValue("path")->getString("logdir", INSPIRCD_LOG_PATH); Paths.Module = ConfValue("path")->getString("moduledir", INSPIRCD_MODULE_PATH); - InvBypassModes = options->getBool("invitebypassmodes", true); NoSnoticeStack = options->getBool("nosnoticestack", false); if (Network.find(' ') != std::string::npos) @@ -565,7 +575,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) errstr << "Possible configuration error: you have not defined any blocks." << std::endl << "You will need to do this if you want clients to be able to connect!" << std::endl; - if (old) + if (old && valid) { // On first run, ports are bound later on FailedPortList pl; @@ -660,6 +670,7 @@ void ServerConfig::ApplyModules(User* user) std::string name; if (tag->readString("name", name)) { + name = ModuleManager::ExpandModName(name); // if this module is already loaded, the erase will succeed, so we need do nothing // otherwise, we need to add the module (which will be done later) if (removed_modules.erase(name) == 0) @@ -774,6 +785,7 @@ void ConfigReaderThread::Finish() * XXX: The order of these is IMPORTANT, do not reorder them without testing * thoroughly!!! */ + ServerInstance->Users.RehashCloneCounts(); ServerInstance->XLines->CheckELines(); ServerInstance->XLines->ApplyLines(); ChanModeReference ban(NULL, "ban");