summaryrefslogtreecommitdiff
path: root/src/modules/m_userip.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:48:07 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:48:07 +0000
commit347e25f83d2d8403851e8bdcbf27d987abbd8fd5 (patch)
tree6eff73c25154ac55bfe4167abd79011ac3f06b61 /src/modules/m_userip.cpp
parenta5a8764bfe85e208a622a86295bdf56da575f21c (diff)
Last set of modules converted to new command system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2538 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_userip.cpp')
-rw-r--r--src/modules/m_userip.cpp42
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)