diff options
author | Adam <Adam@anope.org> | 2010-11-24 21:40:56 -0600 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:36:19 -0500 |
commit | cb6ef574e3df5cc846247450b74ca37d265f319e (patch) | |
tree | 8ce3374a537c312af63c78125bfea4622bb188f0 /modules/core/ns_set.cpp | |
parent | 37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff) |
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/ns_set.cpp')
-rw-r--r-- | modules/core/ns_set.cpp | 30 |
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> ¶ms) + CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { + 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> ¶ms) + CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { + 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> ¶ms) + CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - Anope::string param = params[1]; + User *u = source.u; + const Anope::string ¶m = 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; } |