summaryrefslogtreecommitdiff
path: root/src/modules/m_sanick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_sanick.cpp')
-rw-r--r--src/modules/m_sanick.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 4e4be77ae..4744ca1de 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -21,8 +21,6 @@
#include "inspircd.h"
-/* $ModDesc: Provides support for SANICK command */
-
/** Handle /SANICK
*/
class CommandSanick : public Command
@@ -31,32 +29,32 @@ class CommandSanick : public Command
CommandSanick(Module* Creator) : Command(Creator,"SANICK", 2)
{
allow_empty_last_param = false;
- flags_needed = 'o'; Penalty = 0; syntax = "<nick> <new-nick>";
- TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
+ flags_needed = 'o'; syntax = "<nick> <new-nick>";
+ TRANSLATE2(TR_NICK, TR_TEXT);
}
- CmdResult Handle (const std::vector<std::string>& parameters, User *user)
+ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
{
User* target = ServerInstance->FindNick(parameters[0]);
/* Do local sanity checks and bails */
if (IS_LOCAL(user))
{
- if (target && ServerInstance->ULine(target->server))
+ if (target && target->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
+ user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client");
return CMD_FAILURE;
}
if ((!target) || (target->registered != REG_ALL))
{
- user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
+ user->WriteNotice("*** No such nickname: '" + parameters[0] + "'");
return CMD_FAILURE;
}
- if (!ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
+ if (!ServerInstance->IsNick(parameters[1]))
{
- user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
+ user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'");
return CMD_FAILURE;
}
}
@@ -66,7 +64,7 @@ class CommandSanick : public Command
{
std::string oldnick = user->nick;
std::string newnick = target->nick;
- if (target->ChangeNick(parameters[1], true))
+ if (target->ChangeNick(parameters[1]))
{
ServerInstance->SNO->WriteGlobalSno('a', oldnick+" used SANICK to change "+newnick+" to "+parameters[1]);
}
@@ -79,12 +77,9 @@ class CommandSanick : public Command
return CMD_SUCCESS;
}
- RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE
{
- User* dest = ServerInstance->FindNick(parameters[0]);
- if (dest)
- return ROUTE_OPT_UCAST(dest->server);
- return ROUTE_LOCALONLY;
+ return ROUTE_OPT_UCAST(parameters[0]);
}
};
@@ -98,20 +93,10 @@ class ModuleSanick : public Module
{
}
- void init()
- {
- ServerInstance->Modules->AddService(cmd);
- }
-
- virtual ~ModuleSanick()
- {
- }
-
- virtual Version GetVersion()
+ Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for SANICK command", VF_OPTCOMMON | VF_VENDOR);
}
-
};
MODULE_INIT(ModuleSanick)