- ServerInstance->WriteOpers("*** %s is rehashing config file %s",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
- ServerInstance->CloseLog();
- 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));
+ // parameterized rehash
+
+ // the leading "-" is optional; remove it if present.
+ if (param[0] == '-')
+ param = param.substr(1);
+
+ FOREACH_MOD(I_OnModuleRehash,OnModuleRehash(user, param));
+ return CMD_SUCCESS;
+ }
+
+ // Rehash for me. Try to start the rehash thread
+ if (!ServerInstance->ConfigThread)
+ {
+ std::string m = user->nick + " is rehashing config file " + ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()) + " on " + ServerInstance->Config->ServerName;
+ ServerInstance->SNO->WriteGlobalSno('a', m);
+
+ if (IS_LOCAL(user))
+ user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing",
+ user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()));
+ else
+ ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") +
+ ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()));
+
+ /* Don't do anything with the logs here -- logs are restarted
+ * after the config thread has completed.
+ */