X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_userip.cpp;h=8600546bcbfa2a2730695e9b7d962675fe87b101;hb=f25c4b7a2263f5f3ce9bb41ba56b43c0d3a6d124;hp=d7c5792e8f066262ed4f75a38d3d75524b2c3ebd;hpb=bf5a8dc97fd0e8dee0d0a1946d4fcd31bebb4a24;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index d7c5792e8..8600546bc 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. @@ -29,17 +29,25 @@ class CommandUserip : public Command 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++) { User *u = ServerInstance->FindNick(parameters[i]); if ((u) && (u->registered == REG_ALL)) { - retbuf = retbuf + u->nick + (IS_OPER(u) ? "*" : "") + "=+" + u->ident + "@" + u->GetIPString() + " "; + retbuf = retbuf + u->nick + (IS_OPER(u) ? "*" : "") + "="; + if (IS_AWAY(u)) + retbuf += "-"; + 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; @@ -48,14 +56,12 @@ class CommandUserip : public Command class ModuleUserIP : public Module { - CommandUserip* mycommand; + CommandUserip cmd; public: ModuleUserIP(InspIRCd* Me) - : Module(Me) + : Module(Me), cmd(Me) { - - mycommand = new CommandUserip(ServerInstance); - ServerInstance->AddCommand(mycommand); + ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 1); } @@ -65,16 +71,16 @@ class ModuleUserIP : public Module { output = output + std::string(" USERIP"); } - + virtual ~ModuleUserIP() { } - + virtual Version GetVersion() { - return Version(1,2,0,1,VF_VENDOR,API_VERSION); + return Version("$Id$",VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleUserIP)