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 * ---------------------------------------------------
15 #include "commands/cmd_rehash.h"
19 extern "C" DllExport Command* init_command(InspIRCd* Instance)
21 return new cmd_rehash(Instance);
24 CmdResult cmd_rehash::Handle (const char** parameters, int pcnt, User *user)
26 user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
27 std::string parameter;
28 std::string old_disabled = ServerInstance->Config->DisabledCommands;
31 parameter = parameters[0];
35 ServerInstance->WriteOpers("*** %s is rehashing config file %s",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
36 ServerInstance->CloseLog();
37 if (!ServerInstance->OpenLog(ServerInstance->Config->argv, ServerInstance->Config->argc))
38 user->WriteServ("*** NOTICE %s :ERROR: Could not open logfile %s: %s", user->nick, ServerInstance->Config->logpath.c_str(), strerror(errno));
39 ServerInstance->RehashUsersAndChans();
40 FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
41 ServerInstance->Config->Read(false,user);
42 ServerInstance->Res->Rehash();
43 ServerInstance->ResetMaxBans();
45 if (old_disabled != ServerInstance->Config->DisabledCommands)
46 InitializeDisabledCommands(ServerInstance->Config->DisabledCommands, ServerInstance);
48 FOREACH_MOD(I_OnRehash,OnRehash(user, parameter));
50 ServerInstance->BuildISupport();