X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_userip.cpp;h=29b1eb5face6561d9cc1f3f4882b5dc1f9e4ebf2;hb=52acbb466b84a1cd161b1c111f855d6f0419fff3;hp=033bb0ada68b127d23718893e809b158333134c8;hpb=71ad308979d9c9129507fdf85d4305fd12e18bea;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 033bb0ada..29b1eb5fa 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -2,33 +2,24 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * - * - * Written by Craig Edwards, Craig McLure, and others. + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * * This program is free but copyrighted software; see * the file COPYING for details. * * --------------------------------------------------- */ -using namespace std; - -#include -#include +#include "inspircd.h" #include "users.h" #include "channels.h" #include "modules.h" -#include "inspircd.h" - /* $ModDesc: Provides support for USERIP command */ - - - +/** Handle /USERIP + */ class cmd_userip : public command_t { public: @@ -40,18 +31,18 @@ class cmd_userip : public command_t CmdResult Handle (const char** parameters, int pcnt, userrec *user) { - char Return[MAXBUF],junk[MAXBUF]; - snprintf(Return,MAXBUF,"340 %s :",user->nick); + std::string retbuf = std::string("340 ") + user->nick + " :"; + for (int i = 0; i < pcnt; i++) { userrec *u = ServerInstance->FindNick(parameters[i]); if ((u) && (u->registered == REG_ALL)) { - snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,u->GetIPString()); - strlcat(Return,junk,MAXBUF); + retbuf = retbuf + u->nick + (IS_OPER(u) ? "*" : "") + "=+" + u->ident + "@" + u->GetIPString() + " "; } } - user->WriteServ(Return); + + user->WriteServ(retbuf); /* Dont send to the network */ return CMD_FAILURE; @@ -63,7 +54,7 @@ class ModuleUserIP : public Module cmd_userip* mycommand; public: ModuleUserIP(InspIRCd* Me) - : Module::Module(Me) + : Module(Me) { mycommand = new cmd_userip(ServerInstance); @@ -86,7 +77,7 @@ class ModuleUserIP : public Module virtual Version GetVersion() { - return Version(1,0,0,1,VF_VENDOR); + return Version(1,1,0,1,VF_VENDOR,API_VERSION); } }; @@ -112,7 +103,7 @@ class ModuleUserIPFactory : public ModuleFactory }; -extern "C" void * init_module( void ) +extern "C" DllExport void * init_module( void ) { return new ModuleUserIPFactory; }