1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 #include "commands/cmd_rehash.h"
20 extern "C" DllExport Command* init_command(InspIRCd* Instance)
22 return new CommandRehash(Instance);
25 CmdResult CommandRehash::Handle (const char** parameters, int pcnt, User *user)
27 user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
28 std::string parameter;
29 std::string old_disabled = ServerInstance->Config->DisabledCommands;
32 parameter = parameters[0];
36 ServerInstance->WriteOpers("*** %s is rehashing config file %s",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
37 ServerInstance->CloseLog();
38 if (!ServerInstance->OpenLog(ServerInstance->Config->argv, ServerInstance->Config->argc))
39 user->WriteServ("*** NOTICE %s :ERROR: Could not open logfile %s: %s", user->nick, ServerInstance->Config->logpath.c_str(), strerror(errno));
40 ServerInstance->RehashUsersAndChans();
41 FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
42 /*ServerInstance->Config->Read(false,user);*/
43 // Get XLine to do it's thing.
44 ServerInstance->XLines->CheckELines();
45 ServerInstance->XLines->ApplyLines();
46 ServerInstance->Res->Rehash();
47 ServerInstance->ResetMaxBans();
49 if (old_disabled != ServerInstance->Config->DisabledCommands)
50 InitializeDisabledCommands(ServerInstance->Config->DisabledCommands, ServerInstance);
52 FOREACH_MOD(I_OnRehash,OnRehash(user, parameter));
54 ServerInstance->BuildISupport();