summaryrefslogtreecommitdiff
path: root/modules/core/ns_set.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/ns_set.cpp')
-rw-r--r--modules/core/ns_set.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp
index f5cc9a2d3..7d63119e9 100644
--- a/modules/core/ns_set.cpp
+++ b/modules/core/ns_set.cpp
@@ -28,17 +28,19 @@ class CommandNSSet : public Command
this->subcommands.clear();
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
+ User *u = source.u;
+
if (readonly)
{
- u->SendMessage(NickServ, NICK_SET_DISABLED);
+ source.Reply(NICK_SET_DISABLED);
return MOD_CONT;
}
if (u->Account()->HasFlag(NI_SUSPENDED))
{
- u->SendMessage(NickServ, NICK_X_SUSPENDED, u->Account()->display.c_str());
+ source.Reply(NICK_X_SUSPENDED, u->Account()->display.c_str());
return MOD_CONT;
}
@@ -57,7 +59,7 @@ class CommandNSSet : public Command
mod_run_cmd(NickServ, u, c, params[0], cmdparams, false);
}
else
- u->SendMessage(NickServ, NICK_SET_UNKNOWN_OPTION, params[0].c_str());
+ source.Reply(NICK_SET_UNKNOWN_OPTION, params[0].c_str());
return MOD_CONT;
}
@@ -121,13 +123,14 @@ class CommandNSSetDisplay : 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;
NickAlias *na = findnick(params[1]);
if (!na || na->nc != u->Account())
{
- u->SendMessage(NickServ, NICK_SASET_DISPLAY_INVALID, u->Account()->display.c_str());
+ source.Reply(NICK_SASET_DISPLAY_INVALID, u->Account()->display.c_str());
return MOD_CONT;
}
@@ -161,35 +164,36 @@ class CommandNSSetPassword : public Command
{
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
- Anope::string param = params[1];
+ User *u = source.u;
+ const Anope::string &param = params[1];
unsigned len = param.length();
if (u->Account()->display.equals_ci(param) || (Config->StrictPasswords && len < 5))
{
- u->SendMessage(NickServ, MORE_OBSCURE_PASSWORD);
+ source.Reply(MORE_OBSCURE_PASSWORD);
return MOD_CONT;
}
else if (len > Config->PassLen)
{
- u->SendMessage(NickServ, PASSWORD_TOO_LONG);
+ source.Reply(PASSWORD_TOO_LONG);
return MOD_CONT;
}
if (enc_encrypt(param, u->Account()->pass) < 0)
{
Log(NickServ) << "Failed to encrypt password for " << u->Account()->display << " (set)";
- u->SendMessage(NickServ, NICK_SASET_PASSWORD_FAILED);
+ source.Reply(NICK_SASET_PASSWORD_FAILED);
return MOD_CONT;
}
Anope::string tmp_pass;
if (enc_decrypt(u->Account()->pass, tmp_pass) == 1)
- u->SendMessage(NickServ, NICK_SASET_PASSWORD_CHANGED_TO, u->Account()->display.c_str(), tmp_pass.c_str());
+ source.Reply(NICK_SASET_PASSWORD_CHANGED_TO, u->Account()->display.c_str(), tmp_pass.c_str());
else
- u->SendMessage(NickServ, NICK_SASET_PASSWORD_CHANGED, u->Account()->display.c_str());
+ source.Reply(NICK_SASET_PASSWORD_CHANGED, u->Account()->display.c_str());
return MOD_CONT;
}