X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=52a25d37cc8e0a43001776e402675eaf450364a1;hb=04cfaea87edd1b4b742cb607ea69ece760c460aa;hp=558923332982cc0a5b30e44743f2922beb9e2e4c;hpb=8e34d66ef3bef802e5758ad73ff29e1b75aaba7f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index 558923332..52a25d37c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -686,13 +686,27 @@ void FileReader::CalcSize() void FileReader::LoadFile(const std::string &filename) { - file_cache c; - c.clear(); - if (ServerInstance->Config->ReadFile(c,filename.c_str())) + std::map::iterator file = ServerInstance->Config->Files.find(filename); + if (file != ServerInstance->Config->Files.end()) { - this->fc = c; - this->CalcSize(); + this->fc = file->second; } + else + { + fc.clear(); + FILE* f = fopen(filename.c_str(), "r"); + if (!f) + return; + char linebuf[MAXBUF*10]; + while (fgets(linebuf, sizeof(linebuf), f)) + { + int len = strlen(linebuf); + if (len) + fc.push_back(std::string(linebuf, len - 1)); + } + fclose(f); + } + CalcSize(); }