diff options
Diffstat (limited to 'src/modules/m_userip.cpp')
-rw-r--r-- | src/modules/m_userip.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 9e5b33d4e..a5e8b9bef 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -26,32 +26,42 @@ using namespace std; /* $ModDesc: Provides support for USERIP command */ Server *Srv; - -void handle_userip(char **parameters, int pcnt, userrec *user) + +class cmd_userip : public command_t { - char Return[MAXBUF],junk[MAXBUF]; - snprintf(Return,MAXBUF,"340 %s :",user->nick); - for (int i = 0; i < pcnt; i++) - { - userrec *u = Find(parameters[i]); - if (u) - { - snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,strchr(u->modes,'o') ? "*" : "",u->ident,u->ip); - strlcat(Return,junk,MAXBUF); - } - } - WriteServ(user->fd,Return); -} + public: + cmd_userip () : command_t("USERIP", 'o', 1) + { + this->source = "m_userip.so"; + } + void Handle (char **parameters, int pcnt, userrec *user) + { + char Return[MAXBUF],junk[MAXBUF]; + snprintf(Return,MAXBUF,"340 %s :",user->nick); + for (int i = 0; i < pcnt; i++) + { + userrec *u = Find(parameters[i]); + if (u) + { + snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,strchr(u->modes,'o') ? "*" : "",u->ident,u->ip); + strlcat(Return,junk,MAXBUF); + } + } + WriteServ(user->fd,Return); + } +}; class ModuleUserIP : public Module { + cmd_userip* myommand; public: ModuleUserIP(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddCommand("USERIP",handle_userip,'o',1,"m_userip.so"); + mycommand = new cmd_userip(); + Srv->AddCommand(mycommand); } virtual void On005Numeric(std::string &output) |