1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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 /** Handle /MODULES. These command handlers can be reloaded by the core,
17 * and handle basic RFC1459 commands. Commands within modules work
18 * the same way, however, they can be fully unloaded, where these
21 class CommandModules : public Command
24 /** Constructor for modules.
26 CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[server]"; }
28 * @param parameters The parameters to the comamnd
29 * @param pcnt The number of parameters passed to teh command
30 * @param user The user issuing the command
31 * @return A value from CmdResult to indicate command success or failure.
33 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
34 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
36 if (parameters.size() >= 1)
37 return ROUTE_UNICAST(parameters[0]);
38 return ROUTE_LOCALONLY;
44 CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
46 std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
48 for (unsigned int i = 0; i < module_names.size(); i++)
50 Module* m = ServerInstance->Modules->Find(module_names[i]);
51 Version V = m->GetVersion();
53 if (user->HasPrivPermission("servers/auspex"))
55 std::string flags("SvcC");
57 for (int mult = 1; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
58 if (!(V.Flags & mult))
61 user->SendText(":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName.c_str(),
62 user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str());
66 user->SendText(":%s 702 %s :%s %s", ServerInstance->Config->ServerName.c_str(),
67 user->nick.c_str(), module_names[i].c_str(), V.description.c_str());
70 user->SendText(":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName.c_str(), user->nick.c_str());
75 COMMAND_INIT(CommandModules)