X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chgident.cpp;h=f2c48cb52c511d4a3168ef4fb42c605924a9cd2d;hb=2c6c072c1f5f19d1471feb43fa94bba0030e5fb6;hp=b437736316b21313fc8f9794a1085bd70a788259;hpb=e280aade7ec7085c495c263ee3758a35c97fa0ed;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index b43773631..f2c48cb52 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -1,37 +1,34 @@ #include #include "users.h" #include "modules.h" +#include "message.h" #include "helperfuncs.h" /* $ModDesc: Provides support for the CHGIDENT command */ -Server *Srv; - - class cmd_chgident : public command_t { + Server* Srv; public: - cmd_chgident() : command_t("CHGIDENT", 'o', 2) + cmd_chgident(Server* serv) : command_t("CHGIDENT", 'o', 2) { this->source = "m_chgident.so"; + Srv = serv; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if(dest) { - for(unsigned int x = 0; x < strlen(parameters[1]); x++) + if(!isident(parameters[1])) { - if(((parameters[1][x] >= 'A') && (parameters[1][x] <= '}')) || strchr(".-0123456789", parameters[1][x])) - continue; - WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick); return; } - WriteOpers("%s used CHGIDENT to change %s's host from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]); + WriteOpers("%s used CHGIDENT to change %s's ident from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]); strlcpy(dest->ident, parameters[1], IDENTMAX+2); } else @@ -49,9 +46,8 @@ class ModuleChgIdent : public Module public: ModuleChgIdent(Server* Me) : Module::Module(Me) { - Srv = Me; - mycommand = new cmd_chgident(); - Srv->AddCommand(mycommand); + mycommand = new cmd_chgident(Me); + Me->AddCommand(mycommand); } virtual ~ModuleChgIdent() @@ -60,7 +56,7 @@ public: virtual Version GetVersion() { - return Version(1,0,0,0,0); + return Version(1,0,0,0,VF_VENDOR); } };