X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodmanager_static.cpp;h=cea40c7a32364e75a807866f7979e6730c88a40c;hb=4c751dbbe8945e5efc230a59b0ed51c2ba10cf92;hp=bb8fda400bd33b8672a2bb8e26a67bd315b16a51;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index bb8fda400..cea40c7a3 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" #include "exitcodes.h" +#include #ifdef PURE_STATIC @@ -92,6 +93,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) mod = (*it->second->init)(); mod->ModuleSourceFile = name; mod->ModuleDLLManager = NULL; + mod->dying = false; Modules[name] = mod; if (defer) { @@ -156,7 +158,8 @@ namespace { ServerInstance->Modules->DoSafeUnload(mod); ServerInstance->GlobalCulls.Apply(); bool rv = ServerInstance->Modules->Load(name.c_str()); - callback->Call(rv); + if (callback) + callback->Call(rv); ServerInstance->GlobalCulls.AddItem(this); } }; @@ -174,7 +177,7 @@ void ModuleManager::Reload(Module* mod, HandlerBase1* callback) { if (CanUnload(mod)) ServerInstance->AtomicActions.AddAction(new ReloadAction(mod, callback)); - else + else if (callback) callback->Call(false); } @@ -182,18 +185,19 @@ void ModuleManager::LoadAll() { Load("cmd_all", true); Load("cmd_whowas.so", true); + Load("cmd_lusers.so", true); ConfigTagList tags = ServerInstance->Config->ConfTags("module"); for(ConfigIter i = tags.first; i != tags.second; ++i) { ConfigTag* tag = i->second; std::string name = tag->getString("name"); - printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",name.c_str()); + std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl; if (!this->Load(name, true)) { ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); - printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); + std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } } @@ -209,7 +213,7 @@ void ModuleManager::LoadAll() { LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); - printf_c("\n[\033[1;31m*\033[0m] %s\n\n", LastModuleError.c_str()); + std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } }