summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-03-29 12:32:16 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-03-29 12:32:16 +0200
commit60ecb2157db64da797d0f505ce905e3a96a61d1a (patch)
treee74d9810dd536d915cca77778c1b7c25c8a08871 /src/coremods
parentf74734e41694e4ff7c8164858864030521279eb4 (diff)
core_info Deduplicate code by inheriting some commands from ServerTargetCommand
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_info/cmd_admin.cpp9
-rw-r--r--src/coremods/core_info/cmd_info.cpp9
-rw-r--r--src/coremods/core_info/cmd_modules.cpp9
-rw-r--r--src/coremods/core_info/cmd_motd.cpp9
-rw-r--r--src/coremods/core_info/cmd_time.cpp9
-rw-r--r--src/coremods/core_info/core_info.h15
6 files changed, 10 insertions, 50 deletions
diff --git a/src/coremods/core_info/cmd_admin.cpp b/src/coremods/core_info/cmd_admin.cpp
index 19037406b..f79ebc036 100644
--- a/src/coremods/core_info/cmd_admin.cpp
+++ b/src/coremods/core_info/cmd_admin.cpp
@@ -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;
-}
diff --git a/src/coremods/core_info/cmd_info.cpp b/src/coremods/core_info/cmd_info.cpp
index e014fa4f2..3bf9db893 100644
--- a/src/coremods/core_info/cmd_info.cpp
+++ b/src/coremods/core_info/cmd_info.cpp
@@ -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;
-}
diff --git a/src/coremods/core_info/cmd_modules.cpp b/src/coremods/core_info/cmd_modules.cpp
index 16931e685..5f02d071f 100644
--- a/src/coremods/core_info/cmd_modules.cpp
+++ b/src/coremods/core_info/cmd_modules.cpp
@@ -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;
-}
diff --git a/src/coremods/core_info/cmd_motd.cpp b/src/coremods/core_info/cmd_motd.cpp
index 4772f8d2c..cfb083eed 100644
--- a/src/coremods/core_info/cmd_motd.cpp
+++ b/src/coremods/core_info/cmd_motd.cpp
@@ -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;
-}
diff --git a/src/coremods/core_info/cmd_time.cpp b/src/coremods/core_info/cmd_time.cpp
index a0b58efcc..6755e5837 100644
--- a/src/coremods/core_info/cmd_time.cpp
+++ b/src/coremods/core_info/cmd_time.cpp
@@ -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;
-}
diff --git a/src/coremods/core_info/core_info.h b/src/coremods/core_info/core_info.h
index f01daa819..ecfeb4f36 100644
--- a/src/coremods/core_info/core_info.h
+++ b/src/coremods/core_info/core_info.h
@@ -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.