+ // Rehash for me.
+ FOREACH_MOD(I_OnRehash,OnRehash(user, ""));
+
+ // XXX write this to a remote user correctly
+ user->WriteNumeric(382, "%s %s :Rehashing",user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
+
+ std::string m = user->nick + " is rehashing config file " + ServerConfig::CleanFilename(ServerInstance->ConfigFileName) + " on " + ServerInstance->Config->ServerName;
+ ServerInstance->SNO->WriteToSnoMask('A', m);
+ ServerInstance->Logs->CloseLogs();
+
+ if (!ServerInstance->OpenLog(ServerInstance->Config->argv, ServerInstance->Config->argc))
+ {
+ m = std::string("ERROR: Could not open logfile ") + ServerInstance->Config->logpath + ":" + strerror(errno);
+ ServerInstance->SNO->WriteToSnoMask('A', m);
+ }
+
+ ServerInstance->RehashUsersAndChans();
+ FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect());
+
+ if (!ServerInstance->ConfigThread)
+ {
+ ServerInstance->Config->RehashUser = user;
+ ServerInstance->Config->RehashParameter = parameters.size() ? parameters[0] : "";
+
+ ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, user);
+ ServerInstance->Threads->Create(ServerInstance->ConfigThread);
+ }
+ else
+ {
+ /* A rehash is already in progress! ahh shit. */
+ if (IS_LOCAL(user))
+ user->WriteServ("NOTICE %s :*** Could not rehash: A rehash is already in progress.", user->nick.c_str());