1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
27 /* $ModDesc: Provides support for USERIP command */
32 class cmd_userip : public command_t
35 cmd_userip (InspIRCd* Instance) : command_t(Instance,"USERIP", 'o', 1)
37 this->source = "m_userip.so";
38 syntax = "<nick>{,<nick>}";
41 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
43 char Return[MAXBUF],junk[MAXBUF];
44 snprintf(Return,MAXBUF,"340 %s :",user->nick);
45 for (int i = 0; i < pcnt; i++)
47 userrec *u = ServerInstance->FindNick(parameters[i]);
48 if ((u) && (u->registered == REG_ALL))
50 snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,u->GetIPString());
51 strlcat(Return,junk,MAXBUF);
54 user->WriteServ(Return);
56 /* Dont send to the network */
61 class ModuleUserIP : public Module
63 cmd_userip* mycommand;
65 ModuleUserIP(InspIRCd* Me)
69 mycommand = new cmd_userip(ServerInstance);
70 ServerInstance->AddCommand(mycommand);
73 void Implements(char* List)
75 List[I_On005Numeric] = 1;
78 virtual void On005Numeric(std::string &output)
80 output = output + std::string(" USERIP");
83 virtual ~ModuleUserIP()
87 virtual Version GetVersion()
89 return Version(1,0,0,1,VF_VENDOR);
94 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
96 class ModuleUserIPFactory : public ModuleFactory
103 ~ModuleUserIPFactory()
107 virtual Module * CreateModule(InspIRCd* Me)
109 return new ModuleUserIP(Me);
115 extern "C" void * init_module( void )
117 return new ModuleUserIPFactory;