X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigparser.cpp;h=b965bc0155c801079303ffe4f9647ac76f50b7f0;hb=9ad873886e518bf3621a88e8c48607ab79020c0a;hp=e4bf4bd7197e60c4bcc19cab514a5097644570ab;hpb=cb7e83aa4ed48df3e1bb259b26737feaf5a0d676;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configparser.cpp b/src/configparser.cpp index e4bf4bd71..b965bc015 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -394,9 +394,30 @@ void ParseStack::DoInclude(ConfigTag* tag, int flags) flags |= FLAG_NO_INC; if (tag->getBool("noexec", false)) flags |= FLAG_NO_EXEC; + if (!ParseFile(ServerInstance->Config->Paths.PrependConfig(name), flags, mandatorytag)) throw CoreException("Included"); } + else if (tag->readString("directory", name)) + { + if (tag->getBool("noinclude", false)) + flags |= FLAG_NO_INC; + if (tag->getBool("noexec", false)) + flags |= FLAG_NO_EXEC; + + const std::string includedir = ServerInstance->Config->Paths.PrependConfig(name); + std::vector files; + if (!FileSystem::GetFileList(includedir, files, "*.conf")) + throw CoreException("Unable to read directory for include: " + includedir); + + std::sort(files.begin(), files.end()); + for (std::vector::const_iterator iter = files.begin(); iter != files.end(); ++iter) + { + const std::string path = includedir + '/' + *iter; + if (!ParseFile(path, flags, mandatorytag)) + throw CoreException("Included"); + } + } else if (tag->readString("executable", name)) { if (flags & FLAG_NO_EXEC) @@ -405,6 +426,7 @@ void ParseStack::DoInclude(ConfigTag* tag, int flags) flags |= FLAG_NO_INC; if (tag->getBool("noexec", true)) flags |= FLAG_NO_EXEC; + if (!ParseFile(name, flags, mandatorytag, true)) throw CoreException("Included"); } @@ -609,14 +631,14 @@ unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def, if (!readString(key, duration)) return def; - if (!InspIRCd::IsValidDuration(duration)) + unsigned long ret; + if (!InspIRCd::Duration(duration, ret)) { ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " is not a duration; value set to " + ConvToStr(def) + "."); return def; } - unsigned long ret = InspIRCd::Duration(duration); CheckRange(tag, key, ret, def, min, max); return ret; }