X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=6586166c8c21396094b1f89975675f8a283c7824;hb=bf0dd0513e016abb4025748fe12e57539078c70b;hp=558923332982cc0a5b30e44743f2922beb9e2e4c;hpb=8e34d66ef3bef802e5758ad73ff29e1b75aaba7f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index 558923332..6586166c8 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -101,6 +101,7 @@ void Module::OnUnloadModule(Module*) { } void Module::OnBackgroundTimer(time_t) { } ModResult Module::OnPreCommand(std::string&, std::vector&, LocalUser*, bool, const std::string&) { return MOD_RES_PASSTHRU; } void Module::OnPostCommand(const std::string&, const std::vector&, LocalUser*, CmdResult, const std::string&) { } +void Module::OnUserInit(LocalUser*) { } ModResult Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; } ModResult Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; } ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { return MOD_RES_PASSTHRU; } @@ -433,8 +434,7 @@ void ModuleManager::AddService(ServiceProvider& item) if (!ServerInstance->Parser->AddCommand(static_cast(&item))) throw ModuleException("Command "+std::string(item.name)+" already exists."); return; - case SERVICE_CMODE: - case SERVICE_UMODE: + case SERVICE_MODE: if (!ServerInstance->Modes->AddMode(static_cast(&item))) throw ModuleException("Mode "+std::string(item.name)+" already exists."); return; @@ -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(); }