X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sethost.cpp;h=b37207b4fa7e93020aa3bb13ac0d795c9225bc52;hb=451e687f681ccab5c02a8de1a7d59b324efbfe08;hp=80953ee6f8102d76d55bc05072ed189d3ffa1892;hpb=c202dea024542b9c6c6b771bb9a3a081d9eacdc5;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 80953ee6f..b37207b4f 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -36,8 +36,13 @@ class CommandSethost : public Command CmdResult Handle (const std::vector& parameters, User *user) { - size_t len = 0; - for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++, len++) + if (parameters[0].length() > ServerInstance->Config->Limits.MaxHost) + { + user->WriteNotice("*** SETHOST: Host too long"); + return CMD_FAILURE; + } + + for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++) { if (!hostmap[(const unsigned char)*x]) { @@ -46,15 +51,9 @@ class CommandSethost : public Command } } - if (len > 64) - { - user->WriteNotice("*** SETHOST: Host too long"); - return CMD_FAILURE; - } - if (user->ChangeDisplayedHost(parameters[0])) { - ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->dhost); + ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SETHOST to change their displayed host to "+user->GetDisplayedHost()); return CMD_SUCCESS; } @@ -74,11 +73,6 @@ class ModuleSetHost : public Module { } - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->AddService(cmd); - } - void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");