summaryrefslogtreecommitdiff
path: root/modules/core/hs_set.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-24 21:40:56 -0600
committerAdam <Adam@anope.org>2010-12-12 19:36:19 -0500
commitcb6ef574e3df5cc846247450b74ca37d265f319e (patch)
tree8ce3374a537c312af63c78125bfea4622bb188f0 /modules/core/hs_set.cpp
parent37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff)
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/hs_set.cpp')
-rw-r--r--modules/core/hs_set.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp
index 00b7d4556..8cd25bdc2 100644
--- a/modules/core/hs_set.cpp
+++ b/modules/core/hs_set.cpp
@@ -20,27 +20,26 @@ class CommandHSSet : public Command
{
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
+ User *u = source.u;
+
Anope::string nick = params[0];
Anope::string rawhostmask = params[1];
Anope::string hostmask;
- NickAlias *na;
- int32 tmp_time;
-
Anope::string vIdent = myStrGetToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */
if (!vIdent.empty())
{
rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */
if (rawhostmask.empty())
{
- u->SendMessage(HostServ, HOST_SET_SYNTAX, Config->s_HostServ.c_str());
+ source.Reply(HOST_SET_SYNTAX, Config->s_HostServ.c_str());
return MOD_CONT;
}
if (vIdent.length() > Config->UserLen)
{
- u->SendMessage(HostServ, HOST_SET_IDENTTOOLONG, Config->UserLen);
+ source.Reply(HOST_SET_IDENTTOOLONG, Config->UserLen);
return MOD_CONT;
}
else
@@ -48,13 +47,13 @@ class CommandHSSet : public Command
for (Anope::string::iterator s = vIdent.begin(), s_end = vIdent.end(); s != s_end; ++s)
if (!isvalidchar(*s))
{
- u->SendMessage(HostServ, HOST_SET_IDENT_ERROR);
+ source.Reply(HOST_SET_IDENT_ERROR);
return MOD_CONT;
}
}
if (!ircd->vident)
{
- u->SendMessage(HostServ, HOST_NO_VIDENT);
+ source.Reply(HOST_NO_VIDENT);
return MOD_CONT;
}
}
@@ -62,23 +61,22 @@ class CommandHSSet : public Command
hostmask = rawhostmask;
else
{
- u->SendMessage(HostServ, HOST_SET_TOOLONG, Config->HostLen);
+ source.Reply(HOST_SET_TOOLONG, Config->HostLen);
return MOD_CONT;
}
if (!isValidHost(hostmask, 3))
{
- u->SendMessage(HostServ, HOST_SET_ERROR);
+ source.Reply(HOST_SET_ERROR);
return MOD_CONT;
}
- tmp_time = Anope::CurTime;
-
+ NickAlias *na = findnick(nick);
if ((na = findnick(nick)))
{
if (na->HasFlag(NS_FORBIDDEN))
{
- u->SendMessage(HostServ, NICK_X_FORBIDDEN, nick.c_str());
+ source.Reply(NICK_X_FORBIDDEN, nick.c_str());
return MOD_CONT;
}
@@ -87,12 +85,12 @@ class CommandHSSet : public Command
na->hostinfo.SetVhost(vIdent, hostmask, u->nick);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!vIdent.empty())
- u->SendMessage(HostServ, HOST_IDENT_SET, nick.c_str(), vIdent.c_str(), hostmask.c_str());
+ source.Reply(HOST_IDENT_SET, nick.c_str(), vIdent.c_str(), hostmask.c_str());
else
- u->SendMessage(HostServ, HOST_SET, nick.c_str(), hostmask.c_str());
+ source.Reply(HOST_SET, nick.c_str(), hostmask.c_str());
}
else
- u->SendMessage(HostServ, HOST_NOREG, nick.c_str());
+ source.Reply(HOST_NOREG, nick.c_str());
return MOD_CONT;
}