1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for USERIP command */
20 class CommandUserip : public Command
23 CommandUserip (InspIRCd* Instance) : Command(Instance,"USERIP", "o", 1)
25 this->source = "m_userip.so";
26 syntax = "<nick>{,<nick>}";
29 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
31 std::string retbuf = std::string("340 ") + user->nick + " :";
33 for (int i = 0; i < (int)parameters.size(); i++)
35 User *u = ServerInstance->FindNick(parameters[i]);
36 if ((u) && (u->registered == REG_ALL))
38 retbuf = retbuf + u->nick + (IS_OPER(u) ? "*" : "") + "=";
43 retbuf += u->ident + "@" + u->GetIPString() + " ";
47 user->WriteServ(retbuf);
49 /* Dont send to the network */
54 class ModuleUserIP : public Module
56 CommandUserip* mycommand;
58 ModuleUserIP(InspIRCd* Me)
62 mycommand = new CommandUserip(ServerInstance);
63 ServerInstance->AddCommand(mycommand);
64 Implementation eventlist[] = { I_On005Numeric };
65 ServerInstance->Modules->Attach(eventlist, this, 1);
69 virtual void On005Numeric(std::string &output)
71 output = output + std::string(" USERIP");
74 virtual ~ModuleUserIP()
78 virtual Version GetVersion()
80 return Version("$Id$",VF_VENDOR,API_VERSION);
85 MODULE_INIT(ModuleUserIP)