summaryrefslogtreecommitdiff
path: root/modules/core/hs_setall.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_setall.cpp
parent37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff)
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/hs_setall.cpp')
-rw-r--r--modules/core/hs_setall.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/modules/core/hs_setall.cpp b/modules/core/hs_setall.cpp
index 304a000b8..4a2f27ab6 100644
--- a/modules/core/hs_setall.cpp
+++ b/modules/core/hs_setall.cpp
@@ -20,23 +20,24 @@ class CommandHSSetAll : public Command
{
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
- Anope::string nick = params[0];
+ User *u = source.u;
+
+ const Anope::string &nick = params[0];
Anope::string rawhostmask = params[1];
- Anope::string hostmask;
- NickAlias *na;
int32 tmp_time;
- if (!(na = findnick(nick)))
+ NickAlias *na = findnick(nick);
+ if (!na)
{
- u->SendMessage(HostServ, HOST_NOREG, nick.c_str());
+ source.Reply(HOST_NOREG, nick.c_str());
return MOD_CONT;
}
else 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;
}
@@ -46,12 +47,12 @@ class CommandHSSetAll : public Command
rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */
if (rawhostmask.empty())
{
- u->SendMessage(HostServ, HOST_SETALL_SYNTAX, Config->s_HostServ.c_str());
+ source.Reply(HOST_SETALL_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
@@ -59,28 +60,29 @@ class CommandHSSetAll : 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;
}
}
+ Anope::string hostmask;
if (rawhostmask.length() < Config->HostLen)
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;
}
@@ -92,9 +94,9 @@ class CommandHSSetAll : public Command
HostServSyncVhosts(na);
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
if (!vIdent.empty())
- u->SendMessage(HostServ, HOST_IDENT_SETALL, nick.c_str(), vIdent.c_str(), hostmask.c_str());
+ source.Reply(HOST_IDENT_SETALL, nick.c_str(), vIdent.c_str(), hostmask.c_str());
else
- u->SendMessage(HostServ, HOST_SETALL, nick.c_str(), hostmask.c_str());
+ source.Reply(HOST_SETALL, nick.c_str(), hostmask.c_str());
return MOD_CONT;
}