X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_userip.cpp;h=7ffeb383a1fbe4b7ab7adc5d7600e83bb1a8ef20;hb=eacd707421be4f2612df9bde4517649061bb062e;hp=bca1d1acf359ca39335f409061148c02fcf1f420;hpb=dd36852a52e8541306b76c5b88bce8ab9b36654c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index bca1d1acf..7ffeb383a 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * InspIRCd: (C) 2002-2009 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -26,20 +26,28 @@ class CommandUserip : public Command syntax = "{,}"; } - CmdResult Handle (const char* const* parameters, int pcnt, User *user) + CmdResult Handle (const std::vector ¶meters, User *user) { std::string retbuf = std::string("340 ") + user->nick + " :"; + int nicks = 0; - for (int i = 0; i < pcnt; i++) + 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; @@ -53,7 +61,7 @@ class ModuleUserIP : public Module ModuleUserIP(InspIRCd* Me) : Module(Me) { - + mycommand = new CommandUserip(ServerInstance); ServerInstance->AddCommand(mycommand); Implementation eventlist[] = { I_On005Numeric }; @@ -65,16 +73,16 @@ class ModuleUserIP : public Module { output = output + std::string(" USERIP"); } - + virtual ~ModuleUserIP() { } - + virtual Version GetVersion() { - return Version(1,1,0,1,VF_VENDOR,API_VERSION); + return Version("$Id$",VF_VENDOR,API_VERSION); } - + }; MODULE_INIT(ModuleUserIP)