1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 class CommandReloadmodule : public Command
19 /** Constructor for reloadmodule.
21 CommandReloadmodule ( Module* parent) : Command( parent, "RELOADMODULE",1) { flags_needed = 'o'; syntax = "<modulename>"; }
23 * @param parameters The parameters to the comamnd
24 * @param pcnt The number of parameters passed to teh command
25 * @param user The user issuing the command
26 * @return A value from CmdResult to indicate command success or failure.
28 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
31 CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
33 if (parameters[0] == "cmd_reloadmodule.so")
35 user->WriteNumeric(975, "%s %s :You cannot reload cmd_reloadmodule.so (unload and load it)",
36 user->nick.c_str(), parameters[0].c_str());
40 if (ServerInstance->Modules->Unload(parameters[0].c_str()))
42 ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s unloaded %s",user->nick.c_str(), parameters[0].c_str());
43 if (ServerInstance->Modules->Load(parameters[0].c_str()))
45 ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s reloaded %s",user->nick.c_str(), parameters[0].c_str());
46 user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick.c_str(), parameters[0].c_str());
51 ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick.c_str(), parameters[0].c_str());
52 user->WriteNumeric(975, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
56 COMMAND_INIT(CommandReloadmodule)