]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_info/cmd_modules.cpp
Merge pull request #1165 from Adam-/master+dnssource
[user/henk/code/inspircd.git] / src / coremods / core_info / cmd_modules.cpp
index 01774390d0ce98bcd41e316302459dd66e410bab..5f02d071f402a4389afd66b69119167321da8de5 100644 (file)
 
 
 #include "inspircd.h"
+#include "core_info.h"
 
-/** Handle /MODULES.
- */
-class CommandModules : public Command
+CommandModules::CommandModules(Module* parent)
+       : ServerTargetCommand(parent, "MODULES")
 {
- public:
-       /** Constructor for modules.
-        */
-       CommandModules(Module* parent) : Command(parent,"MODULES",0,0)
-       {
-               Penalty = 4;
-               syntax = "[<servername>]";
-       }
-
-       /** Handle command.
-        * @param parameters The parameters to the command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
-       {
-               if (parameters.size() >= 1)
-                       return ROUTE_UNICAST(parameters[0]);
-               return ROUTE_LOCALONLY;
-       }
-};
+       Penalty = 4;
+       syntax = "[<servername>]";
+}
 
 /** Handle /MODULES
  */
@@ -77,30 +58,25 @@ CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, Us
 
                if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
                {
-                       std::string flags("SvcC");
+                       std::string flags("vcC");
                        int pos = 0;
-                       for (int mult = 1; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
+                       for (int mult = 2; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
                                if (!(V.Flags & mult))
                                        flags[pos] = '-';
 
 #ifdef PURE_STATIC
-                       user->SendText(":%s 702 %s :%p %s %s :%s", ServerInstance->Config->ServerName.c_str(),
-                               user->nick.c_str(), (void*)m, m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str());
+                       user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s :%s", m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str()));
 #else
                        std::string srcrev = m->ModuleDLLManager->GetVersion();
-                       user->SendText(":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName.c_str(),
-                               user->nick.c_str(), (void*)m, m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str());
+                       user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s :%s - %s", m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str()));
 #endif
                }
                else
                {
-                       user->SendText(":%s 702 %s :%s %s", ServerInstance->Config->ServerName.c_str(),
-                               user->nick.c_str(), m->ModuleSourceFile.c_str(), V.description.c_str());
+                       user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s", m->ModuleSourceFile.c_str(), V.description.c_str()));
                }
        }
-       user->SendText(":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName.c_str(), user->nick.c_str());
+       user->WriteRemoteNumeric(703, "End of MODULES list");
 
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandModules)