1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 char** parameters, int pcnt, User *user)
31 std::string retbuf = std::string("340 ") + user->nick + " :";
33 for (int i = 0; i < pcnt; 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);
61 void Implements(char* List)
63 List[I_On005Numeric] = 1;
66 virtual void On005Numeric(std::string &output)
68 output = output + std::string(" USERIP");
71 virtual ~ModuleUserIP()
75 virtual Version GetVersion()
77 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
82 MODULE_INIT(ModuleUserIP)