X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigreader.cpp;h=957adc829f69bcbb2ebf1f0614c61dd299a8fd53;hb=e950f568d0f571e9475aa38177486468714de4d3;hp=27b9e5c77b5e1e3dcedec3e6ffbba9260a6ffc04;hpb=3d019b14ec0025ff38bbd40c868ddccd0b13d8a3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configreader.cpp b/src/configreader.cpp index 27b9e5c77..957adc829 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -123,11 +123,11 @@ void ServerConfig::CrossCheckOperClassType() std::string name = tag->getString("name"); if (name.empty()) throw CoreException(" is missing from tag at " + tag->getTagLocation()); - if (oper_blocks.find(" " + name) != oper_blocks.end()) + if (OperTypes.find(name) != OperTypes.end()) throw CoreException("Duplicate type block with name " + name + " at " + tag->getTagLocation()); OperInfo* ifo = new OperInfo; - oper_blocks[" " + name] = ifo; + OperTypes[name] = ifo; ifo->name = name; ifo->type_block = tag; @@ -152,8 +152,8 @@ void ServerConfig::CrossCheckOperClassType() throw CoreException(" missing from tag at " + tag->getTagLocation()); std::string type = tag->getString("type"); - OperIndex::iterator tblk = oper_blocks.find(" " + type); - if (tblk == oper_blocks.end()) + OperIndex::iterator tblk = OperTypes.find(type); + if (tblk == OperTypes.end()) throw CoreException("Oper block " + name + " has missing type " + type); if (oper_blocks.find(name) != oper_blocks.end()) throw CoreException("Duplicate oper block with name " + name + " at " + tag->getTagLocation()); @@ -383,7 +383,6 @@ void ServerConfig::Fill() AdminName = ConfValue("admin")->getString("name", ""); AdminEmail = ConfValue("admin")->getString("email", "null@example.com"); AdminNick = ConfValue("admin")->getString("nick", "admin"); - ModPath = ConfValue("path")->getString("moduledir", MOD_PATH); NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534); dns_timeout = ConfValue("dns")->getInt("timeout", 5); DisabledCommands = ConfValue("disabled")->getString("commands", ""); @@ -417,6 +416,10 @@ void ServerConfig::Fill() Limits.MaxGecos = ConfValue("limits")->getInt("maxgecos", 128); Limits.MaxAway = ConfValue("limits")->getInt("maxaway", 200); Limits.MaxLine = ConfValue("limits")->getInt("maxline", 512); + Paths.Config = ConfValue("path")->getString("configdir", CONFIG_PATH); + Paths.Data = ConfValue("path")->getString("datadir", DATA_PATH); + Paths.Log = ConfValue("path")->getString("logdir", LOG_PATH); + Paths.Module = ConfValue("path")->getString("moduledir", MOD_PATH); InvBypassModes = options->getBool("invitebypassmodes", true); NoSnoticeStack = options->getBool("nosnoticestack", false); @@ -791,6 +794,15 @@ std::string ServerConfig::Escape(const std::string& str, bool xml) return escaped; } +std::string ServerConfig::ExpandPath(const std::string& base, const std::string& fragment) +{ + // The fragment is an absolute path, don't modify it. + if (fragment[0] == '/' || ServerConfig::StartsWithWindowsDriveLetter(fragment)) + return fragment; + + return base + '/' + fragment; +} + const char* ServerConfig::CleanFilename(const char* name) { const char* p = name + strlen(name);