- return true;
- }
-
- return false;
-}
-
-CmdResult cmd_reload::Handle(const std::vector<std::string>& parameters, User *user)
-{
- if (parameters.size() < 1)
- return CMD_FAILURE;
-
- user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick.c_str(), parameters[0].c_str());
- if (ServerInstance->Parser->ReloadCommand(parameters[0], user))
- {
- user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick.c_str(), parameters[0].c_str());
- ServerInstance->SNO->WriteToSnoMask('A', "RELOAD: %s reloaded the '%s' command.", user->nick.c_str(), parameters[0].c_str());
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Could not reload command '%s' -- fix this problem, then /REHASH as soon as possible!", user->nick.c_str(), parameters[0].c_str());
- return CMD_FAILURE;
- }
-}
-
-const char* CommandParser::LoadCommand(const char* name)
-{
- char filename[MAXBUF];
- void* h;
- Command* (*cmd_factory_func)(InspIRCd*);
-
- /* Command already exists? Succeed silently - this is needed for REHASH */
- if (RFCCommands.find(name) != RFCCommands.end())
- {
- ServerInstance->Logs->Log("COMMAND",DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name);
- return NULL;
- }
-
- snprintf(filename, MAXBUF, "%s/%s", LIBRARYDIR, name);
- h = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
-
- if (!h)
- {
- const char* n = dlerror();
- ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s", name, n);
- return n;
- }
-
- if (this->FindSym((void **)&cmd_factory_func, h, name))
- {
- Command* newcommand = cmd_factory_func(ServerInstance);
- this->CreateCommand(newcommand, h);
- }
- return NULL;
-}
-
-void CommandParser::SetupCommandTable(User* user)
-{
- 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);
- }