mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
core_info Deduplicate code by inheriting some commands from ServerTargetCommand
This commit is contained in:
parent
f74734e416
commit
60ecb2157d
@ -22,7 +22,7 @@
|
||||
#include "core_info.h"
|
||||
|
||||
CommandAdmin::CommandAdmin(Module* parent)
|
||||
: Command(parent, "ADMIN", 0, 0)
|
||||
: ServerTargetCommand(parent, "ADMIN")
|
||||
{
|
||||
Penalty = 2;
|
||||
syntax = "[<servername>]";
|
||||
@ -41,10 +41,3 @@ CmdResult CommandAdmin::Handle (const std::vector<std::string>& parameters, User
|
||||
user->WriteRemoteNumeric(RPL_ADMINEMAIL, InspIRCd::Format("E-Mail - %s", AdminEmail.c_str()));
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandAdmin::GetRouting(User* user, const std::vector<std::string>& parameters)
|
||||
{
|
||||
if (parameters.size() > 0)
|
||||
return ROUTE_UNICAST(parameters[0]);
|
||||
return ROUTE_LOCALONLY;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "core_info.h"
|
||||
|
||||
CommandInfo::CommandInfo(Module* parent)
|
||||
: Command(parent, "INFO")
|
||||
: ServerTargetCommand(parent, "INFO")
|
||||
{
|
||||
Penalty = 4;
|
||||
syntax = "[<servername>]";
|
||||
@ -88,10 +88,3 @@ CmdResult CommandInfo::Handle (const std::vector<std::string>& parameters, User
|
||||
user->WriteRemoteNumeric(RPL_ENDOFINFO, "End of /INFO list");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandInfo::GetRouting(User* user, const std::vector<std::string>& parameters)
|
||||
{
|
||||
if (parameters.size() > 0)
|
||||
return ROUTE_UNICAST(parameters[0]);
|
||||
return ROUTE_LOCALONLY;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "core_info.h"
|
||||
|
||||
CommandModules::CommandModules(Module* parent)
|
||||
: Command(parent, "MODULES", 0, 0)
|
||||
: ServerTargetCommand(parent, "MODULES")
|
||||
{
|
||||
Penalty = 4;
|
||||
syntax = "[<servername>]";
|
||||
@ -80,10 +80,3 @@ CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, Us
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandModules::GetRouting(User* user, const std::vector<std::string>& parameters)
|
||||
{
|
||||
if (parameters.size() >= 1)
|
||||
return ROUTE_UNICAST(parameters[0]);
|
||||
return ROUTE_LOCALONLY;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "core_info.h"
|
||||
|
||||
CommandMotd::CommandMotd(Module* parent)
|
||||
: Command(parent, "MOTD", 0, 1)
|
||||
: ServerTargetCommand(parent, "MOTD")
|
||||
{
|
||||
syntax = "[<servername>]";
|
||||
}
|
||||
@ -61,10 +61,3 @@ CmdResult CommandMotd::Handle (const std::vector<std::string>& parameters, User
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandMotd::GetRouting(User* user, const std::vector<std::string>& parameters)
|
||||
{
|
||||
if (parameters.size() > 0)
|
||||
return ROUTE_UNICAST(parameters[0]);
|
||||
return ROUTE_LOCALONLY;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "core_info.h"
|
||||
|
||||
CommandTime::CommandTime(Module* parent)
|
||||
: Command(parent, "TIME", 0, 0)
|
||||
: ServerTargetCommand(parent, "TIME")
|
||||
{
|
||||
syntax = "[<servername>]";
|
||||
}
|
||||
@ -36,10 +36,3 @@ CmdResult CommandTime::Handle (const std::vector<std::string>& parameters, User
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
RouteDescriptor CommandTime::GetRouting(User* user, const std::vector<std::string>& parameters)
|
||||
{
|
||||
if (parameters.size() > 0)
|
||||
return ROUTE_UNICAST(parameters[0]);
|
||||
return ROUTE_LOCALONLY;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class ServerTargetCommand : public Command
|
||||
|
||||
/** Handle /ADMIN.
|
||||
*/
|
||||
class CommandAdmin : public Command
|
||||
class CommandAdmin : public ServerTargetCommand
|
||||
{
|
||||
public:
|
||||
/** Holds the admin's name, for output in
|
||||
@ -64,7 +64,6 @@ class CommandAdmin : public 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);
|
||||
};
|
||||
|
||||
/** Handle /COMMANDS.
|
||||
@ -86,7 +85,7 @@ class CommandCommands : public Command
|
||||
|
||||
/** Handle /INFO.
|
||||
*/
|
||||
class CommandInfo : public Command
|
||||
class CommandInfo : public ServerTargetCommand
|
||||
{
|
||||
public:
|
||||
/** Constructor for info.
|
||||
@ -99,12 +98,11 @@ class CommandInfo : public 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);
|
||||
};
|
||||
|
||||
/** Handle /MODULES.
|
||||
*/
|
||||
class CommandModules : public Command
|
||||
class CommandModules : public ServerTargetCommand
|
||||
{
|
||||
public:
|
||||
/** Constructor for modules.
|
||||
@ -117,12 +115,11 @@ class CommandModules : public 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);
|
||||
};
|
||||
|
||||
/** Handle /MOTD.
|
||||
*/
|
||||
class CommandMotd : public Command
|
||||
class CommandMotd : public ServerTargetCommand
|
||||
{
|
||||
public:
|
||||
/** Constructor for motd.
|
||||
@ -135,12 +132,11 @@ class CommandMotd : public 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);
|
||||
};
|
||||
|
||||
/** Handle /TIME.
|
||||
*/
|
||||
class CommandTime : public Command
|
||||
class CommandTime : public ServerTargetCommand
|
||||
{
|
||||
public:
|
||||
/** Constructor for time.
|
||||
@ -153,7 +149,6 @@ class CommandTime : public 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);
|
||||
};
|
||||
|
||||
/** Handle /VERSION.
|
||||
|
Loading…
x
Reference in New Issue
Block a user