X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigparser.cpp;h=b965bc0155c801079303ffe4f9647ac76f50b7f0;hb=7a2462b891ba055cbedbf4d94ea3d5af50afa97c;hp=abdf6f3de07e2f0cb58c3f989e750bd6704445e6;hpb=7530285740c2db1bc4457859b0d5f2436e0ed113;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configparser.cpp b/src/configparser.cpp index abdf6f3de..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"); }