* ---------------------------------------------------
*/
-#include <stdio.h>
-#include <string>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
#include "inspircd.h"
/* $ModDesc: Provides support for USERIP command */
/** Handle /USERIP
*/
-class cmd_userip : public command_t
+class CommandUserip : public Command
{
public:
- cmd_userip (InspIRCd* Instance) : command_t(Instance,"USERIP", 'o', 1)
+ CommandUserip (InspIRCd* Instance) : Command(Instance,"USERIP", 'o', 1)
{
this->source = "m_userip.so";
syntax = "<nick>{,<nick>}";
}
- CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, User *user)
{
std::string retbuf = std::string("340 ") + user->nick + " :";
for (int i = 0; i < pcnt; i++)
{
- userrec *u = ServerInstance->FindNick(parameters[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) ? "*" : "") + "=+" + u->ident + "@" + u->GetIPString() + " ";
}
}
user->WriteServ(retbuf);
/* Dont send to the network */
- return CMD_FAILURE;
+ return CMD_LOCALONLY;
}
};
class ModuleUserIP : public Module
{
- cmd_userip* mycommand;
+ CommandUserip* mycommand;
public:
ModuleUserIP(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
- mycommand = new cmd_userip(ServerInstance);
+ mycommand = new CommandUserip(ServerInstance);
ServerInstance->AddCommand(mycommand);
+ Implementation eventlist[] = { I_On005Numeric };
+ ServerInstance->Modules->Attach(eventlist, this, 1);
}
void Implements(char* List)
};
-// stuff down here is the module-factory stuff. For basic modules you can ignore this.
-
-class ModuleUserIPFactory : public ModuleFactory
-{
- public:
- ModuleUserIPFactory()
- {
- }
-
- ~ModuleUserIPFactory()
- {
- }
-
- virtual Module * CreateModule(InspIRCd* Me)
- {
- return new ModuleUserIP(Me);
- }
-
-};
-
-
-extern "C" void * init_module( void )
-{
- return new ModuleUserIPFactory;
-}
+MODULE_INIT(ModuleUserIP)