X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_userip.cpp;h=b229aa39b053bbefab620d9f41b3482513776a1b;hb=78aabc62e7510af5075b2056f703f0aa42e328a4;hp=77f3474f936d9c16083c5b0ae26327df7ef234e8;hpb=e471f12576b6b6d1a1c7d2e856998b47735d2037;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 77f3474f9..b229aa39b 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -20,15 +20,15 @@ class CommandUserip : public Command { public: - CommandUserip (InspIRCd* Instance) : Command(Instance,"USERIP", "o", 1) + CommandUserip(Module* Creator) : Command(Creator,"USERIP", 1) { - this->source = "m_userip.so"; - syntax = "{,}"; + flags_needed = 'o'; syntax = "{,}"; } CmdResult Handle (const std::vector ¶meters, User *user) { std::string retbuf = std::string("340 ") + user->nick + " :"; + int nicks = 0; for (int i = 0; i < (int)parameters.size(); i++) { @@ -41,26 +41,26 @@ class CommandUserip : public Command else retbuf += "+"; retbuf += u->ident + "@" + u->GetIPString() + " "; + nicks++; } } - user->WriteServ(retbuf); + if (nicks != 0) + user->WriteServ(retbuf); /* Dont send to the network */ - return CMD_LOCALONLY; + return CMD_SUCCESS; } }; class ModuleUserIP : public Module { - CommandUserip* mycommand; + CommandUserip cmd; public: - ModuleUserIP(InspIRCd* Me) - : Module(Me) + ModuleUserIP() + : cmd(this) { - - mycommand = new CommandUserip(ServerInstance); - ServerInstance->AddCommand(mycommand); + ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 1); } @@ -77,7 +77,7 @@ class ModuleUserIP : public Module virtual Version GetVersion() { - return Version("$Id$",VF_VENDOR,API_VERSION); + return Version("Provides support for USERIP command",VF_VENDOR,API_VERSION); } };