X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_rehash.cpp;h=868a4aea22874c290424c96ab677238084b90b1b;hb=a36fa98300016380378100260a58b2f297a08f72;hp=d0e1882a7c55423f6c024cfb23866cf52dc2b8f2;hpb=bfff1d9d93dccb9f0080b84d3933d47f2a6a1f6c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index d0e1882a7..868a4aea2 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) return new CommandRehash(Instance); } -CmdResult CommandRehash::Handle (const char** parameters, int pcnt, User *user) +CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *user) { user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); std::string parameter; @@ -36,22 +36,24 @@ CmdResult CommandRehash::Handle (const char** parameters, int pcnt, User *user) ServerInstance->SNO->WriteToSnoMask('A', "%s is rehashing config file %s",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); ServerInstance->Logs->CloseLogs(); if (!ServerInstance->OpenLog(ServerInstance->Config->argv, ServerInstance->Config->argc)) - user->WriteServ("*** NOTICE %s :ERROR: Could not open logfile %s: %s", user->nick, ServerInstance->Config->logpath.c_str(), strerror(errno)); + user->WriteServ("NOTICE %s :*** ERROR: Could not open logfile %s: %s", user->nick, ServerInstance->Config->logpath.c_str(), strerror(errno)); ServerInstance->RehashUsersAndChans(); FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); - /*ServerInstance->Config->Read(false,user);*/ - // Get XLine to do it's thing. - ServerInstance->XLines->CheckELines(); - ServerInstance->XLines->ApplyLines(); - ServerInstance->Res->Rehash(); - ServerInstance->ResetMaxBans(); + if (!ServerInstance->ConfigThread) + { + ServerInstance->Config->RehashUser = user; + ServerInstance->Config->RehashParameter = parameter; + + ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, user); + ServerInstance->Threads->Create(ServerInstance->ConfigThread); + } + else + { + /* A rehash is already in progress! ahh shit. */ + user->WriteServ("*** NOTICE %s :*** Could not rehash: A rehash is already in progress.", user->nick); + return CMD_FAILURE; + } } - if (old_disabled != ServerInstance->Config->DisabledCommands) - InitializeDisabledCommands(ServerInstance->Config->DisabledCommands, ServerInstance); - - FOREACH_MOD(I_OnRehash,OnRehash(user, parameter)); - - ServerInstance->BuildISupport(); return CMD_SUCCESS; }