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) ? "*" : "") + "=+" + u->ident + "@" + u->GetIPString() + " ";
42 user->WriteServ(retbuf);
44 /* Dont send to the network */
49 class ModuleUserIP : public Module
51 CommandUserip* mycommand;
53 ModuleUserIP(InspIRCd* Me)
57 mycommand = new CommandUserip(ServerInstance);
58 ServerInstance->AddCommand(mycommand);
59 Implementation eventlist[] = { I_On005Numeric };
60 ServerInstance->Modules->Attach(eventlist, this, 1);
64 virtual void On005Numeric(std::string &output)
66 output = output + std::string(" USERIP");
69 virtual ~ModuleUserIP()
73 virtual Version GetVersion()
75 return Version(1,2,0,1,VF_VENDOR,API_VERSION);
80 MODULE_INIT(ModuleUserIP)