- return true;
- }
-
- return false;
-}
-
-CmdResult cmd_reload::Handle(const char** parameters, int pcnt, User *user)
-{
- user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0]);
- if (ServerInstance->Parser->ReloadCommand(parameters[0], user))
- {
- user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick, parameters[0]);
- ServerInstance->WriteOpers("*** RELOAD: %s reloaded the '%s' command.", user->nick, parameters[0]);
- return CMD_SUCCESS;
- }
- else
- {
- user->WriteServ("NOTICE %s :*** Could not reload command '%s' -- fix this problem, then /REHASH as soon as possible!", user->nick, parameters[0]);
- 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->Log(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->Log(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;
-}