summaryrefslogtreecommitdiff
path: root/modules/core/ns_ghost.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/ns_ghost.cpp
parent37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff)
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/ns_ghost.cpp')
-rw-r--r--modules/core/ns_ghost.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp
index a350a5b1d..8009c85f4 100644
--- a/modules/core/ns_ghost.cpp
+++ b/modules/core/ns_ghost.cpp
@@ -21,39 +21,41 @@ class CommandNSGhost : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- 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];
+ const Anope::string &nick = params[0];
Anope::string pass = params.size() > 1 ? params[1] : "";
+
+ User *u = source.u;
User *user = finduser(nick);
NickAlias *na = findnick(nick);
if (!user)
- u->SendMessage(NickServ, NICK_X_NOT_IN_USE, nick.c_str());
+ source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
else if (!na)
- u->SendMessage(NickServ, NICK_X_NOT_REGISTERED, nick.c_str());
+ source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (na->HasFlag(NS_FORBIDDEN))
- u->SendMessage(NickServ, NICK_X_FORBIDDEN, na->nick.c_str());
+ source.Reply(NICK_X_FORBIDDEN, na->nick.c_str());
else if (na->nc->HasFlag(NI_SUSPENDED))
- u->SendMessage(NickServ, NICK_X_SUSPENDED, na->nick.c_str());
+ source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
else if (nick.equals_ci(u->nick))
- u->SendMessage(NickServ, NICK_NO_GHOST_SELF);
+ source.Reply(NICK_NO_GHOST_SELF);
else if ((u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc))) ||
(!pass.empty() && enc_check_password(pass, na->nc->pass) == 1))
{
if (!user->IsIdentified() && FindCommand(NickServ, "RECOVER"))
- u->SendMessage(NickServ, NICK_GHOST_UNIDENTIFIED);
+ source.Reply(NICK_GHOST_UNIDENTIFIED);
else
{
Log(LOG_COMMAND, u, this) << "for " << nick;
Anope::string buf = "GHOST command used by " + u->nick;
kill_user(Config->s_NickServ, nick, buf);
- u->SendMessage(NickServ, NICK_GHOST_KILLED, nick.c_str());
+ source.Reply(NICK_GHOST_KILLED, nick.c_str());
}
}
else
{
- u->SendMessage(NickServ, ACCESS_DENIED);
+ source.Reply(ACCESS_DENIED);
if (!pass.empty())
{
Log(LOG_COMMAND, u, this) << "with an invalid password for " << nick;