mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
This was never supposed to be invoked on /rehash, only startup.. so move it to startup only. Also remove (redundant) user arg.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10792 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
7901c49c54
commit
0d2b6637ca
@ -192,11 +192,8 @@ class CoreExport CommandParser : public classbase
|
||||
bool CreateCommand(Command *f, void* so_handle = NULL);
|
||||
|
||||
/** Insert the default RFC1459 commands into the command hash.
|
||||
* Ignore any already loaded commands.
|
||||
* @param user User to spool errors to, or if NULL, when an error occurs spool the errors to
|
||||
* stdout then exit with EXIT_STATUS_HANDLER.
|
||||
*/
|
||||
void SetupCommandTable(User* user);
|
||||
void SetupCommandTable();
|
||||
|
||||
/** Translate nicknames in a string into UIDs, based on the TranslationType given.
|
||||
* @param to The translation type to use for the process.
|
||||
|
@ -591,21 +591,12 @@ const char* CommandParser::LoadCommand(const char* name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CommandParser::SetupCommandTable(User* user)
|
||||
/** This is only invoked on startup
|
||||
*/
|
||||
void CommandParser::SetupCommandTable()
|
||||
{
|
||||
for (SharedObjectList::iterator command = RFCCommands.begin(); command != RFCCommands.end(); command++)
|
||||
{
|
||||
Command *cmdptr = cmdlist.find(command->first)->second;
|
||||
cmdlist.erase(cmdlist.find(command->first));
|
||||
RFCCommands.erase(command);
|
||||
delete cmdptr;
|
||||
}
|
||||
|
||||
if (!user)
|
||||
{
|
||||
printf("\nLoading core commands");
|
||||
fflush(stdout);
|
||||
}
|
||||
printf("\nLoading core commands");
|
||||
fflush(stdout);
|
||||
|
||||
DIR* library = opendir(LIBRARYDIR);
|
||||
if (library)
|
||||
@ -615,29 +606,19 @@ void CommandParser::SetupCommandTable(User* user)
|
||||
{
|
||||
if (InspIRCd::Match(entry->d_name, "cmd_*.so"))
|
||||
{
|
||||
if (!user)
|
||||
{
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
}
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
|
||||
const char* err = this->LoadCommand(entry->d_name);
|
||||
if (err)
|
||||
{
|
||||
if (user)
|
||||
{
|
||||
user->WriteServ("NOTICE %s :*** Failed to load core command %s: %s", user->nick.c_str(), entry->d_name, err);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error loading %s: %s", entry->d_name, err);
|
||||
exit(EXIT_STATUS_BADHANDLER);
|
||||
}
|
||||
printf("Error loading %s: %s", entry->d_name, err);
|
||||
exit(EXIT_STATUS_BADHANDLER);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(library);
|
||||
if (!user)
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (cmdlist.find("RELOAD") == cmdlist.end())
|
||||
|
@ -1330,17 +1330,7 @@ void ServerConfig::Read(bool bail, const std::string &useruid)
|
||||
|
||||
}
|
||||
|
||||
if (bail)
|
||||
{
|
||||
/** Note: This is safe, the method checks for user == NULL */
|
||||
ServerInstance->Threads->Lock();
|
||||
User* user = NULL;
|
||||
if (!useruid.empty())
|
||||
user = ServerInstance->FindNick(useruid);
|
||||
ServerInstance->Parser->SetupCommandTable(user);
|
||||
ServerInstance->Threads->Unlock();
|
||||
}
|
||||
else
|
||||
if (!bail)
|
||||
{
|
||||
if (!useruid.empty())
|
||||
{
|
||||
|
@ -632,6 +632,9 @@ InspIRCd::InspIRCd(int argc, char** argv)
|
||||
delete ConfigThread;
|
||||
this->ConfigThread = NULL;
|
||||
|
||||
/** Note: This is safe, the method checks for user == NULL */
|
||||
this->Parser->SetupCommandTable();
|
||||
|
||||
this->Res = new DNS(this);
|
||||
|
||||
this->AddServerName(Config->ServerName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user