diff options
author | Adam <Adam@anope.org> | 2010-11-27 00:04:13 -0600 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:37:00 -0500 |
commit | 71c433cc502cc6073dd1e9d5cab3f49f8f6fd49e (patch) | |
tree | c9a463b9155471e11a067fd9306bfa152b189b51 | |
parent | 2b10cc84eab6cb9253611a090eb3ef67a6d3d0a7 (diff) |
The rest of the earlier command changes
158 files changed, 1575 insertions, 1615 deletions
diff --git a/include/commands.h b/include/commands.h index 9f4c5a928..b7c1e28f5 100644 --- a/include/commands.h +++ b/include/commands.h @@ -29,9 +29,9 @@ enum CommandReturn }; extern CoreExport Command *FindCommand(BotInfo *bi, const Anope::string &cmd); -extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, const Anope::string &cmd); -extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, const Anope::string &message, bool fantasy); -extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, const Anope::string &message, bool fantasy); +extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &cmd); +extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, const Anope::string &message, ChannelInfo *ci); +extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, const Anope::string &message, ChannelInfo *ci); enum CommandFlag { @@ -101,22 +101,22 @@ class CoreExport Command : public Flags<CommandFlag> virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0; /** Called when HELP is requsted for the client this command is on. - * @param u The user requesting help + * @param source The source */ - virtual void OnServHelp(User *u); + virtual void OnServHelp(CommandSource &source); /** Requested when the user is requesting help on this command. Help on this command should be sent to the user. - * @param u The user requesting help + * @param source The source * @param subcommand The subcommand the user is requesting help on, or an empty string. (e.g. /ns help set foo bar lol gives a subcommand of "FOO BAR LOL") * @return true if help was provided to the user, false otherwise. */ - virtual bool OnHelp(User *u, const Anope::string &subcommand); + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand); /** Requested when the user provides bad syntax to this command (not enough params, etc). - * @param u The user executing the command. + * @param source The source * @param subcommand The subcommand the user tried to use */ - virtual void OnSyntaxError(User *u, const Anope::string &subcommand); + virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand); /** Set which command permission (e.g. chanserv/forbid) is required for this command. * @param reststr The permission required to successfully execute this command diff --git a/include/extern.h b/include/extern.h index d16c5e1db..de51742ab 100644 --- a/include/extern.h +++ b/include/extern.h @@ -146,7 +146,7 @@ E const Anope::string GetString(NickCore *nc, LanguageString string); E const Anope::string GetString(User *u, LanguageString string); E const Anope::string GetString(const char *domain, Anope::string language, const Anope::string &string); E const char *const language_strings[LANG_STRING_COUNT]; -E void SyntaxError(BotInfo *bi, User *u, const Anope::string &command, LanguageString message); +E void SyntaxError(CommandSource &source, const Anope::string &command, LanguageString message); /*** logger.cpp ***/ E void InitLogChannels(ServerConfig *); @@ -189,10 +189,10 @@ class CoreExport UplinkSocket : public ConnectionSocket /**** memoserv.c ****/ E void ms_init(); -E void rsend_notify(User *u, Memo *m, const Anope::string &chan); +E void rsend_notify(CommandSource &source, Memo *m, const Anope::string &chan); E void check_memos(User *u); E MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid); -E void memo_send(User *u, const Anope::string &name, const Anope::string &text, int z); +E void memo_send(CommandSource &source, const Anope::string &name, const Anope::string &text, int z); /**** messages.c ****/ diff --git a/include/modules.h b/include/modules.h index cd3ba20a4..12e7884f8 100644 --- a/include/modules.h +++ b/include/modules.h @@ -284,11 +284,10 @@ class CoreExport Module : public Extensible Version GetVersion() const; /** Send a message to a user in their language, if a translation is available - * @param from Client to send the message from - * @param to User to send the message to + * @param source The source of the message * @param fmt The message */ - void SendMessage(BotInfo *from, User *to, const char *fmt, ...); + void SendMessage(CommandSource &source, const char *fmt, ...); /** * Add a module provided command to the given service. @@ -365,19 +364,18 @@ class CoreExport Module : public Extensible * @param bi The bot the command is being run from * @param command The command * @param message The parameters used for the command - * @param fantasy true if this is a fantasy command + * @param ci If a tanasy command, the channel the comman was used on * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it */ - virtual EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, bool fantasy) { return EVENT_CONTINUE; } + virtual EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci) { return EVENT_CONTINUE; } /** Called before a command is due to be executed. - * @param u The user executing the command - * @param service The service the command is associated with + * @param source The source of the command * @param command The command the user is executing * @param params The parameters the user is sending * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it */ - virtual EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> ¶ms) { return EVENT_CONTINUE; } + virtual EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { return EVENT_CONTINUE; } /** Called after a command has been executed. * @param source The source of the command diff --git a/modules/core/bs_act.cpp b/modules/core/bs_act.cpp index 87c7125ee..a41ad4626 100644 --- a/modules/core/bs_act.cpp +++ b/modules/core/bs_act.cpp @@ -57,20 +57,20 @@ class CommandBSAct : public Command return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "ACT", BOT_ACT_SYNTAX); + SyntaxError(source, "ACT", BOT_ACT_SYNTAX); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_ACT); + source.Reply(BOT_HELP_ACT); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_ACT); + source.Reply(BOT_HELP_CMD_ACT); } }; diff --git a/modules/core/bs_assign.cpp b/modules/core/bs_assign.cpp index a390d952c..e745313aa 100644 --- a/modules/core/bs_assign.cpp +++ b/modules/core/bs_assign.cpp @@ -62,24 +62,24 @@ class CommandBSAssign : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick; bi->Assign(u, ci); - u->SendMessage(BotServ, BOT_ASSIGN_ASSIGNED, bi->nick.c_str(), ci->name.c_str()); + source.Reply(BOT_ASSIGN_ASSIGNED, bi->nick.c_str(), ci->name.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_ASSIGN); + source.Reply(BOT_HELP_ASSIGN); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "ASSIGN", BOT_ASSIGN_SYNTAX); + SyntaxError(source, "ASSIGN", BOT_ASSIGN_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_ASSIGN); + source.Reply(BOT_HELP_CMD_ASSIGN); } }; diff --git a/modules/core/bs_badwords.cpp b/modules/core/bs_badwords.cpp index d1c3a9070..6db98b1aa 100644 --- a/modules/core/bs_badwords.cpp +++ b/modules/core/bs_badwords.cpp @@ -236,7 +236,7 @@ class CommandBSBadwords : public Command if (!need_args && word.empty()) { - this->OnSyntaxError(u, cmd); + this->OnSyntaxError(source, cmd); return MOD_CONT; } @@ -261,25 +261,25 @@ class CommandBSBadwords : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_BADWORDS); + source.Reply(BOT_HELP_BADWORDS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "BADWORDS", BOT_BADWORDS_SYNTAX); + SyntaxError(source, "BADWORDS", BOT_BADWORDS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_BADWORDS); + source.Reply(BOT_HELP_CMD_BADWORDS); } }; diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp index e16c4795a..a449ef23a 100644 --- a/modules/core/bs_bot.cpp +++ b/modules/core/bs_bot.cpp @@ -119,7 +119,7 @@ class CommandBSBot : public Command if (oldnick.empty() || nick.empty()) { - this->OnSyntaxError(source.u, "CHANGE"); + this->OnSyntaxError(source, "CHANGE"); return MOD_CONT; } @@ -276,7 +276,7 @@ class CommandBSBot : public Command if (nick.empty()) { - this->OnSyntaxError(source.u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -332,7 +332,7 @@ class CommandBSBot : public Command if (params.size() < 5) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -355,7 +355,7 @@ class CommandBSBot : public Command if (params.size() < 3) { - this->OnSyntaxError(u, "CHANGE"); + this->OnSyntaxError(source, "CHANGE"); return MOD_CONT; } @@ -372,32 +372,32 @@ class CommandBSBot : public Command if (params.size() < 1) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } return this->DoDel(source, params); } else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_SERVADMIN_HELP_BOT); + source.Reply(BOT_SERVADMIN_HELP_BOT); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "BOT", BOT_BOT_SYNTAX); + SyntaxError(source, "BOT", BOT_BOT_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_BOT); + source.Reply(BOT_HELP_CMD_BOT); } }; diff --git a/modules/core/bs_botlist.cpp b/modules/core/bs_botlist.cpp index 0e06db6d0..16fa12cda 100644 --- a/modules/core/bs_botlist.cpp +++ b/modules/core/bs_botlist.cpp @@ -68,15 +68,15 @@ class CommandBSBotList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_BOTLIST); + source.Reply(BOT_HELP_BOTLIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_BOTLIST); + source.Reply(BOT_HELP_CMD_BOTLIST); } }; diff --git a/modules/core/bs_help.cpp b/modules/core/bs_help.cpp index 12614ac55..43fb59c92 100644 --- a/modules/core/bs_help.cpp +++ b/modules/core/bs_help.cpp @@ -24,19 +24,19 @@ class CommandBSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; - mod_help_cmd(findbot(Config->s_BotServ), u, params[0]); + mod_help_cmd(BotServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { // Abuse syntax error to display general list help. - u->SendMessage(BotServ, BOT_HELP); + User *u = source.u; + source.Reply(BOT_HELP); for (CommandMap::const_iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); - u->SendMessage(BotServ, BOT_HELP_FOOTER, Config->BSMinUsers); + it->second->OnServHelp(source); + source.Reply(BOT_HELP_FOOTER, Config->BSMinUsers); } }; diff --git a/modules/core/bs_info.cpp b/modules/core/bs_info.cpp index 7c3ea2ef9..47bf2244f 100644 --- a/modules/core/bs_info.cpp +++ b/modules/core/bs_info.cpp @@ -208,20 +208,20 @@ class CommandBSInfo : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_INFO); + source.Reply(BOT_HELP_INFO); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "INFO", BOT_INFO_SYNTAX); + SyntaxError(source, "INFO", BOT_INFO_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_INFO); + source.Reply(BOT_HELP_CMD_INFO); } }; diff --git a/modules/core/bs_kick.cpp b/modules/core/bs_kick.cpp index 950e0b4fe..e34c97d83 100644 --- a/modules/core/bs_kick.cpp +++ b/modules/core/bs_kick.cpp @@ -34,9 +34,9 @@ class CommandBSKick : public Command if (readonly) source.Reply(BOT_KICK_DISABLED); else if (chan.empty() || option.empty() || value.empty()) - SyntaxError(BotServ, u, "KICK", BOT_KICK_SYNTAX); + SyntaxError(source, "KICK", BOT_KICK_SYNTAX); else if (!value.equals_ci("ON") && !value.equals_ci("OFF")) - SyntaxError(BotServ, u, "KICK", BOT_KICK_SYNTAX); + SyntaxError(source, "KICK", BOT_KICK_SYNTAX); else if (!check_access(u, ci, CA_SET) && !u->Account()->HasPriv("botserv/administration")) source.Reply(ACCESS_DENIED); else if (!ci->bi) @@ -371,42 +371,42 @@ class CommandBSKick : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) - u->SendMessage(BotServ, BOT_HELP_KICK); + source.Reply(BOT_HELP_KICK); else if (subcommand.equals_ci("BADWORDS")) - u->SendMessage(BotServ, BOT_HELP_KICK_BADWORDS); + source.Reply(BOT_HELP_KICK_BADWORDS); else if (subcommand.equals_ci("BOLDS")) - u->SendMessage(BotServ, BOT_HELP_KICK_BOLDS); + source.Reply(BOT_HELP_KICK_BOLDS); else if (subcommand.equals_ci("CAPS")) - u->SendMessage(BotServ, BOT_HELP_KICK_CAPS); + source.Reply(BOT_HELP_KICK_CAPS); else if (subcommand.equals_ci("COLORS")) - u->SendMessage(BotServ, BOT_HELP_KICK_COLORS); + source.Reply(BOT_HELP_KICK_COLORS); else if (subcommand.equals_ci("FLOOD")) - u->SendMessage(BotServ, BOT_HELP_KICK_FLOOD); + source.Reply(BOT_HELP_KICK_FLOOD); else if (subcommand.equals_ci("REPEAT")) - u->SendMessage(BotServ, BOT_HELP_KICK_REPEAT); + source.Reply(BOT_HELP_KICK_REPEAT); else if (subcommand.equals_ci("REVERSES")) - u->SendMessage(BotServ, BOT_HELP_KICK_REVERSES); + source.Reply(BOT_HELP_KICK_REVERSES); else if (subcommand.equals_ci("UNDERLINES")) - u->SendMessage(BotServ, BOT_HELP_KICK_UNDERLINES); + source.Reply(BOT_HELP_KICK_UNDERLINES); else if (subcommand.equals_ci("ITALICS")) - u->SendMessage(BotServ, BOT_HELP_KICK_ITALICS); + source.Reply(BOT_HELP_KICK_ITALICS); else return false; return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "KICK", BOT_KICK_SYNTAX); + SyntaxError(source, "KICK", BOT_KICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_KICK); + source.Reply(BOT_HELP_CMD_KICK); } }; diff --git a/modules/core/bs_say.cpp b/modules/core/bs_say.cpp index aedcf05e8..835b4e41d 100644 --- a/modules/core/bs_say.cpp +++ b/modules/core/bs_say.cpp @@ -47,7 +47,7 @@ class CommandBSSay : public Command if (text[0] == '\001') { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -60,20 +60,20 @@ class CommandBSSay : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_SAY); + source.Reply(BOT_HELP_SAY); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "SAY", BOT_SAY_SYNTAX); + SyntaxError(source, "SAY", BOT_SAY_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_SAY); + source.Reply(BOT_HELP_CMD_SAY); } }; diff --git a/modules/core/bs_set.cpp b/modules/core/bs_set.cpp index b9e06a4db..c6ed2f4bd 100644 --- a/modules/core/bs_set.cpp +++ b/modules/core/bs_set.cpp @@ -53,7 +53,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_PRIVATE_OFF, bi->nick.c_str()); } else - SyntaxError(BotServ, u, "SET PRIVATE", BOT_SET_PRIVATE_SYNTAX); + SyntaxError(source, "SET PRIVATE", BOT_SET_PRIVATE_SYNTAX); return MOD_CONT; } else if (!(ci = cs_findchan(chan))) @@ -78,7 +78,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_DONTKICKOPS_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET DONTKICKOPS", BOT_SET_DONTKICKOPS_SYNTAX); + SyntaxError(source, "SET DONTKICKOPS", BOT_SET_DONTKICKOPS_SYNTAX); } else if (option.equals_ci("DONTKICKVOICES")) { @@ -93,7 +93,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_DONTKICKVOICES_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET DONTKICKVOICES", BOT_SET_DONTKICKVOICES_SYNTAX); + SyntaxError(source, "SET DONTKICKVOICES", BOT_SET_DONTKICKVOICES_SYNTAX); } else if (option.equals_ci("FANTASY")) { @@ -108,7 +108,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_FANTASY_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET FANTASY", BOT_SET_FANTASY_SYNTAX); + SyntaxError(source, "SET FANTASY", BOT_SET_FANTASY_SYNTAX); } else if (option.equals_ci("GREET")) { @@ -123,7 +123,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_GREET_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET GREET", BOT_SET_GREET_SYNTAX); + SyntaxError(source, "SET GREET", BOT_SET_GREET_SYNTAX); } else if (u->Account()->HasCommand("botserv/set/nobot") && option.equals_ci("NOBOT")) { @@ -140,7 +140,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_NOBOT_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET NOBOT", BOT_SET_NOBOT_SYNTAX); + SyntaxError(source, "SET NOBOT", BOT_SET_NOBOT_SYNTAX); } else if (option.equals_ci("SYMBIOSIS")) { @@ -155,7 +155,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_SYMBIOSIS_OFF, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET SYMBIOSIS", BOT_SET_SYMBIOSIS_SYNTAX); + SyntaxError(source, "SET SYMBIOSIS", BOT_SET_SYMBIOSIS_SYNTAX); } else if (option.equals_ci("MSG")) { @@ -188,7 +188,7 @@ class CommandBSSet : public Command source.Reply(BOT_SET_MSG_NOTICEOPS, ci->name.c_str()); } else - SyntaxError(BotServ, u, "SET MSG", BOT_SET_MSG_SYNTAX); + SyntaxError(source, "SET MSG", BOT_SET_MSG_SYNTAX); } else source.Reply(BOT_SET_UNKNOWN, option.c_str()); @@ -197,44 +197,45 @@ class CommandBSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) { - u->SendMessage(BotServ, BOT_HELP_SET); + source.Reply(BOT_HELP_SET); + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(BotServ, BOT_SERVADMIN_HELP_SET); + source.Reply(BOT_SERVADMIN_HELP_SET); } else if (subcommand.equals_ci("DONTKICKOPS")) - u->SendMessage(BotServ, BOT_HELP_SET_DONTKICKOPS); + source.Reply(BOT_HELP_SET_DONTKICKOPS); else if (subcommand.equals_ci("DONTKICKVOICES")) - u->SendMessage(BotServ, BOT_HELP_SET_DONTKICKVOICES); + source.Reply(BOT_HELP_SET_DONTKICKVOICES); else if (subcommand.equals_ci("FANTASY")) - u->SendMessage(BotServ, BOT_HELP_SET_FANTASY); + source.Reply(BOT_HELP_SET_FANTASY); else if (subcommand.equals_ci("GREET")) - u->SendMessage(BotServ, BOT_HELP_SET_GREET); + source.Reply(BOT_HELP_SET_GREET); else if (subcommand.equals_ci("SYMBIOSIS")) - u->SendMessage(BotServ, BOT_HELP_SET_SYMBIOSIS, Config->s_ChanServ.c_str()); + source.Reply(BOT_HELP_SET_SYMBIOSIS, Config->s_ChanServ.c_str()); else if (subcommand.equals_ci("NOBOT")) - u->SendMessage(BotServ, BOT_SERVADMIN_HELP_SET_NOBOT); + source.Reply(BOT_SERVADMIN_HELP_SET_NOBOT); else if (subcommand.equals_ci("PRIVATE")) - u->SendMessage(BotServ, BOT_SERVADMIN_HELP_SET_PRIVATE); + source.Reply(BOT_SERVADMIN_HELP_SET_PRIVATE); else if (subcommand.equals_ci("MSG")) - u->SendMessage(BotServ, BOT_HELP_SET_MSG); + source.Reply(BOT_HELP_SET_MSG); else return false; return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "SET", BOT_SET_SYNTAX); + SyntaxError(source, "SET", BOT_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_SET); + source.Reply(BOT_HELP_CMD_SET); } }; diff --git a/modules/core/bs_unassign.cpp b/modules/core/bs_unassign.cpp index b1962c51f..1f46c6863 100644 --- a/modules/core/bs_unassign.cpp +++ b/modules/core/bs_unassign.cpp @@ -46,20 +46,20 @@ class CommandBSUnassign : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(BotServ, BOT_HELP_UNASSIGN); + source.Reply(BOT_HELP_UNASSIGN); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(BotServ, u, "UNASSIGN", BOT_UNASSIGN_SYNTAX); + SyntaxError(source, "UNASSIGN", BOT_UNASSIGN_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(BotServ, BOT_HELP_CMD_UNASSIGN); + source.Reply(BOT_HELP_CMD_UNASSIGN); } }; diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp index 2878efbfe..96856da60 100644 --- a/modules/core/cs_access.cpp +++ b/modules/core/cs_access.cpp @@ -237,7 +237,7 @@ class CommandCSAccess : public Command FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, nc, level)); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << na->nick << " (group: " << nc->display << ") (level: " << level << ") as level " << ulev; - u->SendMessage(ChanServ, CHAN_ACCESS_ADDED, nc->display.c_str(), ci->name.c_str(), level); + source.Reply(CHAN_ACCESS_ADDED, nc->display.c_str(), ci->name.c_str(), level); return MOD_CONT; } @@ -436,7 +436,7 @@ class CommandCSAccess : public Command * If DEL, we require a nick and no level. * Else (ADD), we require a level (which implies a nick). */ if (is_list || is_clear ? 0 : (cmd.equals_ci("DEL") ? (nick.empty() || !s.empty()) : s.empty())) - this->OnSyntaxError(u, cmd); + this->OnSyntaxError(source, cmd); else if (!has_access) source.Reply(ACCESS_DENIED); /* We still allow LIST and CLEAR in xOP mode, but not others */ @@ -460,21 +460,21 @@ class CommandCSAccess : public Command else if (cmd.equals_ci("CLEAR")) this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_ACCESS); - u->SendMessage(ChanServ, CHAN_HELP_ACCESS_LEVELS); + source.Reply(CHAN_HELP_ACCESS); + source.Reply(CHAN_HELP_ACCESS_LEVELS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "ACCESS", CHAN_ACCESS_SYNTAX); + SyntaxError(source, "ACCESS", CHAN_ACCESS_SYNTAX); } }; @@ -500,7 +500,7 @@ class CommandCSLevels : public Command } if (!error.empty()) - this->OnSyntaxError(u, "SET"); + this->OnSyntaxError(source, "SET"); else if (level <= ACCESS_INVALID || level > ACCESS_FOUNDER) source.Reply(CHAN_LEVELS_RANGE, ACCESS_INVALID + 1, ACCESS_FOUNDER - 1); else @@ -602,7 +602,7 @@ class CommandCSLevels : public Command bool override = !check_access(u, ci, CA_FOUNDER); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "RESET"; - u->SendMessage(ChanServ, CHAN_LEVELS_RESET, ci->name.c_str()); + source.Reply(CHAN_LEVELS_RESET, ci->name.c_str()); return MOD_CONT; } @@ -624,7 +624,7 @@ class CommandCSLevels : public Command * one; else, we want none. */ if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty())) - this->OnSyntaxError(u, cmd); + this->OnSyntaxError(source, cmd); else if (ci->HasFlag(CI_XOP)) source.Reply(CHAN_LEVELS_XOP); else if (!check_access(u, ci, CA_FOUNDER) && !u->Account()->HasPriv("chanserv/access/modify")) @@ -638,17 +638,17 @@ class CommandCSLevels : public Command else if (cmd.equals_ci("RESET")) this->DoReset(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.equals_ci("DESC")) { int i; - u->SendMessage(ChanServ, CHAN_HELP_LEVELS_DESC); + source.Reply(CHAN_HELP_LEVELS_DESC); if (!levelinfo_maxwidth) for (i = 0; levelinfo[i].what >= 0; ++i) { @@ -657,22 +657,22 @@ class CommandCSLevels : public Command levelinfo_maxwidth = len; } for (i = 0; levelinfo[i].what >= 0; ++i) - u->SendMessage(ChanServ, CHAN_HELP_LEVELS_DESC_FORMAT, levelinfo_maxwidth, levelinfo[i].name.c_str(), GetString(u, levelinfo[i].desc).c_str()); + source.Reply(CHAN_HELP_LEVELS_DESC_FORMAT, levelinfo_maxwidth, levelinfo[i].name.c_str(), GetString(source.u, levelinfo[i].desc).c_str()); } else - u->SendMessage(ChanServ, CHAN_HELP_LEVELS); + source.Reply(CHAN_HELP_LEVELS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); + SyntaxError(source, "LEVELS", CHAN_LEVELS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_ACCESS); - u->SendMessage(ChanServ, CHAN_HELP_CMD_LEVELS); + source.Reply(CHAN_HELP_CMD_ACCESS); + source.Reply(CHAN_HELP_CMD_LEVELS); } }; diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index a9bf53270..4df83d121 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -450,7 +450,7 @@ class CommandCSAKick : public Command bool override = !check_access(u, ci, CA_AKICK); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ENFORCE, affects " << count << " users"; - u->SendMessage(ChanServ, CHAN_AKICK_ENFORCE_DONE, ci->name.c_str(), count); + source.Reply(CHAN_AKICK_ENFORCE_DONE, ci->name.c_str(), count); } void DoClear(CommandSource &source) @@ -461,7 +461,7 @@ class CommandCSAKick : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "CLEAR"; ci->ClearAkick(); - u->SendMessage(ChanServ, CHAN_AKICK_CLEAR, ci->name.c_str()); + source.Reply(CHAN_AKICK_CLEAR, ci->name.c_str()); } public: @@ -479,7 +479,7 @@ class CommandCSAKick : public Command ChannelInfo *ci = source.ci; if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL"))) - this->OnSyntaxError(u, cmd); + this->OnSyntaxError(source, cmd); else if (!check_access(u, ci, CA_AKICK) && !u->Account()->HasPriv("chanserv/access/modify")) source.Reply(ACCESS_DENIED); else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && readonly) @@ -497,25 +497,25 @@ class CommandCSAKick : public Command else if (cmd.equals_ci("CLEAR")) this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_AKICK); + source.Reply(CHAN_HELP_AKICK); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "AKICK", CHAN_AKICK_SYNTAX); + SyntaxError(source, "AKICK", CHAN_AKICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_AKICK); + source.Reply(CHAN_HELP_CMD_AKICK); } }; diff --git a/modules/core/cs_ban.cpp b/modules/core/cs_ban.cpp index 25cc36946..bbcfd1325 100644 --- a/modules/core/cs_ban.cpp +++ b/modules/core/cs_ban.cpp @@ -72,20 +72,20 @@ class CommandCSBan : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_BAN); + source.Reply(CHAN_HELP_BAN); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "BAN", CHAN_BAN_SYNTAX); + SyntaxError(source, "BAN", CHAN_BAN_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_BAN); + source.Reply(CHAN_HELP_CMD_BAN); } }; diff --git a/modules/core/cs_clearusers.cpp b/modules/core/cs_clearusers.cpp index 316513200..29a57566a 100644 --- a/modules/core/cs_clearusers.cpp +++ b/modules/core/cs_clearusers.cpp @@ -44,25 +44,25 @@ class CommandCSClearUsers : public Command c->Kick(NULL, uc->user, "%s", buf.c_str()); } - u->SendMessage(ChanServ, CHAN_CLEARED_USERS, chan.c_str()); + source.Reply(CHAN_CLEARED_USERS, chan.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_CLEARUSERS); + source.Reply(CHAN_HELP_CLEARUSERS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "CLEAR", CHAN_CLEARUSERS_SYNTAX); + SyntaxError(source, "CLEAR", CHAN_CLEARUSERS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_CLEARUSERS); + source.Reply(CHAN_HELP_CMD_CLEARUSERS); } }; diff --git a/modules/core/cs_clone.cpp b/modules/core/cs_clone.cpp index 6365b41a3..b36d75dc5 100644 --- a/modules/core/cs_clone.cpp +++ b/modules/core/cs_clone.cpp @@ -140,7 +140,7 @@ public: } else { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -149,20 +149,20 @@ public: return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_CLONE); + source.Reply(CHAN_HELP_CLONE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "CLONE", CHAN_CLONE_SYNTAX); + SyntaxError(source, "CLONE", CHAN_CLONE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_CLONE); + source.Reply(CHAN_HELP_CMD_CLONE); } }; diff --git a/modules/core/cs_drop.cpp b/modules/core/cs_drop.cpp index 453f819fe..18d45c55c 100644 --- a/modules/core/cs_drop.cpp +++ b/modules/core/cs_drop.cpp @@ -71,31 +71,32 @@ class CommandCSDrop : public Command delete ci; - u->SendMessage(ChanServ, CHAN_DROPPED, chan.c_str()); + source.Reply(CHAN_DROPPED, chan.c_str()); FOREACH_MOD(I_OnChanDrop, OnChanDrop(chan)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_DROP); + source.Reply(CHAN_SERVADMIN_HELP_DROP); else - u->SendMessage(ChanServ, CHAN_HELP_DROP); + source.Reply(CHAN_HELP_DROP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DROP", CHAN_DROP_SYNTAX); + SyntaxError(source, "DROP", CHAN_DROP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DROP); + source.Reply(CHAN_HELP_CMD_DROP); } }; diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp index 669f6f5e7..19f4b6f04 100644 --- a/modules/core/cs_forbid.cpp +++ b/modules/core/cs_forbid.cpp @@ -31,7 +31,7 @@ class CommandCSForbid : public Command if (Config->ForceForbidReason && reason.empty()) { - SyntaxError(ChanServ, u, "FORBID", CHAN_FORBID_SYNTAX_REASON); + SyntaxError(source, "FORBID", CHAN_FORBID_SYNTAX_REASON); return MOD_CONT; } @@ -88,27 +88,27 @@ class CommandCSForbid : public Command ircdproto->SendGlobops(ChanServ, "\2%s\2 used FORBID on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); Log(LOG_ADMIN, u, this, ci) << (!ci->forbidreason.empty() ? ci->forbidreason : "No reason"); - u->SendMessage(ChanServ, CHAN_FORBID_SUCCEEDED, chan.c_str()); + source.Reply(CHAN_FORBID_SUCCEEDED, chan.c_str()); FOREACH_MOD(I_OnChanForbidden, OnChanForbidden(ci)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_FORBID); + source.Reply(CHAN_SERVADMIN_HELP_FORBID); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "FORBID", CHAN_FORBID_SYNTAX); + SyntaxError(source, "FORBID", CHAN_FORBID_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_FORBID); + source.Reply(CHAN_HELP_CMD_FORBID); } }; diff --git a/modules/core/cs_getkey.cpp b/modules/core/cs_getkey.cpp index 09cc40c45..f043bfd8b 100644 --- a/modules/core/cs_getkey.cpp +++ b/modules/core/cs_getkey.cpp @@ -43,24 +43,24 @@ class CommandCSGetKey : public Command bool override = !check_access(u, ci, CA_GETKEY); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci); - u->SendMessage(ChanServ, CHAN_GETKEY_KEY, chan.c_str(), key.c_str()); + source.Reply(CHAN_GETKEY_KEY, chan.c_str(), key.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_GETKEY); + source.Reply(CHAN_HELP_GETKEY); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "GETKEY", CHAN_GETKEY_SYNTAX); + SyntaxError(source, "GETKEY", CHAN_GETKEY_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_GETKEY); + source.Reply(CHAN_HELP_CMD_GETKEY); } }; diff --git a/modules/core/cs_help.cpp b/modules/core/cs_help.cpp index 9d7fcd300..f004f5bb9 100644 --- a/modules/core/cs_help.cpp +++ b/modules/core/cs_help.cpp @@ -24,21 +24,22 @@ class CommandCSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - mod_help_cmd(ChanServ, source.u, params[0]); + mod_help_cmd(ChanServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP); + User *u = source.u; + source.Reply(CHAN_HELP); for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); + it->second->OnServHelp(source); if (Config->CSExpire >= 86400) - u->SendMessage(ChanServ, CHAN_HELP_EXPIRES, Config->CSExpire / 86400); + source.Reply(CHAN_HELP_EXPIRES, Config->CSExpire / 86400); if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP); + source.Reply(CHAN_SERVADMIN_HELP); } }; diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index fdf160310..7f4784270 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -58,15 +58,15 @@ class CommandCSInfo : public Command if (has_auspex || check_access(u, ci, CA_INFO)) show_all = true; - u->SendMessage(ChanServ, CHAN_INFO_HEADER, chan.c_str()); - u->SendMessage(ChanServ, CHAN_INFO_NO_FOUNDER, ci->founder->display.c_str()); + source.Reply(CHAN_INFO_HEADER, chan.c_str()); + source.Reply(CHAN_INFO_NO_FOUNDER, ci->founder->display.c_str()); if (show_all && ci->successor) source.Reply(CHAN_INFO_NO_SUCCESSOR, ci->successor->display.c_str()); - u->SendMessage(ChanServ, CHAN_INFO_DESCRIPTION, ci->desc.c_str()); - u->SendMessage(ChanServ, CHAN_INFO_TIME_REGGED, do_strftime(ci->time_registered).c_str()); - u->SendMessage(ChanServ, CHAN_INFO_LAST_USED, do_strftime(ci->last_used).c_str()); + source.Reply(CHAN_INFO_DESCRIPTION, ci->desc.c_str()); + source.Reply(CHAN_INFO_TIME_REGGED, do_strftime(ci->time_registered).c_str()); + source.Reply(CHAN_INFO_LAST_USED, do_strftime(ci->last_used).c_str()); ModeLock *secret = ci->GetMLock(CMODE_SECRET); if (!ci->last_topic.empty() && (show_all || ((!secret || secret->set == false) && (!ci->c || !ci->c->HasMode(CMODE_SECRET))))) @@ -113,21 +113,21 @@ class CommandCSInfo : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_INFO); + source.Reply(CHAN_HELP_INFO); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "INFO", CHAN_INFO_SYNTAX); + SyntaxError(source, "INFO", CHAN_INFO_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_INFO); + source.Reply(CHAN_HELP_CMD_INFO); } }; diff --git a/modules/core/cs_invite.cpp b/modules/core/cs_invite.cpp index 7bb7544e0..8e83854b0 100644 --- a/modules/core/cs_invite.cpp +++ b/modules/core/cs_invite.cpp @@ -68,20 +68,20 @@ class CommandCSInvite : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_INVITE); + source.Reply(CHAN_HELP_INVITE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "INVITE", CHAN_INVITE_SYNTAX); + SyntaxError(source, "INVITE", CHAN_INVITE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_INVITE); + source.Reply(CHAN_HELP_CMD_INVITE); } }; diff --git a/modules/core/cs_kick.cpp b/modules/core/cs_kick.cpp index d02ae36a5..8a2dd8b04 100644 --- a/modules/core/cs_kick.cpp +++ b/modules/core/cs_kick.cpp @@ -58,20 +58,20 @@ class CommandCSKick : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_KICK); + source.Reply(CHAN_HELP_KICK); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "KICK", CHAN_KICK_SYNTAX); + SyntaxError(source, "KICK", CHAN_KICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_KICK); + source.Reply(CHAN_HELP_CMD_KICK); } }; diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp index 613cc55f4..87d0afb79 100644 --- a/modules/core/cs_list.cpp +++ b/modules/core/cs_list.cpp @@ -91,7 +91,7 @@ public: Anope::string spattern = "#" + pattern; - u->SendMessage(ChanServ, NICK_LIST_HEADER, pattern.c_str()); + source.Reply(NICK_LIST_HEADER, pattern.c_str()); for (registered_channel_map::const_iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it) { @@ -127,24 +127,24 @@ public: } } - u->SendMessage(ChanServ, CHAN_LIST_END, nchans > Config->CSListMax ? Config->CSListMax : nchans, nchans); + source.Reply(CHAN_LIST_END, nchans > Config->CSListMax ? Config->CSListMax : nchans, nchans); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_LIST); + source.Reply(CHAN_HELP_LIST); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "LIST", NICK_LIST_SYNTAX); + SyntaxError(source, "LIST", NICK_LIST_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_LIST); + source.Reply(CHAN_HELP_CMD_LIST); } }; diff --git a/modules/core/cs_mode.cpp b/modules/core/cs_mode.cpp index 93b358386..ea63d8419 100644 --- a/modules/core/cs_mode.cpp +++ b/modules/core/cs_mode.cpp @@ -137,7 +137,7 @@ class CommandCSMode : public Command } } else - this->OnSyntaxError(u, subcommand); + this->OnSyntaxError(source, subcommand); } void DoSet(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -273,25 +273,25 @@ class CommandCSMode : public Command else if (subcommand.equals_ci("SET")) this->DoSet(source, params); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_MODE); + source.Reply(CHAN_HELP_MODE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "MODE", CHAN_MODE_SYNTAX); + SyntaxError(source, "MODE", CHAN_MODE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_MODE); + source.Reply(CHAN_HELP_CMD_MODE); } }; diff --git a/modules/core/cs_modes.cpp b/modules/core/cs_modes.cpp index 7fffdc193..86e1193ef 100644 --- a/modules/core/cs_modes.cpp +++ b/modules/core/cs_modes.cpp @@ -14,7 +14,7 @@ #include "module.h" /** do_util: not a command, but does the job of others - * @param u The user doing the command + * @param source The source of the command * @param com The command calling this function * @param cm A channel mode class * @param chan The channel its being set on @@ -25,8 +25,9 @@ * @param name The name, eg "OP" or "HALFOP" * @param notice Flag required on a channel to send a notice */ -static CommandReturn do_util(User *u, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, int level, int levelself, const Anope::string &name, ChannelInfoFlag notice) +static CommandReturn do_util(CommandSource &source, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, int level, int levelself, const Anope::string &name, ChannelInfoFlag notice) { + User *u = source.u; Channel *c = findchan(chan); ChannelInfo *ci = c ? c->ci : NULL; User *u2; @@ -35,17 +36,17 @@ static CommandReturn do_util(User *u, Command *com, ChannelMode *cm, const Anope bool is_same = u->nick.equals_ci(realnick); if (!c) - u->SendMessage(ChanServ, CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); else if (is_same ? !(u2 = u) : !(u2 = finduser(realnick))) - u->SendMessage(ChanServ, NICK_X_NOT_IN_USE, realnick.c_str()); + source.Reply(NICK_X_NOT_IN_USE, realnick.c_str()); else if (is_same ? !check_access(u, ci, levelself) : !check_access(u, ci, level)) - u->SendMessage(ChanServ, ACCESS_DENIED); + source.Reply(ACCESS_DENIED); else if (!set && !is_same && (ci->HasFlag(CI_PEACE)) && (get_access(u2, ci) >= get_access(u, ci))) - u->SendMessage(ChanServ, ACCESS_DENIED); + source.Reply(ACCESS_DENIED); else if (!set && u2->IsProtected() && !is_same) - u->SendMessage(ChanServ, ACCESS_DENIED); + source.Reply(ACCESS_DENIED); else if (!c->FindUser(u2)) - u->SendMessage(ChanServ, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str()); + source.Reply(NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str()); else { if (set) @@ -70,26 +71,25 @@ class CommandCSOp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_OP); - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_OPDEOP, CA_OPDEOPME, "OP", CI_OPNOTICE); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_OPDEOP, CA_OPDEOPME, "OP", CI_OPNOTICE); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_OP); + source.Reply(CHAN_HELP_OP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "OP", CHAN_OP_SYNTAX); + SyntaxError(source, "OP", CHAN_OP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_OP); + source.Reply(CHAN_HELP_CMD_OP); } }; @@ -102,26 +102,25 @@ class CommandCSDeOp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_OP); - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_OPDEOP, CA_OPDEOPME, "DEOP", CI_OPNOTICE); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_OPDEOP, CA_OPDEOPME, "DEOP", CI_OPNOTICE); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_DEOP); + source.Reply(CHAN_HELP_DEOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DEOP", CHAN_DEOP_SYNTAX); + SyntaxError(source, "DEOP", CHAN_DEOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DEOP); + source.Reply(CHAN_HELP_CMD_DEOP); } }; @@ -134,26 +133,25 @@ class CommandCSVoice : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_VOICE); - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_VOICE, CA_VOICEME, "VOICE", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_VOICE, CA_VOICEME, "VOICE", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_VOICE); + source.Reply(CHAN_HELP_VOICE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "VOICE", CHAN_VOICE_SYNTAX); + SyntaxError(source, "VOICE", CHAN_VOICE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_VOICE); + source.Reply(CHAN_HELP_CMD_VOICE); } }; @@ -166,26 +164,25 @@ class CommandCSDeVoice : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_VOICE); - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_VOICE, CA_VOICEME, "DEVOICE", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_VOICE, CA_VOICEME, "DEVOICE", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_DEVOICE); + source.Reply(CHAN_HELP_DEVOICE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DEVOICE", CHAN_DEVOICE_SYNTAX); + SyntaxError(source, "DEVOICE", CHAN_DEVOICE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DEVOICE); + source.Reply(CHAN_HELP_CMD_DEVOICE); } }; @@ -198,29 +195,28 @@ class CommandCSHalfOp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_HALFOP); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_HALFOP, CA_HALFOPME, "HALFOP", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_HALFOP, CA_HALFOPME, "HALFOP", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_HALFOP); + source.Reply(CHAN_HELP_HALFOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "HALFOP", CHAN_HALFOP_SYNTAX); + SyntaxError(source, "HALFOP", CHAN_HALFOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_HALFOP); + source.Reply(CHAN_HELP_CMD_HALFOP); } }; @@ -233,29 +229,28 @@ class CommandCSDeHalfOp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_HALFOP); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_HALFOP, CA_HALFOPME, "DEHALFOP", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_HALFOP, CA_HALFOPME, "DEHALFOP", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_DEHALFOP); + source.Reply(CHAN_HELP_DEHALFOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DEHALFOP", CHAN_DEHALFOP_SYNTAX); + SyntaxError(source, "DEHALFOP", CHAN_DEHALFOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DEHALFOP); + source.Reply(CHAN_HELP_CMD_DEHALFOP); } }; @@ -268,29 +263,28 @@ class CommandCSProtect : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PROTECT); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_PROTECT, CA_PROTECTME, "PROTECT", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_PROTECT, CA_PROTECTME, "PROTECT", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_PROTECT); + source.Reply(CHAN_HELP_PROTECT); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "PROTECT", CHAN_PROTECT_SYNTAX); + SyntaxError(source, "PROTECT", CHAN_PROTECT_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_PROTECT); + source.Reply(CHAN_HELP_CMD_PROTECT); } }; @@ -303,29 +297,28 @@ class CommandCSDeProtect : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PROTECT); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_PROTECT, CA_PROTECTME, "DEPROTECT", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_PROTECT, CA_PROTECTME, "DEPROTECT", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_DEPROTECT); + source.Reply(CHAN_HELP_DEPROTECT); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DEPROTECT", CHAN_DEPROTECT_SYNTAX); + SyntaxError(source, "DEPROTECT", CHAN_DEPROTECT_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DEPROTECT); + source.Reply(CHAN_HELP_CMD_DEPROTECT); } }; @@ -338,29 +331,28 @@ class CommandCSOwner : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_OWNER); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_OWNER, CA_OWNERME, "OWNER", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", true, CA_OWNER, CA_OWNERME, "OWNER", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_OWNER); + source.Reply(CHAN_HELP_OWNER); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "OWNER", CHAN_OWNER_SYNTAX); + SyntaxError(source, "OWNER", CHAN_OWNER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_OWNER); + source.Reply(CHAN_HELP_CMD_OWNER); } }; @@ -373,29 +365,28 @@ class CommandCSDeOwner : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_OWNER); if (!cm) return MOD_CONT; - return do_util(u, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_OWNER, CA_OWNERME, "DEOWNER", CI_BEGIN); + return do_util(source, this, cm, params[0], params.size() > 1 ? params[1] : "", false, CA_OWNER, CA_OWNERME, "DEOWNER", CI_BEGIN); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_DEOWNER); + source.Reply(CHAN_HELP_DEOWNER); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "DEOWNER", CHAN_DEOWNER_SYNTAX); + SyntaxError(source, "DEOWNER", CHAN_DEOWNER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_DEOWNER); + source.Reply(CHAN_HELP_CMD_DEOWNER); } }; diff --git a/modules/core/cs_register.cpp b/modules/core/cs_register.cpp index 940c534b5..39155fe84 100644 --- a/modules/core/cs_register.cpp +++ b/modules/core/cs_register.cpp @@ -96,15 +96,15 @@ class CommandCSRegister : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_REGISTER, Config->s_ChanServ.c_str()); + source.Reply(CHAN_HELP_REGISTER, Config->s_ChanServ.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "REGISTER", CHAN_REGISTER_SYNTAX); + SyntaxError(source, "REGISTER", CHAN_REGISTER_SYNTAX); } }; diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index 70588b4bb..a8ffdce11 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -65,14 +65,14 @@ class CommandCSSASet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) { - u->SendMessage(ChanServ, CHAN_HELP_SASET_HEAD); + source.Reply(CHAN_HELP_SASET_HEAD); for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - it->second->OnServHelp(u); - u->SendMessage(ChanServ, CHAN_HELP_SASET_TAIL); + it->second->OnServHelp(source); + source.Reply(CHAN_HELP_SASET_TAIL); return true; } else @@ -80,20 +80,20 @@ class CommandCSSASet : public Command Command *c = this->FindCommand(subcommand); if (c) - return c->OnHelp(u, subcommand); + return c->OnHelp(source, subcommand); } return false; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SASET); + source.Reply(CHAN_HELP_CMD_SASET); } bool AddSubcommand(Command *c) diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index 0e2a47177..448137c8d 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -22,7 +22,6 @@ class CommandCSSASetNoexpire : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSASetNoexpire"); @@ -38,25 +37,25 @@ class CommandCSSASetNoexpire : public Command source.Reply(CHAN_SET_NOEXPIRE_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "NOEXPIRE"); + this->OnSyntaxError(source, "NOEXPIRE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_SET_NOEXPIRE); + source.Reply(CHAN_SERVADMIN_HELP_SET_NOEXPIRE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET NOEXPIRE", CHAN_SET_NOEXPIRE_SYNTAX); + SyntaxError(source, "SET NOEXPIRE", CHAN_SET_NOEXPIRE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_NOEXPIRE); + source.Reply(CHAN_HELP_CMD_SET_NOEXPIRE); } }; diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index 84cedbf26..7fa2895b3 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -69,14 +69,14 @@ class CommandCSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) { - u->SendMessage(ChanServ, CHAN_HELP_SET_HEAD); + source.Reply(CHAN_HELP_SET_HEAD); for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - it->second->OnServHelp(u); - u->SendMessage(ChanServ, CHAN_HELP_SET_TAIL); + it->second->OnServHelp(source); + source.Reply(CHAN_HELP_SET_TAIL); return true; } else @@ -84,20 +84,20 @@ class CommandCSSet : public Command Command *c = this->FindCommand(subcommand); if (c) - return c->OnHelp(u, subcommand); + return c->OnHelp(source, subcommand); } return false; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET); + source.Reply(CHAN_HELP_CMD_SET); } bool AddSubcommand(Command *c) diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 0670f971c..2e7c14052 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -41,21 +41,21 @@ class CommandCSSetBanType : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_BANTYPE, "SET"); + source.Reply(CHAN_HELP_SET_BANTYPE, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_BANTYPE); + source.Reply(CHAN_HELP_CMD_SET_BANTYPE); } }; @@ -66,16 +66,16 @@ class CommandCSSASetBanType : public CommandCSSetBanType { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_BANTYPE, "SASET"); + source.Reply(CHAN_HELP_SET_BANTYPE, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } }; diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index b4d13b92c..4dff9283f 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -22,33 +22,32 @@ class CommandCSSetDescription : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetDescription"); ci->desc = params[1]; - u->SendMessage(ChanServ, CHAN_DESC_CHANGED, ci->name.c_str(), ci->desc.c_str()); + source.Reply(CHAN_DESC_CHANGED, ci->name.c_str(), ci->desc.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_DESC, "SET"); + source.Reply(CHAN_HELP_SET_DESC, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_DESC); + source.Reply(CHAN_HELP_CMD_SET_DESC); } }; @@ -59,16 +58,16 @@ class CommandCSSASetDescription : public CommandCSSetDescription { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_DESC, "SASET"); + source.Reply(CHAN_HELP_SET_DESC, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } }; diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index 3cb4c114f..4e347b8bb 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -64,26 +64,26 @@ class CommandCSSetFounder : public Command ci->founder = nc; ++nc->channelcount; - u->SendMessage(ChanServ, CHAN_FOUNDER_CHANGED, ci->name.c_str(), na->nick.c_str()); + source.Reply(CHAN_FOUNDER_CHANGED, ci->name.c_str(), na->nick.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_FOUNDER, "SET"); + source.Reply(CHAN_HELP_SET_FOUNDER, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_FOUNDER); + source.Reply(CHAN_HELP_CMD_SET_FOUNDER); } }; @@ -94,16 +94,16 @@ class CommandCSSASetFounder : public CommandCSSetFounder { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_FOUNDER, "SASET"); + source.Reply(CHAN_HELP_SET_FOUNDER, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } }; diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index d208736d6..81749e60a 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -22,7 +22,6 @@ class CommandCSSetKeepTopic : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetKeepTopic"); @@ -38,25 +37,25 @@ class CommandCSSetKeepTopic : public Command source.Reply(CHAN_SET_KEEPTOPIC_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "KEEPTOPIC"); + this->OnSyntaxError(source, "KEEPTOPIC"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_KEEPTOPIC, "SET"); + source.Reply(CHAN_HELP_SET_KEEPTOPIC, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET KEEPTOPIC", CHAN_SET_KEEPTOPIC_SYNTAX); + SyntaxError(source, "SET KEEPTOPIC", CHAN_SET_KEEPTOPIC_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_KEEPTOPIC); + source.Reply(CHAN_HELP_CMD_SET_KEEPTOPIC); } }; @@ -67,15 +66,15 @@ class CommandCSSASetKeepTopic : public CommandCSSetKeepTopic { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_KEEPTOPIC, "SASET"); + source.Reply(CHAN_HELP_SET_KEEPTOPIC, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET KEEPTOPIC", CHAN_SASET_KEEPTOPIC_SYNTAX); + SyntaxError(source, "SET KEEPTOPIC", CHAN_SASET_KEEPTOPIC_SYNTAX); } }; diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index e02c0d8d9..9a323cb17 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -22,7 +22,6 @@ class CommandCSSetOpNotice : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetOpNotice"); @@ -38,25 +37,25 @@ class CommandCSSetOpNotice : public Command source.Reply(CHAN_SET_OPNOTICE_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "OPNOTICE"); + this->OnSyntaxError(source, "OPNOTICE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_OPNOTICE, "SET"); + source.Reply(CHAN_HELP_SET_OPNOTICE, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET OPNOTICE", CHAN_SET_OPNOTICE_SYNTAX); + SyntaxError(source, "SET OPNOTICE", CHAN_SET_OPNOTICE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_OPNOTICE); + source.Reply(CHAN_HELP_CMD_SET_OPNOTICE); } }; @@ -67,15 +66,15 @@ class CommandCSSASetOpNotice : public CommandCSSetOpNotice { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_OPNOTICE, "SASET"); + source.Reply(CHAN_HELP_SET_OPNOTICE, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET OPNOTICE", CHAN_SASET_OPNOTICE_SYNTAX); + SyntaxError(source, "SET OPNOTICE", CHAN_SASET_OPNOTICE_SYNTAX); } }; diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index a21d0e51f..f083faabb 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -22,7 +22,6 @@ class CommandCSSetPeace : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetPeace"); @@ -38,25 +37,25 @@ class CommandCSSetPeace : public Command source.Reply(CHAN_SET_PEACE_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "PEACE"); + this->OnSyntaxError(source, "PEACE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PEACE, "SET"); + source.Reply(CHAN_HELP_SET_PEACE, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET PEACE", CHAN_SET_PEACE_SYNTAX); + SyntaxError(source, "SET PEACE", CHAN_SET_PEACE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_PEACE, "SET"); + source.Reply(CHAN_HELP_CMD_SET_PEACE, "SET"); } }; @@ -67,15 +66,15 @@ class CommandCSSASetPeace : public CommandCSSetPeace { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PEACE, "SASET"); + source.Reply(CHAN_HELP_SET_PEACE, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET PEACE", CHAN_SASET_PEACE_SYNTAX); + SyntaxError(source, "SASET PEACE", CHAN_SASET_PEACE_SYNTAX); } }; diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index a3ca57517..a1df366ec 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -22,7 +22,6 @@ class CommandCSSetPersist : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetPersist"); @@ -96,25 +95,25 @@ class CommandCSSetPersist : public Command source.Reply(CHAN_SET_PERSIST_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "PERSIST"); + this->OnSyntaxError(source, "PERSIST"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PERSIST, "SET"); + source.Reply(CHAN_HELP_SET_PERSIST, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET PERSIST", CHAN_SET_PERSIST_SYNTAX); + SyntaxError(source, "SET PERSIST", CHAN_SET_PERSIST_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_PERSIST); + source.Reply(CHAN_HELP_CMD_SET_PERSIST); } }; @@ -125,15 +124,15 @@ class CommandCSSASetPersist : public CommandCSSetPersist { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PERSIST, "SASET"); + source.Reply(CHAN_HELP_SET_PERSIST, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET PERSIST", CHAN_SASET_PERSIST_SYNTAX); + SyntaxError(source, "SASET PERSIST", CHAN_SASET_PERSIST_SYNTAX); } }; diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index 1199dbfad..f3a6e69d8 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -22,7 +22,6 @@ class CommandCSSetPrivate : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetPrivate"); @@ -38,25 +37,25 @@ class CommandCSSetPrivate : public Command source.Reply(CHAN_SET_PRIVATE_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "PRIVATE"); + this->OnSyntaxError(source, "PRIVATE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PRIVATE, "SASET"); + source.Reply(CHAN_HELP_SET_PRIVATE, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET PRIVATE", CHAN_SET_PRIVATE_SYNTAX); + SyntaxError(source, "SET PRIVATE", CHAN_SET_PRIVATE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_PRIVATE); + source.Reply(CHAN_HELP_CMD_SET_PRIVATE); } }; @@ -67,15 +66,15 @@ class CommandCSSASetPrivate : public CommandCSSetPrivate { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_PRIVATE, "SASET"); + source.Reply(CHAN_HELP_SET_PRIVATE, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET PRIVATE", CHAN_SASET_PRIVATE_SYNTAX); + SyntaxError(source, "SASET PRIVATE", CHAN_SASET_PRIVATE_SYNTAX); } }; diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index 482e6e137..6aaa203ae 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -21,7 +21,6 @@ class CommandCSSetRestricted : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetRestricted"); @@ -41,25 +40,25 @@ class CommandCSSetRestricted : public Command source.Reply(CHAN_SET_RESTRICTED_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "RESTRICTED"); + this->OnSyntaxError(source, "RESTRICTED"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_RESTRICTED, "SET"); + source.Reply(CHAN_HELP_SET_RESTRICTED, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET RESTRICTED", CHAN_SET_RESTRICTED_SYNTAX); + SyntaxError(source, "SET RESTRICTED", CHAN_SET_RESTRICTED_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_RESTRICTED); + source.Reply(CHAN_HELP_CMD_SET_RESTRICTED); } }; @@ -70,15 +69,15 @@ class CommandCSSASetRestricted : public CommandCSSetRestricted { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_RESTRICTED, "SASET"); + source.Reply(CHAN_HELP_SET_RESTRICTED, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET RESTRICTED", CHAN_SASET_RESTRICTED_SYNTAX); + SyntaxError(source, "SASET RESTRICTED", CHAN_SASET_RESTRICTED_SYNTAX); } }; diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp index 8fa6c533e..ac8aea3d1 100644 --- a/modules/core/cs_set_secure.cpp +++ b/modules/core/cs_set_secure.cpp @@ -22,7 +22,6 @@ class CommandCSSetSecure : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetSecure"); @@ -38,25 +37,25 @@ class CommandCSSetSecure : public Command source.Reply(CHAN_SET_SECURE_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "SECURE"); + this->OnSyntaxError(source, "SECURE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECURE, "SET", Config->s_NickServ.c_str()); + source.Reply(CHAN_HELP_SET_SECURE, "SET", Config->s_NickServ.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET SECURE", CHAN_SET_SECURE_SYNTAX); + SyntaxError(source, "SET SECURE", CHAN_SET_SECURE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_SECURE); + source.Reply(CHAN_HELP_CMD_SET_SECURE); } }; @@ -67,15 +66,15 @@ class CommandCSSASetSecure : public CommandCSSetSecure { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECURE, "SASET", Config->s_NickServ.c_str()); + source.Reply(CHAN_HELP_SET_SECURE, "SASET", Config->s_NickServ.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET SECURE", CHAN_SASET_SECURE_SYNTAX); + SyntaxError(source, "SASET SECURE", CHAN_SASET_SECURE_SYNTAX); } }; diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp index ec9716e50..a4efa2041 100644 --- a/modules/core/cs_set_securefounder.cpp +++ b/modules/core/cs_set_securefounder.cpp @@ -44,25 +44,25 @@ class CommandCSSetSecureFounder : public Command source.Reply(CHAN_SET_SECUREFOUNDER_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "SECUREFOUNDER"); + this->OnSyntaxError(source, "SECUREFOUNDER"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECUREFOUNDER, "SET"); + source.Reply(CHAN_HELP_SET_SECUREFOUNDER, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET SECUREFOUNDER", CHAN_SET_SECUREFOUNDER_SYNTAX); + SyntaxError(source, "SET SECUREFOUNDER", CHAN_SET_SECUREFOUNDER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_SECUREFOUNDER); + source.Reply(CHAN_HELP_CMD_SET_SECUREFOUNDER); } }; @@ -73,15 +73,15 @@ class CommandCSSASetSecureFounder : public CommandCSSetSecureFounder { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECUREFOUNDER, "SASET"); + source.Reply(CHAN_HELP_SET_SECUREFOUNDER, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET SECUREFOUNDER", CHAN_SASET_SECUREFOUNDER_SYNTAX); + SyntaxError(source, "SASET SECUREFOUNDER", CHAN_SASET_SECUREFOUNDER_SYNTAX); } }; diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp index 822953e75..3253d5b75 100644 --- a/modules/core/cs_set_secureops.cpp +++ b/modules/core/cs_set_secureops.cpp @@ -22,7 +22,6 @@ class CommandCSSetSecureOps : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetSecureIos"); @@ -38,25 +37,25 @@ class CommandCSSetSecureOps : public Command source.Reply(CHAN_SET_SECUREOPS_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "SECUREOPS"); + this->OnSyntaxError(source, "SECUREOPS"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECUREOPS, "SET"); + source.Reply(CHAN_HELP_SET_SECUREOPS, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET SECUREOPS", CHAN_SET_SECUREOPS_SYNTAX); + SyntaxError(source, "SET SECUREOPS", CHAN_SET_SECUREOPS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_SECUREOPS); + source.Reply(CHAN_HELP_CMD_SET_SECUREOPS); } }; @@ -67,15 +66,15 @@ class CommandCSSASetSecureOps : public CommandCSSetSecureOps { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SECUREOPS, "SASET"); + source.Reply(CHAN_HELP_SET_SECUREOPS, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET SECUREOPS", CHAN_SASET_SECUREOPS_SYNTAX); + SyntaxError(source, "SASET SECUREOPS", CHAN_SASET_SECUREOPS_SYNTAX); } }; diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp index 1960709b3..853b220e5 100644 --- a/modules/core/cs_set_signkick.cpp +++ b/modules/core/cs_set_signkick.cpp @@ -22,7 +22,6 @@ class CommandCSSetSignKick : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetSignKick"); @@ -46,25 +45,25 @@ class CommandCSSetSignKick : public Command source.Reply(CHAN_SET_SIGNKICK_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "SIGNKICK"); + this->OnSyntaxError(source, "SIGNKICK"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SIGNKICK, "SET"); + source.Reply(CHAN_HELP_SET_SIGNKICK, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET SIGNKICK", CHAN_SET_SIGNKICK_SYNTAX); + SyntaxError(source, "SET SIGNKICK", CHAN_SET_SIGNKICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_SIGNKICK); + source.Reply(CHAN_HELP_CMD_SET_SIGNKICK); } }; @@ -75,15 +74,15 @@ class CommandCSSASetSignKick : public CommandCSSetSignKick { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SIGNKICK, "SASET"); + source.Reply(CHAN_HELP_SET_SIGNKICK, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET SIGNKICK", CHAN_SASET_SIGNKICK_SYNTAX); + SyntaxError(source, "SASET SIGNKICK", CHAN_SASET_SIGNKICK_SYNTAX); } }; diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp index f45065c6e..529c0549c 100644 --- a/modules/core/cs_set_successor.cpp +++ b/modules/core/cs_set_successor.cpp @@ -71,21 +71,21 @@ class CommandCSSetSuccessor : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SUCCESSOR, "SET"); + source.Reply(CHAN_HELP_SET_SUCCESSOR, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_SUCCESSOR); + source.Reply(CHAN_HELP_CMD_SET_SUCCESSOR); } }; @@ -96,16 +96,16 @@ class CommandCSSASetSuccessor : public CommandCSSetSuccessor { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_SUCCESSOR, "SASET"); + source.Reply(CHAN_HELP_SET_SUCCESSOR, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } }; diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp index f3327045d..ec96bda1a 100644 --- a/modules/core/cs_set_topiclock.cpp +++ b/modules/core/cs_set_topiclock.cpp @@ -22,7 +22,6 @@ class CommandCSSetTopicLock : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; if (!ci) throw CoreException("NULL ci in CommandCSSetTopicLock"); @@ -38,25 +37,25 @@ class CommandCSSetTopicLock : public Command source.Reply(CHAN_SET_TOPICLOCK_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "TOPICLOCK"); + this->OnSyntaxError(source, "TOPICLOCK"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_TOPICLOCK, "SET"); + source.Reply(CHAN_HELP_SET_TOPICLOCK, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET", CHAN_SET_TOPICLOCK_SYNTAX);; + SyntaxError(source, "SET", CHAN_SET_TOPICLOCK_SYNTAX);; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_TOPICLOCK); + source.Reply(CHAN_HELP_CMD_SET_TOPICLOCK); } }; @@ -67,15 +66,15 @@ class CommandCSSASetTopicLock : public CommandCSSetTopicLock { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_TOPICLOCK, "SASET"); + source.Reply(CHAN_HELP_SET_TOPICLOCK, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_TOPICLOCK_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_TOPICLOCK_SYNTAX); } }; diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp index ec872e3fd..294c8363c 100644 --- a/modules/core/cs_set_xop.cpp +++ b/modules/core/cs_set_xop.cpp @@ -77,25 +77,25 @@ class CommandCSSetXOP : public Command source.Reply(CHAN_SET_XOP_OFF, ci->name.c_str()); } else - this->OnSyntaxError(u, "XOP"); + this->OnSyntaxError(source, "XOP"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_XOP, "SET"); + source.Reply(CHAN_HELP_SET_XOP, "SET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET XOP", CHAN_SET_XOP_SYNTAX); + SyntaxError(source, "SET XOP", CHAN_SET_XOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_XOP); + source.Reply(CHAN_HELP_CMD_SET_XOP); } }; @@ -106,15 +106,15 @@ class CommandCSSASetXOP : public CommandCSSetXOP { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(ChanServ, CHAN_HELP_SET_XOP, "SASET"); + source.Reply(CHAN_HELP_SET_XOP, "SASET"); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET XOP", CHAN_SASET_XOP_SYNTAX); + SyntaxError(source, "SASET XOP", CHAN_SASET_XOP_SYNTAX); } }; diff --git a/modules/core/cs_status.cpp b/modules/core/cs_status.cpp index 9310f3382..899632bbf 100644 --- a/modules/core/cs_status.cpp +++ b/modules/core/cs_status.cpp @@ -22,7 +22,6 @@ class CommandCSStatus : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; ChannelInfo *ci = source.ci; const Anope::string &nick = params[1]; @@ -34,20 +33,20 @@ class CommandCSStatus : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_STATUS); + source.Reply(CHAN_SERVADMIN_HELP_STATUS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "STATUS", CHAN_STATUS_SYNTAX); + SyntaxError(source, "STATUS", CHAN_STATUS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_STATUS); + source.Reply(CHAN_HELP_CMD_STATUS); } }; diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp index 97ff9c0c7..ee0dd4d17 100644 --- a/modules/core/cs_suspend.cpp +++ b/modules/core/cs_suspend.cpp @@ -31,7 +31,7 @@ class CommandCSSuspend : public Command /* Assumes that permission checking has already been done. */ if (Config->ForceForbidReason && reason.empty()) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -67,27 +67,27 @@ class CommandCSSuspend : public Command ircdproto->SendGlobops(ChanServ, "\2%s\2 used SUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); Log(LOG_ADMIN, u, this, ci) << (!reason.empty() ? reason : "No reason"); - u->SendMessage(ChanServ, CHAN_SUSPEND_SUCCEEDED, ci->name.c_str()); + source.Reply(CHAN_SUSPEND_SUCCEEDED, ci->name.c_str()); FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_SUSPEND); + source.Reply(CHAN_SERVADMIN_HELP_SUSPEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "SUSPEND", Config->ForceForbidReason ? CHAN_SUSPEND_SYNTAX_REASON : CHAN_SUSPEND_SYNTAX); + SyntaxError(source, "SUSPEND", Config->ForceForbidReason ? CHAN_SUSPEND_SYNTAX_REASON : CHAN_SUSPEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SUSPEND); + source.Reply(CHAN_HELP_CMD_SUSPEND); } }; @@ -123,27 +123,27 @@ class CommandCSUnSuspend : public Command if (Config->WallForbid) ircdproto->SendGlobops(ChanServ, "\2%s\2 used UNSUSPEND on channel \2%s\2", u->nick.c_str(), ci->name.c_str()); - u->SendMessage(ChanServ, CHAN_UNSUSPEND_SUCCEEDED, ci->name.c_str()); + source.Reply(CHAN_UNSUSPEND_SUCCEEDED, ci->name.c_str()); FOREACH_MOD(I_OnChanUnsuspend, OnChanUnsuspend(ci)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_SERVADMIN_HELP_UNSUSPEND); + source.Reply(CHAN_SERVADMIN_HELP_UNSUSPEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "UNSUSPEND", CHAN_UNSUSPEND_SYNTAX); + SyntaxError(source, "UNSUSPEND", CHAN_UNSUSPEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_UNSUSPEND); + source.Reply(CHAN_HELP_CMD_UNSUSPEND); } }; diff --git a/modules/core/cs_topic.cpp b/modules/core/cs_topic.cpp index 11495284e..5ac41b29e 100644 --- a/modules/core/cs_topic.cpp +++ b/modules/core/cs_topic.cpp @@ -46,20 +46,20 @@ class CommandCSTopic : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_TOPIC); + source.Reply(CHAN_HELP_TOPIC); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "TOPIC", CHAN_TOPIC_SYNTAX); + SyntaxError(source, "TOPIC", CHAN_TOPIC_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_TOPIC); + source.Reply(CHAN_HELP_CMD_TOPIC); } }; diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp index 629c94974..f9b5908e0 100644 --- a/modules/core/cs_unban.cpp +++ b/modules/core/cs_unban.cpp @@ -57,20 +57,20 @@ class CommandCSUnban : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_UNBAN); + source.Reply(CHAN_HELP_UNBAN); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX); + SyntaxError(source, "UNBAN", CHAN_UNBAN_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_UNBAN); + source.Reply(CHAN_HELP_CMD_UNBAN); } }; diff --git a/modules/core/cs_xop.cpp b/modules/core/cs_xop.cpp index 9a996e033..1b15d07fd 100644 --- a/modules/core/cs_xop.cpp +++ b/modules/core/cs_xop.cpp @@ -206,7 +206,7 @@ class XOPBase : public Command if (nick.empty()) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -293,7 +293,7 @@ class XOPBase : public Command if (nick.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -462,14 +462,13 @@ class XOPBase : public Command FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u)); - u->SendMessage(ChanServ, messages[XOP_CLEAR], ci->name.c_str()); + source.Reply(messages[XOP_CLEAR], ci->name.c_str()); return MOD_CONT; } protected: CommandReturn DoXop(CommandSource &source, const std::vector<Anope::string> ¶ms, int level, LanguageString *messages) { - User *u = source.u; ChannelInfo *ci = source.ci; const Anope::string &cmd = params[1]; @@ -485,7 +484,7 @@ class XOPBase : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source, level, messages); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -500,11 +499,11 @@ class XOPBase : public Command virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0; - virtual bool OnHelp(User *u, const Anope::string &subcommand) = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) = 0; - virtual void OnSyntaxError(User *u, const Anope::string &subcommand) = 0; + virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) = 0; - virtual void OnServHelp(User *u) = 0; + virtual void OnServHelp(CommandSource &source) = 0; }; class CommandCSQOP : public XOPBase @@ -519,20 +518,20 @@ class CommandCSQOP : public XOPBase return this->DoXop(source, params, ACCESS_QOP, xop_msgs[XOP_QOP]); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_QOP); + source.Reply(CHAN_HELP_QOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "QOP", CHAN_QOP_SYNTAX); + SyntaxError(source, "QOP", CHAN_QOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_QOP); + source.Reply(CHAN_HELP_CMD_QOP); } }; @@ -548,20 +547,20 @@ class CommandCSAOP : public XOPBase return this->DoXop(source, params, ACCESS_AOP, xop_msgs[XOP_AOP]); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_AOP); + source.Reply(CHAN_HELP_AOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "AOP", CHAN_AOP_SYNTAX); + SyntaxError(source, "AOP", CHAN_AOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_AOP); + source.Reply(CHAN_HELP_CMD_AOP); } }; @@ -577,20 +576,20 @@ class CommandCSHOP : public XOPBase return this->DoXop(source, params, ACCESS_HOP, xop_msgs[XOP_HOP]); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_HOP); + source.Reply(CHAN_HELP_HOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "HOP", CHAN_HOP_SYNTAX); + SyntaxError(source, "HOP", CHAN_HOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_HOP); + source.Reply(CHAN_HELP_CMD_HOP); } }; @@ -606,20 +605,20 @@ class CommandCSSOP : public XOPBase return this->DoXop(source, params, ACCESS_SOP, xop_msgs[XOP_SOP]); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_SOP); + source.Reply(CHAN_HELP_SOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "SOP", CHAN_SOP_SYNTAX); + SyntaxError(source, "SOP", CHAN_SOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SOP); + source.Reply(CHAN_HELP_CMD_SOP); } }; @@ -635,20 +634,20 @@ class CommandCSVOP : public XOPBase return this->DoXop(source, params, ACCESS_VOP, xop_msgs[XOP_VOP]); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_VOP); + source.Reply(CHAN_HELP_VOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(ChanServ, u, "VOP", CHAN_VOP_SYNTAX); + SyntaxError(source, "VOP", CHAN_VOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_VOP); + source.Reply(CHAN_HELP_CMD_VOP); } }; diff --git a/modules/core/hs_del.cpp b/modules/core/hs_del.cpp index 6ebbbd89c..67794eed5 100644 --- a/modules/core/hs_del.cpp +++ b/modules/core/hs_del.cpp @@ -43,20 +43,20 @@ class CommandHSDel : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_DEL); + source.Reply(HOST_HELP_DEL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(HostServ, u, "DEL", HOST_DEL_SYNTAX); + SyntaxError(source, "DEL", HOST_DEL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_DEL); + source.Reply(HOST_HELP_CMD_DEL); } }; diff --git a/modules/core/hs_delall.cpp b/modules/core/hs_delall.cpp index 10d290f43..e5c1b5ae9 100644 --- a/modules/core/hs_delall.cpp +++ b/modules/core/hs_delall.cpp @@ -48,20 +48,20 @@ class CommandHSDelAll : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_DELALL); + source.Reply(HOST_HELP_DELALL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(HostServ, u, "DELALL", HOST_DELALL_SYNTAX); + SyntaxError(source, "DELALL", HOST_DELALL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_DELALL); + source.Reply(HOST_HELP_CMD_DELALL); } }; diff --git a/modules/core/hs_group.cpp b/modules/core/hs_group.cpp index 056cbaab1..fd4a424d2 100644 --- a/modules/core/hs_group.cpp +++ b/modules/core/hs_group.cpp @@ -38,15 +38,15 @@ class CommandHSGroup : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_GROUP); + source.Reply(HOST_HELP_GROUP); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_GROUP); + source.Reply(HOST_HELP_CMD_GROUP); } }; diff --git a/modules/core/hs_help.cpp b/modules/core/hs_help.cpp index e2f49a3e7..9b7d9166a 100644 --- a/modules/core/hs_help.cpp +++ b/modules/core/hs_help.cpp @@ -23,16 +23,17 @@ class CommandHSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - mod_help_cmd(HostServ, source.u, params[0]); + mod_help_cmd(HostServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, OPER_HELP, Config->s_HostServ.c_str()); + User *u = source.u; + source.Reply(OPER_HELP, Config->s_HostServ.c_str()); for (CommandMap::const_iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); + it->second->OnServHelp(source); } }; diff --git a/modules/core/hs_list.cpp b/modules/core/hs_list.cpp index 23ce31f9a..9987133b6 100644 --- a/modules/core/hs_list.cpp +++ b/modules/core/hs_list.cpp @@ -97,15 +97,15 @@ class CommandHSList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_LIST); + source.Reply(HOST_HELP_LIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_LIST); + source.Reply(HOST_HELP_CMD_LIST); } }; diff --git a/modules/core/hs_off.cpp b/modules/core/hs_off.cpp index 8c69a8821..8040194ee 100644 --- a/modules/core/hs_off.cpp +++ b/modules/core/hs_off.cpp @@ -37,15 +37,15 @@ class CommandHSOff : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_OFF); + source.Reply(HOST_HELP_OFF); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_OFF); + source.Reply(HOST_HELP_CMD_OFF); } }; diff --git a/modules/core/hs_on.cpp b/modules/core/hs_on.cpp index dd11e1c9b..66e3d5a22 100644 --- a/modules/core/hs_on.cpp +++ b/modules/core/hs_on.cpp @@ -47,15 +47,15 @@ class CommandHSOn : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_ON); + source.Reply(HOST_HELP_ON); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_ON); + source.Reply(HOST_HELP_CMD_ON); } }; diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp index 8cd25bdc2..c06d6618d 100644 --- a/modules/core/hs_set.cpp +++ b/modules/core/hs_set.cpp @@ -94,20 +94,20 @@ class CommandHSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_SET); + source.Reply(HOST_HELP_SET); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(HostServ, u, "SET", HOST_SET_SYNTAX); + SyntaxError(source, "SET", HOST_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_SET); + source.Reply(HOST_HELP_CMD_SET); } }; diff --git a/modules/core/hs_setall.cpp b/modules/core/hs_setall.cpp index 4a2f27ab6..6d2c0b46e 100644 --- a/modules/core/hs_setall.cpp +++ b/modules/core/hs_setall.cpp @@ -100,20 +100,20 @@ class CommandHSSetAll : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(HostServ, HOST_HELP_SETALL); + source.Reply(HOST_HELP_SETALL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(HostServ, u, "SETALL", HOST_SETALL_SYNTAX); + SyntaxError(source, "SETALL", HOST_SETALL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(HostServ, HOST_HELP_CMD_SETALL); + source.Reply(HOST_HELP_CMD_SETALL); } }; diff --git a/modules/core/ms_cancel.cpp b/modules/core/ms_cancel.cpp index dc8cbe050..1d6bb2cf7 100644 --- a/modules/core/ms_cancel.cpp +++ b/modules/core/ms_cancel.cpp @@ -54,20 +54,20 @@ class CommandMSCancel : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_CANCEL); + source.Reply(MEMO_HELP_CANCEL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "CANCEL", MEMO_CANCEL_SYNTAX); + SyntaxError(source, "CANCEL", MEMO_CANCEL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_CANCEL); + source.Reply(MEMO_HELP_CMD_CANCEL); } }; diff --git a/modules/core/ms_check.cpp b/modules/core/ms_check.cpp index 80b30d2ac..bd26dd404 100644 --- a/modules/core/ms_check.cpp +++ b/modules/core/ms_check.cpp @@ -66,20 +66,20 @@ class CommandMSCheck : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_CHECK); + source.Reply(MEMO_HELP_CHECK); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "CHECK", MEMO_CHECK_SYNTAX); + SyntaxError(source, "CHECK", MEMO_CHECK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_CHECK); + source.Reply(MEMO_HELP_CMD_CHECK); } }; diff --git a/modules/core/ms_del.cpp b/modules/core/ms_del.cpp index 443674a88..2ee0e3780 100644 --- a/modules/core/ms_del.cpp +++ b/modules/core/ms_del.cpp @@ -78,7 +78,7 @@ class CommandMSDel : public Command else mi = &u->Account()->memos; if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST"))) - this->OnSyntaxError(u, numstr); + this->OnSyntaxError(source, numstr); else if (mi->memos.empty()) { if (!chan.empty()) @@ -122,20 +122,20 @@ class CommandMSDel : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_DEL); + source.Reply(MEMO_HELP_DEL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "DEL", MEMO_DEL_SYNTAX); + SyntaxError(source, "DEL", MEMO_DEL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_DEL); + source.Reply(MEMO_HELP_CMD_DEL); } }; diff --git a/modules/core/ms_help.cpp b/modules/core/ms_help.cpp index 025bed6aa..849ea6785 100644 --- a/modules/core/ms_help.cpp +++ b/modules/core/ms_help.cpp @@ -23,17 +23,18 @@ class CommandMSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - mod_help_cmd(MemoServ, source.u, params[0]); + mod_help_cmd(MemoServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_HEADER); + User *u = source.u; + source.Reply(MEMO_HELP_HEADER); for (CommandMap::const_iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); - u->SendMessage(MemoServ, MEMO_HELP_FOOTER, Config->s_ChanServ.c_str()); + it->second->OnServHelp(source); + source.Reply(MEMO_HELP_FOOTER, Config->s_ChanServ.c_str()); } }; diff --git a/modules/core/ms_ignore.cpp b/modules/core/ms_ignore.cpp index 078f8abcc..04625304d 100644 --- a/modules/core/ms_ignore.cpp +++ b/modules/core/ms_ignore.cpp @@ -80,25 +80,25 @@ class CommandMSIgnore : public Command } } else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_IGNORE); + source.Reply(MEMO_HELP_IGNORE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "IGNORE", MEMO_IGNORE_SYNTAX); + SyntaxError(source, "IGNORE", MEMO_IGNORE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_IGNORE); + source.Reply(MEMO_HELP_CMD_IGNORE); } }; diff --git a/modules/core/ms_info.cpp b/modules/core/ms_info.cpp index 04e1087e6..30007c0bd 100644 --- a/modules/core/ms_info.cpp +++ b/modules/core/ms_info.cpp @@ -186,19 +186,20 @@ class CommandMSInfo : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(MemoServ, MEMO_SERVADMIN_HELP_INFO); + source.Reply(MEMO_SERVADMIN_HELP_INFO); else - u->SendMessage(MemoServ, MEMO_HELP_INFO); + source.Reply(MEMO_HELP_INFO); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_INFO); + source.Reply(MEMO_HELP_CMD_INFO); } }; diff --git a/modules/core/ms_list.cpp b/modules/core/ms_list.cpp index 3656fd94d..ef91b20c0 100644 --- a/modules/core/ms_list.cpp +++ b/modules/core/ms_list.cpp @@ -86,7 +86,7 @@ class CommandMSList : public Command else mi = &u->Account()->memos; if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW")) - this->OnSyntaxError(u, param); + this->OnSyntaxError(source, param); else if (!mi->memos.size()) { if (!chan.empty()) @@ -142,20 +142,20 @@ class CommandMSList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_LIST); + source.Reply(MEMO_HELP_LIST); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "LIST", MEMO_LIST_SYNTAX); + SyntaxError(source, "LIST", MEMO_LIST_SYNTAX); } - void OnServCommand(User *u) + void OnServCommand(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_LIST); + source.Reply(MEMO_HELP_CMD_LIST); } }; diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp index 785755fec..31f701c7e 100644 --- a/modules/core/ms_read.cpp +++ b/modules/core/ms_read.cpp @@ -32,18 +32,17 @@ class MemoListCallback : public NumberList static void DoRead(CommandSource &source, MemoInfo *mi, ChannelInfo *ci, unsigned index) { - User *u = source.u; Memo *m = mi->memos[index]; if (ci) - u->SendMessage(MemoServ, MEMO_CHAN_HEADER, index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->s_MemoServ.c_str(), ci->name.c_str(), index + 1); + source.Reply(MEMO_CHAN_HEADER, index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->s_MemoServ.c_str(), ci->name.c_str(), index + 1); else - u->SendMessage(MemoServ, MEMO_HEADER, index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->s_MemoServ.c_str(), index + 1); - u->SendMessage(MemoServ, MEMO_TEXT, m->text.c_str()); + source.Reply(MEMO_HEADER, index + 1, m->sender.c_str(), do_strftime(m->time).c_str(), Config->s_MemoServ.c_str(), index + 1); + source.Reply(MEMO_TEXT, m->text.c_str()); m->UnsetFlag(MF_UNREAD); /* Check if a receipt notification was requested */ if (m->HasFlag(MF_RECEIPT)) - rsend_notify(u, m, ci ? ci->name : ""); + rsend_notify(source, m, ci ? ci->name : ""); } }; @@ -84,7 +83,7 @@ class CommandMSRead : public Command mi = &u->Account()->memos; num = !numstr.empty() && numstr.is_number_only() ? convertTo<int>(numstr) : -1; if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && num <= 0)) - this->OnSyntaxError(u, numstr); + this->OnSyntaxError(source, numstr); else if (mi->memos.empty()) { if (!chan.empty()) @@ -126,20 +125,20 @@ class CommandMSRead : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_READ); + source.Reply(MEMO_HELP_READ); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "READ", MEMO_READ_SYNTAX); + SyntaxError(source, "READ", MEMO_READ_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_READ); + source.Reply(MEMO_HELP_CMD_READ); } }; diff --git a/modules/core/ms_rsend.cpp b/modules/core/ms_rsend.cpp index ea1351db5..a8790680d 100644 --- a/modules/core/ms_rsend.cpp +++ b/modules/core/ms_rsend.cpp @@ -39,13 +39,13 @@ class CommandMSRSend : public Command { /* Services opers and above can use rsend */ if (u->Account()->IsServicesOper()) - memo_send(u, nick, text, 3); + memo_send(source, nick, text, 3); else source.Reply(ACCESS_DENIED); } else if (Config->MSMemoReceipt == 2) /* Everybody can use rsend */ - memo_send(u, nick, text, 3); + memo_send(source, nick, text, 3); else { /* rsend has been disabled */ @@ -56,20 +56,20 @@ class CommandMSRSend : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_RSEND); + source.Reply(MEMO_HELP_RSEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "RSEND", MEMO_RSEND_SYNTAX); + SyntaxError(source, "RSEND", MEMO_RSEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_RSEND); + source.Reply(MEMO_HELP_CMD_RSEND); } }; diff --git a/modules/core/ms_send.cpp b/modules/core/ms_send.cpp index ad1072d95..e4eb303c7 100644 --- a/modules/core/ms_send.cpp +++ b/modules/core/ms_send.cpp @@ -22,27 +22,26 @@ class CommandMSSend : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &nick = params[0]; const Anope::string &text = params[1]; - memo_send(u, nick, text, 0); + memo_send(source, nick, text, 0); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_SEND); + source.Reply(MEMO_HELP_SEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "SEND", MEMO_SEND_SYNTAX); + SyntaxError(source, "SEND", MEMO_SEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_SEND); + source.Reply(MEMO_HELP_CMD_SEND); } }; diff --git a/modules/core/ms_sendall.cpp b/modules/core/ms_sendall.cpp index 7285154ea..0bce8670e 100644 --- a/modules/core/ms_sendall.cpp +++ b/modules/core/ms_sendall.cpp @@ -38,27 +38,27 @@ class CommandMSSendAll : public Command NickCore *nc = it->second; if ((na && na->nc == nc) || !nc->display.equals_ci(u->nick)) - memo_send(u, nc->display, text, 1); + memo_send(source, nc->display, text, 1); } - u->SendMessage(MemoServ, MEMO_MASS_SENT); + source.Reply(MEMO_MASS_SENT); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_SENDALL); + source.Reply(MEMO_HELP_SENDALL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "SENDALL", MEMO_SENDALL_SYNTAX); + SyntaxError(source, "SENDALL", MEMO_SENDALL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_SENDALL); + source.Reply(MEMO_HELP_CMD_SENDALL); } }; diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp index d17956a59..bfa7580bd 100644 --- a/modules/core/ms_set.cpp +++ b/modules/core/ms_set.cpp @@ -62,7 +62,7 @@ class CommandMSSet : public Command source.Reply(MEMO_SET_NOTIFY_OFF, Config->s_MemoServ.c_str()); } else - SyntaxError(MemoServ, u, "SET NOTIFY", MEMO_SET_NOTIFY_SYNTAX); + SyntaxError(source, "SET NOTIFY", MEMO_SET_NOTIFY_SYNTAX); return MOD_CONT; } @@ -116,12 +116,12 @@ class CommandMSSet : public Command } else if (p1.empty()) { - SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX); + SyntaxError(source, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX); return MOD_CONT; } if ((!isdigit(p1[0]) && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD"))) { - SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX); + SyntaxError(source, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX); return MOD_CONT; } if (!chan.empty()) @@ -151,7 +151,7 @@ class CommandMSSet : public Command { if (p1.empty() || !p2.empty() || !isdigit(p1[0])) { - SyntaxError(MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SYNTAX); + SyntaxError(source, "SET LIMIT", MEMO_SET_LIMIT_SYNTAX); return MOD_CONT; } if (!chan.empty() && ci->HasFlag(CI_MEMO_HARDMAX)) @@ -231,18 +231,19 @@ class CommandMSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) - u->SendMessage(MemoServ, MEMO_HELP_SET); + source.Reply(MEMO_HELP_SET); else if (subcommand.equals_ci("NOTIFY")) - u->SendMessage(MemoServ, MEMO_HELP_SET_NOTIFY); + source.Reply(MEMO_HELP_SET_NOTIFY); else if (subcommand.equals_ci("LIMIT")) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(MemoServ, MEMO_SERVADMIN_HELP_SET_LIMIT, Config->MSMaxMemos); + source.Reply(MEMO_SERVADMIN_HELP_SET_LIMIT, Config->MSMaxMemos); else - u->SendMessage(MemoServ, MEMO_HELP_SET_LIMIT, Config->MSMaxMemos); + source.Reply(MEMO_HELP_SET_LIMIT, Config->MSMaxMemos); } else return false; @@ -250,14 +251,14 @@ class CommandMSSet : public Command return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "SET", NICK_SET_SYNTAX); + SyntaxError(source, "SET", NICK_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_SET); + source.Reply(MEMO_HELP_CMD_SET); } }; diff --git a/modules/core/ms_staff.cpp b/modules/core/ms_staff.cpp index e64f53ff2..76ab0cf2e 100644 --- a/modules/core/ms_staff.cpp +++ b/modules/core/ms_staff.cpp @@ -36,26 +36,26 @@ class CommandMSStaff : public Command NickCore *nc = it->second; if (nc->IsServicesOper()) - memo_send(u, nc->display, text, 0); + memo_send(source, nc->display, text, 0); } return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(MemoServ, MEMO_HELP_STAFF); + source.Reply(MEMO_HELP_STAFF); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(MemoServ, u, "STAFF", MEMO_STAFF_SYNTAX); + SyntaxError(source, "STAFF", MEMO_STAFF_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(MemoServ, MEMO_HELP_CMD_STAFF); + source.Reply(MEMO_HELP_CMD_STAFF); } }; diff --git a/modules/core/ns_access.cpp b/modules/core/ns_access.cpp index 62f544f64..16e8690c2 100644 --- a/modules/core/ns_access.cpp +++ b/modules/core/ns_access.cpp @@ -51,7 +51,7 @@ class CommandNSAccess : public Command if (mask.empty()) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -79,7 +79,7 @@ class CommandNSAccess : public Command if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -146,25 +146,25 @@ class CommandNSAccess : public Command else if (cmd.equals_ci("LIST")) return this->DoList(source, u->Account(), mask); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_ACCESS); + source.Reply(NICK_HELP_ACCESS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "ACCESS", NICK_ACCESS_SYNTAX); + SyntaxError(source, "ACCESS", NICK_ACCESS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_ACCESS); + source.Reply(NICK_HELP_CMD_ACCESS); } }; diff --git a/modules/core/ns_alist.cpp b/modules/core/ns_alist.cpp index 4a51b287a..f6879b6e7 100644 --- a/modules/core/ns_alist.cpp +++ b/modules/core/ns_alist.cpp @@ -119,19 +119,20 @@ class CommandNSAList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_ALIST); + source.Reply(NICK_SERVADMIN_HELP_ALIST); else - u->SendMessage(NickServ, NICK_HELP_ALIST); + source.Reply(NICK_HELP_ALIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_ALIST); + source.Reply(NICK_HELP_CMD_ALIST); } }; diff --git a/modules/core/ns_drop.cpp b/modules/core/ns_drop.cpp index b2dba8944..203a6388f 100644 --- a/modules/core/ns_drop.cpp +++ b/modules/core/ns_drop.cpp @@ -114,19 +114,20 @@ class CommandNSDrop : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->HasPriv("nickserv/drop")) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_DROP); + source.Reply(NICK_SERVADMIN_HELP_DROP); else - u->SendMessage(NickServ, NICK_HELP_DROP); + source.Reply(NICK_HELP_DROP); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_DROP); + source.Reply(NICK_HELP_CMD_DROP); } }; diff --git a/modules/core/ns_forbid.cpp b/modules/core/ns_forbid.cpp index 12871bda6..e672728d8 100644 --- a/modules/core/ns_forbid.cpp +++ b/modules/core/ns_forbid.cpp @@ -29,7 +29,7 @@ class CommandNSForbid : public Command /* Assumes that permission checking has already been done. */ if (Config->ForceForbidReason && reason.empty()) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -77,27 +77,27 @@ class CommandNSForbid : public Command ircdproto->SendGlobops(NickServ, "\2%s\2 used FORBID on \2%s\2", u->nick.c_str(), nick.c_str()); Log(LOG_ADMIN, u, this) << "to forbid nick " << nick; - u->SendMessage(NickServ, NICK_FORBID_SUCCEEDED, nick.c_str()); + source.Reply(NICK_FORBID_SUCCEEDED, nick.c_str()); FOREACH_MOD(I_OnNickForbidden, OnNickForbidden(na)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_FORBID); + source.Reply(NICK_SERVADMIN_HELP_FORBID); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "FORBID", Config->ForceForbidReason ? NICK_FORBID_SYNTAX_REASON : NICK_FORBID_SYNTAX); + SyntaxError(source, "FORBID", Config->ForceForbidReason ? NICK_FORBID_SYNTAX_REASON : NICK_FORBID_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_FORBID); + source.Reply(NICK_HELP_CMD_FORBID); } }; diff --git a/modules/core/ns_getemail.cpp b/modules/core/ns_getemail.cpp index ea61ac6ac..8a5586425 100644 --- a/modules/core/ns_getemail.cpp +++ b/modules/core/ns_getemail.cpp @@ -52,20 +52,20 @@ class CommandNSGetEMail : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_GETEMAIL); + source.Reply(NICK_SERVADMIN_HELP_GETEMAIL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "GETMAIL", NICK_GETEMAIL_SYNTAX); + SyntaxError(source, "GETMAIL", NICK_GETEMAIL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_GETEMAIL); + source.Reply(NICK_HELP_CMD_GETEMAIL); } }; diff --git a/modules/core/ns_getpass.cpp b/modules/core/ns_getpass.cpp index 8282dd7d3..e902598dd 100644 --- a/modules/core/ns_getpass.cpp +++ b/modules/core/ns_getpass.cpp @@ -59,20 +59,20 @@ class CommandNSGetPass : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_GETPASS); + source.Reply(NICK_SERVADMIN_HELP_GETPASS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "GETPASS", NICK_GETPASS_SYNTAX); + SyntaxError(source, "GETPASS", NICK_GETPASS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_GETPASS); + source.Reply(NICK_HELP_CMD_GETPASS); } }; diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index 8009c85f4..14796bc78 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -67,20 +67,20 @@ class CommandNSGhost : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_GHOST); + source.Reply(NICK_HELP_GHOST); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "GHOST", NICK_GHOST_SYNTAX); + SyntaxError(source, "GHOST", NICK_GHOST_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_GHOST); + source.Reply(NICK_HELP_CMD_GHOST); } }; diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp index cd945167b..697c29447 100644 --- a/modules/core/ns_group.cpp +++ b/modules/core/ns_group.cpp @@ -131,20 +131,20 @@ class CommandNSGroup : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_GROUP); + source.Reply(NICK_HELP_GROUP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "GROUP", NICK_GROUP_SYNTAX); + SyntaxError(source, "GROUP", NICK_GROUP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_GROUP); + source.Reply(NICK_HELP_CMD_GROUP); } }; @@ -199,15 +199,15 @@ class CommandNSUngroup : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_UNGROUP); + source.Reply(NICK_HELP_UNGROUP); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_UNGROUP); + source.Reply(NICK_HELP_CMD_UNGROUP); } }; @@ -243,19 +243,20 @@ class CommandNSGList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_GLIST); + source.Reply(NICK_SERVADMIN_HELP_GLIST); else - u->SendMessage(NickServ, NICK_HELP_GLIST); + source.Reply(NICK_HELP_GLIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_GLIST); + source.Reply(NICK_HELP_CMD_GLIST); } }; diff --git a/modules/core/ns_help.cpp b/modules/core/ns_help.cpp index 07ba58a07..6718580d0 100644 --- a/modules/core/ns_help.cpp +++ b/modules/core/ns_help.cpp @@ -23,21 +23,22 @@ class CommandNSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - mod_help_cmd(NickServ, source.u, params[0]); + mod_help_cmd(NickServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP); + User *u = source.u; + source.Reply(NICK_HELP); for (CommandMap::const_iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); + it->second->OnServHelp(source); if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP); + source.Reply(NICK_SERVADMIN_HELP); if (Config->NSExpire >= 86400) - u->SendMessage(NickServ, NICK_HELP_EXPIRES, Config->NSExpire / 86400); - u->SendMessage(NickServ, NICK_HELP_FOOTER); + source.Reply(NICK_HELP_EXPIRES, Config->NSExpire / 86400); + source.Reply(NICK_HELP_FOOTER); } }; diff --git a/modules/core/ns_identify.cpp b/modules/core/ns_identify.cpp index bfb05ecc8..b46963692 100644 --- a/modules/core/ns_identify.cpp +++ b/modules/core/ns_identify.cpp @@ -98,20 +98,20 @@ class CommandNSIdentify : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_IDENTIFY); + source.Reply(NICK_HELP_IDENTIFY); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "IDENTIFY", NICK_IDENTIFY_SYNTAX); + SyntaxError(source, "IDENTIFY", NICK_IDENTIFY_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_IDENTIFY); + source.Reply(NICK_HELP_CMD_IDENTIFY); } }; diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp index ed60362f8..32d8fe8f7 100644 --- a/modules/core/ns_info.cpp +++ b/modules/core/ns_info.cpp @@ -146,21 +146,21 @@ class CommandNSInfo : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_INFO); + source.Reply(NICK_HELP_INFO); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "INFO", NICK_INFO_SYNTAX); + SyntaxError(source, "INFO", NICK_INFO_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_INFO); + source.Reply(NICK_HELP_CMD_INFO); } }; diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp index a02321272..89fba90d8 100644 --- a/modules/core/ns_list.cpp +++ b/modules/core/ns_list.cpp @@ -105,7 +105,7 @@ class CommandNSList : public Command mync = u->Account(); - u->SendMessage(NickServ, NICK_LIST_HEADER, pattern.c_str()); + source.Reply(NICK_LIST_HEADER, pattern.c_str()); if (!unconfirmed) { for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it) @@ -167,31 +167,33 @@ class CommandNSList : public Command } } } - u->SendMessage(NickServ, NICK_LIST_RESULTS, nnicks > Config->NSListMax ? Config->NSListMax : nnicks, nnicks); + source.Reply(NICK_LIST_RESULTS, nnicks > Config->NSListMax ? Config->NSListMax : nnicks, nnicks); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_LIST); + source.Reply(NICK_SERVADMIN_HELP_LIST); else - u->SendMessage(NickServ, NICK_HELP_LIST); + source.Reply(NICK_HELP_LIST); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account()->IsServicesOper()) - SyntaxError(NickServ, u, "LIST", NICK_LIST_SERVADMIN_SYNTAX); + SyntaxError(source, "LIST", NICK_LIST_SERVADMIN_SYNTAX); else - SyntaxError(NickServ, u, "LIST", NICK_LIST_SYNTAX); + SyntaxError(source, "LIST", NICK_LIST_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_LIST); + source.Reply(NICK_HELP_CMD_LIST); } }; diff --git a/modules/core/ns_logout.cpp b/modules/core/ns_logout.cpp index c6e04c8c8..50890923b 100644 --- a/modules/core/ns_logout.cpp +++ b/modules/core/ns_logout.cpp @@ -29,7 +29,7 @@ class CommandNSLogout : public Command User *u2; if (!u->Account()->IsServicesOper() && !nick.empty()) - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); else if (!(u2 = (!nick.empty() ? finduser(nick) : u))) source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); else if (!nick.empty() && u2->Account() && !u2->Account()->IsServicesOper()) @@ -60,24 +60,25 @@ class CommandNSLogout : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { + User *u = source.u; if (u->Account() && u->Account()->IsServicesOper()) - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_LOGOUT); + source.Reply(NICK_SERVADMIN_HELP_LOGOUT); else - u->SendMessage(NickServ, NICK_HELP_LOGOUT); + source.Reply(NICK_HELP_LOGOUT); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "LOGOUT", NICK_LOGOUT_SYNTAX); + SyntaxError(source, "LOGOUT", NICK_LOGOUT_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_LOGOUT); + source.Reply(NICK_HELP_CMD_LOGOUT); } }; diff --git a/modules/core/ns_recover.cpp b/modules/core/ns_recover.cpp index 137bcb092..8a47d912c 100644 --- a/modules/core/ns_recover.cpp +++ b/modules/core/ns_recover.cpp @@ -83,24 +83,24 @@ class CommandNSRecover : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { /* Convert Config->NSReleaseTimeout seconds to string format */ - Anope::string relstr = duration(u->Account(), Config->NSReleaseTimeout); + Anope::string relstr = duration(source.u->Account(), Config->NSReleaseTimeout); - u->SendMessage(NickServ, NICK_HELP_RECOVER, relstr.c_str()); + source.Reply(NICK_HELP_RECOVER, relstr.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "RECOVER", NICK_RECOVER_SYNTAX); + SyntaxError(source, "RECOVER", NICK_RECOVER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_RECOVER); + source.Reply(NICK_HELP_CMD_RECOVER); } }; diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp index b820e6318..abcba133d 100644 --- a/modules/core/ns_register.cpp +++ b/modules/core/ns_register.cpp @@ -92,7 +92,7 @@ class CommandNSConfirm : public Command { if (passcode.empty()) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -142,22 +142,23 @@ class CommandNSConfirm : public Command return this->DoConfirm(source, params); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_CONFIRM); + User *u = source.u; + source.Reply(NICK_HELP_CONFIRM); if (u->Account() && u->Account()->HasPriv("nickserv/confirm")) - u->SendMessage(NickServ, NICK_HELP_CONFIRM_OPER); + source.Reply(NICK_HELP_CONFIRM_OPER); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_CONFIRM_INVALID); + source.Reply(NICK_CONFIRM_INVALID); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_CONFIRM); + source.Reply(NICK_HELP_CMD_CONFIRM); } }; @@ -237,7 +238,7 @@ class CommandNSRegister : public CommandNSConfirm } if (Config->NSForceEmail && email.empty()) - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay) source.Reply(NICK_REG_PLEASE_WAIT, (u->lastnickreg + Config->NSRegDelay) - Anope::CurTime); else if ((na = findnick(u->nick))) @@ -293,23 +294,23 @@ class CommandNSRegister : public CommandNSConfirm return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_REGISTER); + source.Reply(NICK_HELP_REGISTER); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { if (Config->NSForceEmail) - SyntaxError(NickServ, u, "REGISTER", NICK_REGISTER_SYNTAX_EMAIL); + SyntaxError(source, "REGISTER", NICK_REGISTER_SYNTAX_EMAIL); else - SyntaxError(NickServ, u, "REGISTER", NICK_REGISTER_SYNTAX); + SyntaxError(source, "REGISTER", NICK_REGISTER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_REGISTER); + source.Reply(NICK_HELP_CMD_REGISTER); } }; @@ -350,15 +351,15 @@ class CommandNSResend : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_RESEND); + source.Reply(NICK_HELP_RESEND); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_RESEND); + source.Reply(NICK_HELP_CMD_RESEND); } }; diff --git a/modules/core/ns_release.cpp b/modules/core/ns_release.cpp index 743b7a2ec..5a01d5552 100644 --- a/modules/core/ns_release.cpp +++ b/modules/core/ns_release.cpp @@ -68,24 +68,25 @@ class CommandNSRelease : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { /* Convert Config->NSReleaseTimeout seconds to string format */ + User *u = source.u; Anope::string relstr = duration(u->Account(), Config->NSReleaseTimeout); - u->SendMessage(NickServ, NICK_HELP_RELEASE, relstr.c_str()); + source.Reply(NICK_HELP_RELEASE, relstr.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "RELEASE", NICK_RELEASE_SYNTAX); + SyntaxError(source, "RELEASE", NICK_RELEASE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_RELEASE); + source.Reply(NICK_HELP_CMD_RELEASE); } }; diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp index ddff616a3..1fefd2b0c 100644 --- a/modules/core/ns_resetpass.cpp +++ b/modules/core/ns_resetpass.cpp @@ -46,20 +46,20 @@ class CommandNSResetPass : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_RESETPASS); + source.Reply(NICK_HELP_RESETPASS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "RESETPASS", NICK_RESETPASS_SYNTAX); + SyntaxError(source, "RESETPASS", NICK_RESETPASS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_RESETPASS); + source.Reply(NICK_HELP_CMD_RESETPASS); } }; @@ -81,11 +81,13 @@ class NSResetPass : public Module ModuleManager::Attach(I_OnPreCommand, this); } - EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> ¶ms) + EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { - if (service == NickServ && command.equals_ci("CONFIRM") && !params.empty()) + User *u = source.u; + BotInfo *service = source.owner; + if (service == NickServ && command->name.equals_ci("CONFIRM") && !params.empty()) { - NickAlias *na = findnick(u->nick); + NickAlias *na = findnick(source.u->nick); time_t t; Anope::string c; @@ -95,7 +97,7 @@ class NSResetPass : public Module { na->nc->Shrink("ns_resetpass_code"); na->nc->Shrink("ns_resetpass_time"); - u->SendMessage(service, NICK_CONFIRM_EXPIRED); + source.Reply(NICK_CONFIRM_EXPIRED); return EVENT_STOP; } @@ -115,7 +117,7 @@ class NSResetPass : public Module FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); Log(LOG_COMMAND, u, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify to " << na->nick; - u->SendMessage(service, NICK_CONFIRM_SUCCESS, Config->s_NickServ.c_str()); + source.Reply(NICK_CONFIRM_SUCCESS, Config->s_NickServ.c_str()); if (ircd->vhost) do_on_id(u); @@ -126,7 +128,7 @@ class NSResetPass : public Module else { Log(LOG_COMMAND, u, &commandnsresetpass) << "invalid confirm passcode for " << na->nick; - u->SendMessage(service, NICK_CONFIRM_INVALID); + source.Reply(NICK_CONFIRM_INVALID); bad_password(u); } diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index df0e28eab..42541f99b 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -70,14 +70,14 @@ class CommandNSSASet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) { - u->SendMessage(NickServ, NICK_HELP_SASET_HEAD); + source.Reply(NICK_HELP_SASET_HEAD); for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - it->second->OnServHelp(u); - u->SendMessage(NickServ, NICK_HELP_SASET_TAIL); + it->second->OnServHelp(source); + source.Reply(NICK_HELP_SASET_TAIL); return true; } else @@ -85,20 +85,20 @@ class CommandNSSASet : public Command Command *c = this->FindCommand(subcommand); if (c) - return c->OnHelp(u, subcommand); + return c->OnHelp(source, subcommand); } return false; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "SASET", NICK_SASET_SYNTAX); + SyntaxError(source, "SASET", NICK_SASET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET); + source.Reply(NICK_HELP_CMD_SASET); } bool AddSubcommand(Command *c) @@ -131,7 +131,6 @@ class CommandNSSASetDisplay : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *setter_na = findnick(params[0]); if (!setter_na) throw CoreException("NULL na in CommandNSSASetDisplay"); @@ -145,25 +144,25 @@ class CommandNSSASetDisplay : public Command } change_core_display(nc, params[1]); - u->SendMessage(NickServ, NICK_SET_DISPLAY_CHANGED, nc->display.c_str()); + source.Reply(NICK_SET_DISPLAY_CHANGED, nc->display.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_DISPLAY); + source.Reply(NICK_HELP_SASET_DISPLAY); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(NickServ, u, "SASET", NICK_SASET_SYNTAX); + SyntaxError(source, "SASET", NICK_SASET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_DISPLAY); + source.Reply(NICK_HELP_CMD_SASET_DISPLAY); } }; @@ -219,20 +218,20 @@ class CommandNSSASetPassword : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_PASSWORD); + source.Reply(NICK_HELP_SASET_PASSWORD); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET", NICK_SASET_SYNTAX); + SyntaxError(source, "SASET", NICK_SASET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_PASSWORD); + source.Reply(NICK_HELP_CMD_SASET_PASSWORD); } }; diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp index 21814e41c..889cd7d1e 100644 --- a/modules/core/ns_saset_noexpire.cpp +++ b/modules/core/ns_saset_noexpire.cpp @@ -22,7 +22,6 @@ class CommandNSSASetNoexpire : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSASsetNoexpire"); @@ -40,25 +39,25 @@ class CommandNSSASetNoexpire : public Command source.Reply(NICK_SASET_NOEXPIRE_OFF, na->nick.c_str()); } else - this->OnSyntaxError(u, "NOEXPIRE"); + this->OnSyntaxError(source, "NOEXPIRE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_NOEXPIRE); + source.Reply(NICK_HELP_SASET_NOEXPIRE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX); + SyntaxError(source, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_NOEXPIRE); + source.Reply(NICK_HELP_CMD_SASET_NOEXPIRE); } }; diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp index 9612073ac..526451e07 100644 --- a/modules/core/ns_sendpass.cpp +++ b/modules/core/ns_sendpass.cpp @@ -53,20 +53,20 @@ class CommandNSSendPass : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_SENDPASS); + source.Reply(NICK_HELP_SENDPASS); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "SENDPASS", NICK_SENDPASS_SYNTAX); + SyntaxError(source, "SENDPASS", NICK_SENDPASS_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SENDPASS); + source.Reply(NICK_HELP_CMD_SENDPASS); } }; diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp index 7d63119e9..d5619a684 100644 --- a/modules/core/ns_set.cpp +++ b/modules/core/ns_set.cpp @@ -64,14 +64,14 @@ class CommandNSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) { - u->SendMessage(NickServ, NICK_HELP_SET_HEAD); + source.Reply(NICK_HELP_SET_HEAD); for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - it->second->OnServHelp(u); - u->SendMessage(NickServ, NICK_HELP_SET_TAIL); + it->second->OnServHelp(source); + source.Reply(NICK_HELP_SET_TAIL); return true; } else @@ -79,20 +79,20 @@ class CommandNSSet : public Command Command *c = this->FindCommand(subcommand); if (c) - return c->OnHelp(u, subcommand); + return c->OnHelp(source, subcommand); } return false; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "SET", NICK_SET_SYNTAX); + SyntaxError(source, "SET", NICK_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET); + source.Reply(NICK_HELP_CMD_SET); } bool AddSubcommand(Command *c) @@ -135,25 +135,25 @@ class CommandNSSetDisplay : public Command } change_core_display(u->Account(), params[1]); - u->SendMessage(NickServ, NICK_SET_DISPLAY_CHANGED, u->Account()->display.c_str()); + source.Reply(NICK_SET_DISPLAY_CHANGED, u->Account()->display.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_DISPLAY); + source.Reply(NICK_HELP_SET_DISPLAY); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(NickServ, u, "SET", NICK_SET_SYNTAX); + SyntaxError(source, "SET", NICK_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_DISPLAY); + source.Reply(NICK_HELP_CMD_SET_DISPLAY); } }; @@ -198,21 +198,21 @@ class CommandNSSetPassword : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_PASSWORD); + source.Reply(NICK_HELP_SET_PASSWORD); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { // XXX - SyntaxError(NickServ, u, "SET", NICK_SET_SYNTAX); + SyntaxError(source, "SET", NICK_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_PASSWORD); + source.Reply(NICK_HELP_CMD_SET_PASSWORD); } }; diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp index f99060fa6..9ba6fb5a3 100644 --- a/modules/core/ns_set_autoop.cpp +++ b/modules/core/ns_set_autoop.cpp @@ -22,7 +22,6 @@ class CommandNSSetAutoOp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetAutoOp"); @@ -41,25 +40,25 @@ class CommandNSSetAutoOp : public Command source.Reply(NICK_SASET_AUTOOP_OFF, nc->display.c_str()); } else - this->OnSyntaxError(u, "AUTOOP"); + this->OnSyntaxError(source, "AUTOOP"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_AUTOOP); + source.Reply(NICK_HELP_SET_AUTOOP); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET AUTOOP", NICK_SET_AUTOOP_SYNTAX); + SyntaxError(source, "SET AUTOOP", NICK_SET_AUTOOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_AUTOOP); + source.Reply(NICK_HELP_CMD_SET_AUTOOP); } }; @@ -70,20 +69,20 @@ class CommandNSSASetAutoOp : public CommandNSSetAutoOp { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_AUTOOP); + source.Reply(NICK_HELP_SASET_AUTOOP); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET AUTOOP", NICK_SASET_AUTOOP_SYNTAX); + SyntaxError(source, "SET AUTOOP", NICK_SASET_AUTOOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_AUTOOP); + source.Reply(NICK_HELP_CMD_SASET_AUTOOP); } }; diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp index 4f1e67506..06d56a063 100644 --- a/modules/core/ns_set_email.cpp +++ b/modules/core/ns_set_email.cpp @@ -60,15 +60,15 @@ class CommandNSSetEmail : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_EMAIL); + source.Reply(NICK_HELP_SET_EMAIL); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_EMAIL); + source.Reply(NICK_HELP_CMD_SET_EMAIL); } }; @@ -79,15 +79,15 @@ class CommandNSSASetEmail : public CommandNSSetEmail { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_EMAIL); + source.Reply(NICK_HELP_SASET_EMAIL); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_EMAIL); + source.Reply(NICK_HELP_CMD_SASET_EMAIL); } }; diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp index 27bbf8655..e1d762c6e 100644 --- a/modules/core/ns_set_greet.cpp +++ b/modules/core/ns_set_greet.cpp @@ -43,15 +43,15 @@ class CommandNSSetGreet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_GREET); + source.Reply(NICK_HELP_SET_GREET); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_GREET); + source.Reply(NICK_HELP_CMD_SET_GREET); } }; @@ -62,15 +62,15 @@ class CommandNSSASetGreet : public CommandNSSetGreet { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_GREET); + source.Reply(NICK_HELP_SASET_GREET); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_GREET); + source.Reply(NICK_HELP_CMD_SASET_GREET); } }; diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp index 2427c015b..6971eb4ab 100644 --- a/modules/core/ns_set_hide.cpp +++ b/modules/core/ns_set_hide.cpp @@ -22,7 +22,6 @@ class CommandNSSetHide : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetHide"); @@ -60,7 +59,7 @@ class CommandNSSetHide : public Command } else { - this->OnSyntaxError(u, "HIDE"); + this->OnSyntaxError(source, "HIDE"); return MOD_CONT; } @@ -75,25 +74,25 @@ class CommandNSSetHide : public Command source.Reply(offmsg, nc->display.c_str(), Config->s_NickServ.c_str()); } else - this->OnSyntaxError(u, "HIDE"); + this->OnSyntaxError(source, "HIDE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_HIDE); + source.Reply(NICK_HELP_SET_HIDE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX); + SyntaxError(source, "SET HIDE", NICK_SET_HIDE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_HIDE); + source.Reply(NICK_HELP_CMD_SET_HIDE); } }; @@ -104,20 +103,20 @@ class CommandNSSASetHide : public CommandNSSetHide { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_HIDE); + source.Reply(NICK_HELP_SASET_HIDE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); + SyntaxError(source, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_HIDE); + source.Reply(NICK_HELP_CMD_SET_HIDE); } }; diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp index 52696bf2b..20755f72e 100644 --- a/modules/core/ns_set_kill.cpp +++ b/modules/core/ns_set_kill.cpp @@ -22,7 +22,6 @@ class CommandNSSetKill : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetKill"); @@ -65,25 +64,25 @@ class CommandNSSetKill : public Command source.Reply(NICK_SASET_KILL_OFF, nc->display.c_str()); } else - this->OnSyntaxError(u, "KILL"); + this->OnSyntaxError(source, "KILL"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_KILL); + source.Reply(NICK_HELP_SET_KILL); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET KILL", Config->NSAllowKillImmed ? NICK_SET_KILL_IMMED_SYNTAX : NICK_SET_KILL_SYNTAX); + SyntaxError(source, "SET KILL", Config->NSAllowKillImmed ? NICK_SET_KILL_IMMED_SYNTAX : NICK_SET_KILL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_KILL); + source.Reply(NICK_HELP_CMD_SET_KILL); } }; @@ -94,20 +93,20 @@ class CommandNSSASetKill : public CommandNSSetKill { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_KILL); + source.Reply(NICK_HELP_SASET_KILL); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET KILL", Config->NSAllowKillImmed ? NICK_SASET_KILL_IMMED_SYNTAX : NICK_SASET_KILL_SYNTAX); + SyntaxError(source, "SASET KILL", Config->NSAllowKillImmed ? NICK_SASET_KILL_IMMED_SYNTAX : NICK_SASET_KILL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_KILL); + source.Reply(NICK_HELP_CMD_SET_KILL); } }; diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp index 2f6898aac..6231315b8 100644 --- a/modules/core/ns_set_language.cpp +++ b/modules/core/ns_set_language.cpp @@ -22,7 +22,6 @@ class CommandNSSetLanguage : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetLanguage"); @@ -36,40 +35,40 @@ class CommandNSSetLanguage : public Command break; else if (j + 1 == languages.size()) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } } nc->language = param != "en" ? param : ""; - u->SendMessage(NickServ, NICK_SET_LANGUAGE_CHANGED); + source.Reply(NICK_SET_LANGUAGE_CHANGED); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_LANGUAGE); - u->SendMessage(Config->s_NickServ, " en (English)"); + source.Reply(NICK_HELP_SET_LANGUAGE); + source.Reply(" en (English)"); for (unsigned j = 0; j < languages.size(); ++j) { const Anope::string &langname = GetString(languages[j], LANGUAGE_NAME); if (langname == "English") continue; - u->SendMessage(" %s (%s)", languages[j].c_str(), langname.c_str()); + source.Reply(" %s (%s)", languages[j].c_str(), langname.c_str()); } return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET LANGUAGE", NICK_SET_LANGUAGE_SYNTAX); + SyntaxError(source, "SET LANGUAGE", NICK_SET_LANGUAGE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_LANGUAGE); + source.Reply(NICK_HELP_CMD_SET_LANGUAGE); } }; @@ -80,20 +79,20 @@ class CommandNSSASetLanguage : public CommandNSSetLanguage { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_LANGUAGE); + source.Reply(NICK_HELP_SASET_LANGUAGE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET LANGUAGE", NICK_SASET_LANGUAGE_SYNTAX); + SyntaxError(source, "SASET LANGUAGE", NICK_SASET_LANGUAGE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_LANGUAGE); + source.Reply(NICK_HELP_CMD_SASET_LANGUAGE); } }; diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp index be2e6d350..5031f98dc 100644 --- a/modules/core/ns_set_message.cpp +++ b/modules/core/ns_set_message.cpp @@ -22,7 +22,6 @@ class CommandNSSetMessage : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetMessage"); @@ -47,25 +46,25 @@ class CommandNSSetMessage : public Command source.Reply(NICK_SASET_MSG_OFF, nc->display.c_str()); } else - this->OnSyntaxError(u, "MSG"); + this->OnSyntaxError(source, "MSG"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_MSG); + source.Reply(NICK_HELP_SET_MSG); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX); + SyntaxError(source, "SET MSG", NICK_SET_MSG_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_MSG); + source.Reply(NICK_HELP_CMD_SET_MSG); } }; @@ -76,20 +75,20 @@ class CommandNSSASetMessage : public CommandNSSetMessage { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_MSG); + source.Reply(NICK_HELP_SASET_MSG); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX); + SyntaxError(source, "SASET MSG", NICK_SASET_MSG_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_MSG); + source.Reply(NICK_HELP_CMD_SET_MSG); } }; diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp index e14d3ad15..32764dcbf 100644 --- a/modules/core/ns_set_private.cpp +++ b/modules/core/ns_set_private.cpp @@ -22,7 +22,6 @@ class CommandNSSetPrivate : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetPrivate"); @@ -41,25 +40,25 @@ class CommandNSSetPrivate : public Command source.Reply(NICK_SASET_PRIVATE_OFF, nc->display.c_str()); } else - this->OnSyntaxError(u, "PRIVATE"); + this->OnSyntaxError(source, "PRIVATE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_PRIVATE); + source.Reply(NICK_HELP_SET_PRIVATE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET PRIVATE", NICK_SET_PRIVATE_SYNTAX); + SyntaxError(source, "SET PRIVATE", NICK_SET_PRIVATE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_PRIVATE); + source.Reply(NICK_HELP_CMD_SET_PRIVATE); } }; @@ -70,20 +69,20 @@ class CommandNSSASetPrivate : public CommandNSSetPrivate { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_PRIVATE); + source.Reply(NICK_HELP_SASET_PRIVATE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET PRIVATE", NICK_SASET_PRIVATE_SYNTAX); + SyntaxError(source, "SASET PRIVATE", NICK_SASET_PRIVATE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SASET_PRIVATE); + source.Reply(NICK_HELP_CMD_SASET_PRIVATE); } }; diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp index 54628a13c..1a47aa342 100644 --- a/modules/core/ns_set_secure.cpp +++ b/modules/core/ns_set_secure.cpp @@ -22,7 +22,6 @@ class CommandNSSetSecure : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; NickAlias *na = findnick(params[0]); if (!na) throw CoreException("NULL na in CommandNSSetSecure"); @@ -41,25 +40,25 @@ class CommandNSSetSecure : public Command source.Reply(NICK_SASET_SECURE_OFF, nc->display.c_str()); } else - this->OnSyntaxError(u, "SECURE"); + this->OnSyntaxError(source, "SECURE"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SET_SECURE); + source.Reply(NICK_HELP_SET_SECURE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET SECURE", NICK_SET_SECURE_SYNTAX); + SyntaxError(source, "SET SECURE", NICK_SET_SECURE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_SECURE); + source.Reply(NICK_HELP_CMD_SET_SECURE); } }; @@ -70,20 +69,20 @@ class CommandNSSASetSecure : public CommandNSSetSecure { } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_SASET_SECURE); + source.Reply(NICK_HELP_SASET_SECURE); return true; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET SECURE", NICK_SASET_SECURE_SYNTAX); + SyntaxError(source, "SASET SECURE", NICK_SASET_SECURE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SET_SECURE); + source.Reply(NICK_HELP_CMD_SET_SECURE); } }; diff --git a/modules/core/ns_status.cpp b/modules/core/ns_status.cpp index c33ace94d..c36924179 100644 --- a/modules/core/ns_status.cpp +++ b/modules/core/ns_status.cpp @@ -49,15 +49,15 @@ class CommandNSStatus : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_HELP_STATUS); + source.Reply(NICK_HELP_STATUS); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_STATUS); + source.Reply(NICK_HELP_CMD_STATUS); } }; diff --git a/modules/core/ns_suspend.cpp b/modules/core/ns_suspend.cpp index 9d636ac85..4a404459c 100644 --- a/modules/core/ns_suspend.cpp +++ b/modules/core/ns_suspend.cpp @@ -79,27 +79,27 @@ class CommandNSSuspend : public Command ircdproto->SendGlobops(NickServ, "\2%s\2 used SUSPEND on \2%s\2", u->nick.c_str(), nick.c_str()); Log(LOG_ADMIN, u, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << ")"; - u->SendMessage(NickServ, NICK_SUSPEND_SUCCEEDED, nick.c_str()); + source.Reply(NICK_SUSPEND_SUCCEEDED, nick.c_str()); FOREACH_MOD(I_OnNickSuspended, OnNickSuspend(na)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_SUSPEND); + source.Reply(NICK_SERVADMIN_HELP_SUSPEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "SUSPEND", NICK_SUSPEND_SYNTAX); + SyntaxError(source, "SUSPEND", NICK_SUSPEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_SUSPEND); + source.Reply(NICK_HELP_CMD_SUSPEND); } }; @@ -146,27 +146,27 @@ class CommandNSUnSuspend : public Command ircdproto->SendGlobops(NickServ, "\2%s\2 used UNSUSPEND on \2%s\2", u->nick.c_str(), nick.c_str()); Log(LOG_ADMIN, u, this) << "for " << na->nick; - u->SendMessage(NickServ, NICK_UNSUSPEND_SUCCEEDED, nick.c_str()); + source.Reply(NICK_UNSUSPEND_SUCCEEDED, nick.c_str()); FOREACH_MOD(I_OnNickUnsuspended, OnNickUnsuspended(na)); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(NickServ, NICK_SERVADMIN_HELP_UNSUSPEND); + source.Reply(NICK_SERVADMIN_HELP_UNSUSPEND); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(NickServ, u, "UNSUSPEND", NICK_UNSUSPEND_SYNTAX); + SyntaxError(source, "UNSUSPEND", NICK_UNSUSPEND_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_UNSUSPEND); + source.Reply(NICK_HELP_CMD_UNSUSPEND); } }; diff --git a/modules/core/ns_update.cpp b/modules/core/ns_update.cpp index 0ce918be1..670aa6a9f 100644 --- a/modules/core/ns_update.cpp +++ b/modules/core/ns_update.cpp @@ -35,19 +35,19 @@ class CommandNSUpdate : public Command na->last_seen = Anope::CurTime; if (ircd->vhost) do_on_id(u); - u->SendMessage(NickServ, NICK_UPDATE_SUCCESS, Config->s_NickServ.c_str()); + source.Reply(NICK_UPDATE_SUCCESS, Config->s_NickServ.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &) + bool OnHelp(CommandSource &source, const Anope::string &) { - u->SendMessage(NickServ, NICK_HELP_UPDATE); + source.Reply(NICK_HELP_UPDATE); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(NickServ, NICK_HELP_CMD_UPDATE); + source.Reply(NICK_HELP_CMD_UPDATE); } }; diff --git a/modules/core/os_akill.cpp b/modules/core/os_akill.cpp index e35c6264d..5053fc7a3 100644 --- a/modules/core/os_akill.cpp +++ b/modules/core/os_akill.cpp @@ -162,7 +162,7 @@ class CommandOSAKill : public Command if (params.size() <= last_param) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -231,7 +231,7 @@ class CommandOSAKill : public Command source.Reply(READ_ONLY_MODE); } else - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -243,7 +243,7 @@ class CommandOSAKill : public Command if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -371,7 +371,7 @@ class CommandOSAKill : public Command User *u = source.u; FOREACH_MOD(I_OnDelAkill, OnDelAkill(u, NULL)); SGLine->Clear(); - u->SendMessage(OperServ, OPER_AKILL_CLEAR); + source.Reply(OPER_AKILL_CLEAR); return MOD_CONT; } @@ -382,7 +382,6 @@ class CommandOSAKill : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (cmd.equals_ci("ADD")) @@ -396,25 +395,25 @@ class CommandOSAKill : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_AKILL); + source.Reply(OPER_HELP_AKILL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "AKILL", OPER_AKILL_SYNTAX); + SyntaxError(source, "AKILL", OPER_AKILL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_AKILL); + source.Reply(OPER_HELP_CMD_AKILL); } }; diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp index ee4e1abc1..3201858e7 100644 --- a/modules/core/os_chankill.cpp +++ b/modules/core/os_chankill.cpp @@ -49,7 +49,7 @@ class CommandOSChanKill : public Command if (params.size() <= last_param) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -85,20 +85,20 @@ class CommandOSChanKill : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_CHANKILL); + source.Reply(OPER_HELP_CHANKILL); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "CHANKILL", OPER_CHANKILL_SYNTAX); + SyntaxError(source, "CHANKILL", OPER_CHANKILL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_CHANKILL); + source.Reply(OPER_HELP_CMD_CHANKILL); } }; diff --git a/modules/core/os_chanlist.cpp b/modules/core/os_chanlist.cpp index 20be8b9db..b1d76a8c4 100644 --- a/modules/core/os_chanlist.cpp +++ b/modules/core/os_chanlist.cpp @@ -22,7 +22,6 @@ class CommandOSChanList : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &pattern = !params.empty() ? params[0] : ""; const Anope::string &opt = params.size() > 1 ? params[1] : ""; std::list<ChannelModeName> Modes; @@ -69,19 +68,19 @@ class CommandOSChanList : public Command } } - u->SendMessage(OperServ, OPER_CHANLIST_END); + source.Reply(OPER_CHANLIST_END); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_CHANLIST); + source.Reply(OPER_HELP_CHANLIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_CHANLIST); + source.Reply(OPER_HELP_CMD_CHANLIST); } }; diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp index 963326296..0dd9dcedb 100644 --- a/modules/core/os_defcon.cpp +++ b/modules/core/os_defcon.cpp @@ -13,7 +13,7 @@ #include "module.h" -void defcon_sendlvls(User *u); +void defcon_sendlvls(CommandSource &source); void runDefCon(); void defconParseModeString(const Anope::string &str); void resetDefCon(int level); @@ -68,13 +68,13 @@ class CommandOSDefcon : public Command if (lvl.empty()) { source.Reply(OPER_DEFCON_CHANGED, Config->DefConLevel); - defcon_sendlvls(u); + defcon_sendlvls(source); return MOD_CONT; } newLevel = lvl.is_number_only() ? convertTo<int>(lvl) : 0; if (newLevel < 1 || newLevel > 5) { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } Config->DefConLevel = newLevel; @@ -90,8 +90,8 @@ class CommandOSDefcon : public Command if (Config->DefConTimeOut) timeout = new DefConTimeout(5); - u->SendMessage(OperServ, OPER_DEFCON_CHANGED, Config->DefConLevel); - defcon_sendlvls(u); + source.Reply(OPER_DEFCON_CHANGED, Config->DefConLevel); + defcon_sendlvls(source); Log(LOG_ADMIN, u, this) << "to change defcon level to " << newLevel; ircdproto->SendGlobops(OperServ, GetString(OPER_DEFCON_WALL).c_str(), u->nick.c_str(), newLevel); /* Global notice the user what is happening. Also any Message that @@ -113,20 +113,20 @@ class CommandOSDefcon : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_DEFCON); + source.Reply(OPER_HELP_DEFCON); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "DEFCON", OPER_DEFCON_SYNTAX); + SyntaxError(source, "DEFCON", OPER_DEFCON_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_DEFCON); + source.Reply(OPER_HELP_CMD_DEFCON); } }; @@ -206,12 +206,12 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, bool fantasy) + EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci) { if (!is_oper(u) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY))) { if (!CheckDefCon(DEFCON_SILENT_OPER_ONLY)) - u->SendMessage(OperServ, OPER_DEFCON_DENIED); + u->SendMessage(bi, OPER_DEFCON_DENIED); return EVENT_STOP; } @@ -219,45 +219,46 @@ class OSDefcon : public Module return EVENT_CONTINUE; } - EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> ¶ms) + EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { + BotInfo *service = source.owner; if (service == NickServ) { - if (command.equals_ci("REGISTER") || command.equals_ci("GROUP")) + if (command->name.equals_ci("REGISTER") || command->name.equals_ci("GROUP")) { if (CheckDefCon(DEFCON_NO_NEW_NICKS)) { - u->SendMessage(service, OPER_DEFCON_DENIED); + source.Reply(OPER_DEFCON_DENIED); return EVENT_STOP; } } } else if (ChanServ && service == ChanServ) { - if (command.equals_ci("SET")) + if (command->name.equals_ci("SET")) { if (!params.empty() && params[0].equals_ci("MLOCK") && CheckDefCon(DEFCON_NO_MLOCK_CHANGE)) { - u->SendMessage(service, OPER_DEFCON_DENIED); + source.Reply(OPER_DEFCON_DENIED); return EVENT_STOP; } } - else if (command.equals_ci("REGISTER")) + else if (command->name.equals_ci("REGISTER")) { if (CheckDefCon(DEFCON_NO_NEW_CHANNELS)) { - u->SendMessage(service, OPER_DEFCON_DENIED); + source.Reply(OPER_DEFCON_DENIED); return EVENT_STOP; } } } else if (MemoServ && service == MemoServ) { - if (command.equals_ci("SEND") || command.equals_ci("SENDALL")) + if (command->name.equals_ci("SEND") || command->name.equals_ci("SENDALL")) { if (CheckDefCon(DEFCON_NO_NEW_MEMOS)) { - u->SendMessage(service, OPER_DEFCON_DENIED); + source.Reply(OPER_DEFCON_DENIED); return EVENT_STOP; } } @@ -315,28 +316,28 @@ class OSDefcon : public Module /** * Send a message to the oper about which precautions are "active" for this level **/ -void defcon_sendlvls(User *u) +void defcon_sendlvls(CommandSource &source) { if (CheckDefCon(DEFCON_NO_NEW_CHANNELS)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_NO_NEW_CHANNELS); + source.Reply(OPER_HELP_DEFCON_NO_NEW_CHANNELS); if (CheckDefCon(DEFCON_NO_NEW_NICKS)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_NO_NEW_NICKS); + source.Reply(OPER_HELP_DEFCON_NO_NEW_NICKS); if (CheckDefCon(DEFCON_NO_MLOCK_CHANGE)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_NO_MLOCK_CHANGE); + source.Reply(OPER_HELP_DEFCON_NO_MLOCK_CHANGE); if (CheckDefCon(DEFCON_FORCE_CHAN_MODES) && !Config->DefConChanModes.empty()) - u->SendMessage(OperServ, OPER_HELP_DEFCON_FORCE_CHAN_MODES, Config->DefConChanModes.c_str()); + source.Reply(OPER_HELP_DEFCON_FORCE_CHAN_MODES, Config->DefConChanModes.c_str()); if (CheckDefCon(DEFCON_REDUCE_SESSION)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_REDUCE_SESSION, Config->DefConSessionLimit); + source.Reply(OPER_HELP_DEFCON_REDUCE_SESSION, Config->DefConSessionLimit); if (CheckDefCon(DEFCON_NO_NEW_CLIENTS)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_NO_NEW_CLIENTS); + source.Reply(OPER_HELP_DEFCON_NO_NEW_CLIENTS); if (CheckDefCon(DEFCON_OPER_ONLY)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_OPER_ONLY); + source.Reply(OPER_HELP_DEFCON_OPER_ONLY); if (CheckDefCon(DEFCON_SILENT_OPER_ONLY)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_SILENT_OPER_ONLY); + source.Reply(OPER_HELP_DEFCON_SILENT_OPER_ONLY); if (CheckDefCon(DEFCON_AKILL_NEW_CLIENTS)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_AKILL_NEW_CLIENTS); + source.Reply(OPER_HELP_DEFCON_AKILL_NEW_CLIENTS); if (CheckDefCon(DEFCON_NO_NEW_MEMOS)) - u->SendMessage(OperServ, OPER_HELP_DEFCON_NO_NEW_MEMOS); + source.Reply(OPER_HELP_DEFCON_NO_NEW_MEMOS); } void runDefCon() diff --git a/modules/core/os_global.cpp b/modules/core/os_global.cpp index 6a9bdee1d..dad7440a7 100644 --- a/modules/core/os_global.cpp +++ b/modules/core/os_global.cpp @@ -31,20 +31,20 @@ class CommandOSGlobal : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_GLOBAL, Config->s_GlobalNoticer.c_str()); + source.Reply(OPER_HELP_GLOBAL, Config->s_GlobalNoticer.c_str()); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "GLOBAL", OPER_GLOBAL_SYNTAX); + SyntaxError(source, "GLOBAL", OPER_GLOBAL_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_GLOBAL); + source.Reply(OPER_HELP_CMD_GLOBAL); } }; diff --git a/modules/core/os_help.cpp b/modules/core/os_help.cpp index 26aff62ea..1730255a4 100644 --- a/modules/core/os_help.cpp +++ b/modules/core/os_help.cpp @@ -22,17 +22,18 @@ class CommandOSHelp : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - mod_help_cmd(OperServ, source.u, params[0]); + mod_help_cmd(OperServ, source.u, NULL, params[0]); return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP); + User *u = source.u; + source.Reply(OPER_HELP); for (CommandMap::const_iterator it = OperServ->Commands.begin(), it_end = OperServ->Commands.end(); it != it_end; ++it) if (!Config->HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) - it->second->OnServHelp(u); - u->SendMessage(OperServ, OPER_HELP_LOGGED); + it->second->OnServHelp(source); + source.Reply(OPER_HELP_LOGGED); } }; diff --git a/modules/core/os_ignore.cpp b/modules/core/os_ignore.cpp index 0c2669179..79bb28d24 100644 --- a/modules/core/os_ignore.cpp +++ b/modules/core/os_ignore.cpp @@ -21,11 +21,9 @@ class CommandOSIgnore : public Command const Anope::string &time = params.size() > 1 ? params[1] : ""; const Anope::string &nick = params.size() > 2 ? params[2] : ""; - User *u = source.u; - if (time.empty() || nick.empty()) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } else @@ -60,9 +58,7 @@ class CommandOSIgnore : public Command return MOD_CONT; } - User *u = source.u; - - u->SendMessage(OperServ, OPER_IGNORE_LIST); + source.Reply(OPER_IGNORE_LIST); for (std::list<IgnoreData *>::iterator ign = ignore.begin(), ign_end = ignore.end(); ign != ign_end; ++ign) source.Reply("%s", (*ign)->mask.c_str()); @@ -71,10 +67,9 @@ class CommandOSIgnore : public Command CommandReturn DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; Anope::string nick = params.size() > 1 ? params[1] : ""; if (nick.empty()) - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); else { if (delete_ignore(nick)) @@ -90,9 +85,8 @@ class CommandOSIgnore : public Command CommandReturn DoClear(CommandSource &source) { - User *u = source.u; clear_ignores(); - u->SendMessage(OperServ, OPER_IGNORE_LIST_CLEARED); + source.Reply(OPER_IGNORE_LIST_CLEARED); return MOD_CONT; } @@ -103,7 +97,6 @@ class CommandOSIgnore : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (cmd.equals_ci("ADD")) @@ -115,25 +108,25 @@ class CommandOSIgnore : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_IGNORE); + source.Reply(OPER_HELP_IGNORE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "IGNORE", OPER_IGNORE_SYNTAX); + SyntaxError(source, "IGNORE", OPER_IGNORE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_IGNORE); + source.Reply(OPER_HELP_CMD_IGNORE); } }; diff --git a/modules/core/os_jupe.cpp b/modules/core/os_jupe.cpp index 333fbf35e..958cad388 100644 --- a/modules/core/os_jupe.cpp +++ b/modules/core/os_jupe.cpp @@ -45,20 +45,20 @@ class CommandOSJupe : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_JUPE); + source.Reply(OPER_HELP_JUPE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "JUPE", OPER_JUPE_SYNTAX); + SyntaxError(source, "JUPE", OPER_JUPE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_JUPE); + source.Reply(OPER_HELP_CMD_JUPE); } }; diff --git a/modules/core/os_kick.cpp b/modules/core/os_kick.cpp index 93acb3f52..1bf863258 100644 --- a/modules/core/os_kick.cpp +++ b/modules/core/os_kick.cpp @@ -51,20 +51,20 @@ class CommandOSKick : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_KICK); + source.Reply(OPER_HELP_KICK); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "KICK", OPER_KICK_SYNTAX); + SyntaxError(source, "KICK", OPER_KICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_KICK); + source.Reply(OPER_HELP_CMD_KICK); } }; diff --git a/modules/core/os_mode.cpp b/modules/core/os_mode.cpp index 046e31162..d0627ab16 100644 --- a/modules/core/os_mode.cpp +++ b/modules/core/os_mode.cpp @@ -41,20 +41,20 @@ class CommandOSMode : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODE); + source.Reply(OPER_HELP_MODE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "MODE", OPER_MODE_SYNTAX); + SyntaxError(source, "MODE", OPER_MODE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODE); + source.Reply(OPER_HELP_CMD_MODE); } }; diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp index 464519d1b..349b3b50a 100644 --- a/modules/core/os_modinfo.cpp +++ b/modules/core/os_modinfo.cpp @@ -64,20 +64,20 @@ class CommandOSModInfo : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODINFO); + source.Reply(OPER_HELP_MODINFO); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "MODINFO", OPER_MODULE_INFO_SYNTAX); + SyntaxError(source, "MODINFO", OPER_MODULE_INFO_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODINFO); + source.Reply(OPER_HELP_CMD_MODINFO); } }; diff --git a/modules/core/os_modlist.cpp b/modules/core/os_modlist.cpp index 9071e1052..03e6d1da3 100644 --- a/modules/core/os_modlist.cpp +++ b/modules/core/os_modlist.cpp @@ -22,7 +22,6 @@ class CommandOSModList : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string ¶m = !params.empty() ? params[0] : ""; int count = 0; @@ -130,7 +129,7 @@ class CommandOSModList : public Command } } - u->SendMessage(OperServ, OPER_MODULE_LIST_HEADER); + source.Reply(OPER_MODULE_LIST_HEADER); for (std::list<Module *>::iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) { @@ -206,15 +205,15 @@ class CommandOSModList : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODLIST); + source.Reply(OPER_HELP_MODLIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODLIST); + source.Reply(OPER_HELP_CMD_MODLIST); } }; diff --git a/modules/core/os_modload.cpp b/modules/core/os_modload.cpp index bec69bf36..1a88a9a0c 100644 --- a/modules/core/os_modload.cpp +++ b/modules/core/os_modload.cpp @@ -51,20 +51,20 @@ class CommandOSModLoad : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODLOAD); + source.Reply(OPER_HELP_MODLOAD); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "MODLOAD", OPER_MODULE_LOAD_SYNTAX); + SyntaxError(source, "MODLOAD", OPER_MODULE_LOAD_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODLOAD); + source.Reply(OPER_HELP_CMD_MODLOAD); } }; diff --git a/modules/core/os_modreload.cpp b/modules/core/os_modreload.cpp index e91391a2c..d5a6e2a15 100644 --- a/modules/core/os_modreload.cpp +++ b/modules/core/os_modreload.cpp @@ -78,20 +78,20 @@ class CommandOSModReLoad : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODRELOAD); + source.Reply(OPER_HELP_MODRELOAD); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "MODLOAD", OPER_MODULE_RELOAD_SYNTAX); + SyntaxError(source, "MODLOAD", OPER_MODULE_RELOAD_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODRELOAD); + source.Reply(OPER_HELP_CMD_MODRELOAD); } }; diff --git a/modules/core/os_modunload.cpp b/modules/core/os_modunload.cpp index b47ad5998..103ddd139 100644 --- a/modules/core/os_modunload.cpp +++ b/modules/core/os_modunload.cpp @@ -59,20 +59,20 @@ class CommandOSModUnLoad : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_MODUNLOAD); + source.Reply(OPER_HELP_MODUNLOAD); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "MODUNLOAD", OPER_MODULE_UNLOAD_SYNTAX); + SyntaxError(source, "MODUNLOAD", OPER_MODULE_UNLOAD_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_MODUNLOAD); + source.Reply(OPER_HELP_CMD_MODUNLOAD); } }; diff --git a/modules/core/os_news.cpp b/modules/core/os_news.cpp index d62904d3b..9fbf41fcf 100644 --- a/modules/core/os_news.cpp +++ b/modules/core/os_news.cpp @@ -192,7 +192,7 @@ class NewsBase : public Command int n; if (text.empty()) - this->OnSyntaxError(source.u, "ADD"); + this->OnSyntaxError(source, "ADD"); else { if (readonly) @@ -216,7 +216,7 @@ class NewsBase : public Command unsigned num; if (text.empty()) - this->OnSyntaxError(source.u, "DEL"); + this->OnSyntaxError(source, "DEL"); else { if (readonly) @@ -265,7 +265,7 @@ class NewsBase : public Command else if (cmd.equals_ci("DEL")) return this->DoDel(source, params, type, msgs); else - this->OnSyntaxError(source.u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } @@ -280,9 +280,9 @@ class NewsBase : public Command virtual CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) = 0; - virtual bool OnHelp(User *u, const Anope::string &subcommand) = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) = 0; - virtual void OnSyntaxError(User *u, const Anope::string &subcommand) = 0; + virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) = 0; }; class CommandOSLogonNews : public NewsBase @@ -297,20 +297,20 @@ class CommandOSLogonNews : public NewsBase return this->DoNews(source, params, NEWS_LOGON); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, NEWS_HELP_LOGON, Config->NewsCount); + source.Reply(NEWS_HELP_LOGON, Config->NewsCount); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "LOGONNEWS", NEWS_LOGON_SYNTAX); + SyntaxError(source, "LOGONNEWS", NEWS_LOGON_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_LOGONNEWS); + source.Reply(OPER_HELP_CMD_LOGONNEWS); } }; @@ -326,20 +326,20 @@ class CommandOSOperNews : public NewsBase return this->DoNews(source, params, NEWS_OPER); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, NEWS_HELP_OPER, Config->NewsCount); + source.Reply(NEWS_HELP_OPER, Config->NewsCount); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "OPERNEWS", NEWS_OPER_SYNTAX); + SyntaxError(source, "OPERNEWS", NEWS_OPER_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_OPERNEWS); + source.Reply(OPER_HELP_CMD_OPERNEWS); } }; @@ -355,20 +355,20 @@ class CommandOSRandomNews : public NewsBase return this->DoNews(source, params, NEWS_RANDOM); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, NEWS_HELP_RANDOM); + source.Reply(NEWS_HELP_RANDOM); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "RANDOMNEWS", NEWS_RANDOM_SYNTAX); + SyntaxError(source, "RANDOMNEWS", NEWS_RANDOM_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_RANDOMNEWS); + source.Reply(OPER_HELP_CMD_RANDOMNEWS); } }; diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index c6de2ddd2..0d740d29a 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -54,24 +54,24 @@ class CommandOSNOOP : public Command source.Reply(OPER_NOOP_REVOKE, server.c_str()); } else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_NOOP); + source.Reply(OPER_HELP_NOOP); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "NOOP", OPER_NOOP_SYNTAX); + SyntaxError(source, "NOOP", OPER_NOOP_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_NOOP); + source.Reply(OPER_HELP_CMD_NOOP); } }; diff --git a/modules/core/os_oline.cpp b/modules/core/os_oline.cpp index c3d0e4cae..e56133ec3 100644 --- a/modules/core/os_oline.cpp +++ b/modules/core/os_oline.cpp @@ -45,24 +45,24 @@ class CommandOSOLine : public Command ircdproto->SendGlobops(OperServ, "\2%s\2 used OLINE for %s", u->nick.c_str(), nick.c_str()); } else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_OLINE); + source.Reply(OPER_HELP_OLINE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "OLINE", OPER_OLINE_SYNTAX); + SyntaxError(source, "OLINE", OPER_OLINE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_OLINE); + source.Reply(OPER_HELP_CMD_OLINE); } }; diff --git a/modules/core/os_quit.cpp b/modules/core/os_quit.cpp index da02b2ed0..963bc6916 100644 --- a/modules/core/os_quit.cpp +++ b/modules/core/os_quit.cpp @@ -32,15 +32,15 @@ class CommandOSQuit : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_QUIT); + source.Reply(OPER_HELP_QUIT); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_QUIT); + source.Reply(OPER_HELP_CMD_QUIT); } }; diff --git a/modules/core/os_reload.cpp b/modules/core/os_reload.cpp index 0c42a4955..59a332874 100644 --- a/modules/core/os_reload.cpp +++ b/modules/core/os_reload.cpp @@ -22,8 +22,6 @@ class CommandOSReload : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; - try { ServerConfig *newconfig = new ServerConfig(); @@ -36,19 +34,19 @@ class CommandOSReload : public Command Log() << "Error reloading configuration file: " << ex.GetReason(); } - u->SendMessage(OperServ, OPER_RELOAD); + source.Reply(OPER_RELOAD); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_RELOAD); + source.Reply(OPER_HELP_RELOAD); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_RELOAD); + source.Reply(OPER_HELP_CMD_RELOAD); } }; diff --git a/modules/core/os_restart.cpp b/modules/core/os_restart.cpp index 77fba8a50..3715538d3 100644 --- a/modules/core/os_restart.cpp +++ b/modules/core/os_restart.cpp @@ -32,15 +32,15 @@ class CommandOSRestart : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_RESTART); + source.Reply(OPER_HELP_RESTART); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_RESTART); + source.Reply(OPER_HELP_CMD_RESTART); } }; diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index 0e2b4fbfd..bde023aaa 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -17,7 +17,6 @@ class ExceptionDelCallback : public NumberList { protected: CommandSource &source; - User *u; unsigned Deleted; public: ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), Deleted(0) @@ -41,12 +40,12 @@ class ExceptionDelCallback : public NumberList ++Deleted; - DoDel(u, Number - 1); + DoDel(source, Number - 1); } - static void DoDel(User *u, unsigned index) + static void DoDel(CommandSource &source, unsigned index) { - FOREACH_MOD(I_OnExceptionDel, OnExceptionDel(u, exceptions[index])); + FOREACH_MOD(I_OnExceptionDel, OnExceptionDel(source.u, exceptions[index])); delete exceptions[index]; exceptions.erase(exceptions.begin() + index); @@ -75,15 +74,15 @@ class ExceptionListCallback : public NumberList source.Reply(OPER_EXCEPTION_LIST_COLHEAD); } - DoList(source.u, Number - 1); + DoList(source, Number - 1); } - static void DoList(User *u, unsigned index) + static void DoList(CommandSource &source, unsigned index) { if (index >= exceptions.size()) return; - u->SendMessage(OperServ, OPER_EXCEPTION_LIST_FORMAT, index + 1, exceptions[index]->limit, exceptions[index]->mask.c_str()); + source.Reply(OPER_EXCEPTION_LIST_FORMAT, index + 1, exceptions[index]->limit, exceptions[index]->mask.c_str()); } }; @@ -105,17 +104,17 @@ class ExceptionViewCallback : public ExceptionListCallback source.Reply(OPER_EXCEPTION_LIST_HEADER); } - DoList(source.u, Number - 1); + DoList(source, Number - 1); } - static void DoList(User *u, unsigned index) + static void DoList(CommandSource &source, unsigned index) { if (index >= exceptions.size()) return; - Anope::string expirebuf = expire_left(u->Account(), exceptions[index]->expires); + Anope::string expirebuf = expire_left(source.u->Account(), exceptions[index]->expires); - u->SendMessage(OperServ, OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index]->mask.c_str(), !exceptions[index]->who.empty() ? exceptions[index]->who.c_str() : "<unknown>", do_strftime((exceptions[index]->time ? exceptions[index]->time : Anope::CurTime)).c_str(), expirebuf.c_str(), exceptions[index]->limit, exceptions[index]->reason.c_str()); + source.Reply(OPER_EXCEPTION_VIEW_FORMAT, index + 1, exceptions[index]->mask.c_str(), !exceptions[index]->who.empty() ? exceptions[index]->who.c_str() : "<unknown>", do_strftime((exceptions[index]->time ? exceptions[index]->time : Anope::CurTime)).c_str(), expirebuf.c_str(), exceptions[index]->limit, exceptions[index]->reason.c_str()); } }; @@ -169,7 +168,6 @@ class CommandOSSession : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (!Config->LimitSessions) @@ -183,25 +181,25 @@ class CommandOSSession : public Command else if (cmd.equals_ci("VIEW")) return this->DoView(source, params); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SESSION); + source.Reply(OPER_HELP_SESSION); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SESSION", OPER_SESSION_LIST_SYNTAX); + SyntaxError(source, "SESSION", OPER_SESSION_LIST_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SESSION); + source.Reply(OPER_HELP_CMD_SESSION); } }; @@ -227,7 +225,7 @@ class CommandOSException : public Command if (params.size() <= last_param) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -236,7 +234,7 @@ class CommandOSException : public Command reason += " " + params[4]; if (reason.empty()) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -278,12 +276,11 @@ class CommandOSException : public Command CommandReturn DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &mask = params.size() > 1 ? params[1] : ""; if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -298,7 +295,7 @@ class CommandOSException : public Command for (; i < end; ++i) if (mask.equals_ci(exceptions[i]->mask)) { - ExceptionDelCallback::DoDel(u, i); + ExceptionDelCallback::DoDel(source, i); source.Reply(OPER_EXCEPTION_DELETED, mask.c_str()); break; } @@ -314,15 +311,13 @@ class CommandOSException : public Command CommandReturn DoMove(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; - const Anope::string &n1str = params.size() > 1 ? params[1] : ""; /* From position */ const Anope::string &n2str = params.size() > 2 ? params[2] : ""; /* To position */ int n1, n2; if (n2str.empty()) { - this->OnSyntaxError(u, "MOVE"); + this->OnSyntaxError(source, "MOVE"); return MOD_CONT; } @@ -341,14 +336,13 @@ class CommandOSException : public Command source.Reply(READ_ONLY_MODE); } else - this->OnSyntaxError(u, "MOVE"); + this->OnSyntaxError(source, "MOVE"); return MOD_CONT; } CommandReturn DoList(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; expire_exceptions(); Anope::string mask = params.size() > 1 ? params[1] : ""; @@ -371,7 +365,7 @@ class CommandOSException : public Command source.Reply(OPER_EXCEPTION_LIST_COLHEAD); } - ExceptionListCallback::DoList(u, i); + ExceptionListCallback::DoList(source, i); } if (!SentHeader) @@ -383,7 +377,6 @@ class CommandOSException : public Command CommandReturn DoView(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; expire_exceptions(); Anope::string mask = params.size() > 1 ? params[1] : ""; @@ -405,7 +398,7 @@ class CommandOSException : public Command source.Reply(OPER_EXCEPTION_LIST_HEADER); } - ExceptionViewCallback::DoList(u, i); + ExceptionViewCallback::DoList(source, i); } if (!SentHeader) @@ -421,7 +414,6 @@ class CommandOSException : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (!Config->LimitSessions) @@ -441,25 +433,25 @@ class CommandOSException : public Command else if (cmd.equals_ci("VIEW")) return this->DoView(source, params); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_EXCEPTION); + source.Reply(OPER_HELP_EXCEPTION); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "EXCEPTION", OPER_EXCEPTION_SYNTAX); + SyntaxError(source, "EXCEPTION", OPER_EXCEPTION_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_EXCEPTION); + source.Reply(OPER_HELP_CMD_EXCEPTION); } }; diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp index 3c2a800b2..063eeaefd 100644 --- a/modules/core/os_set.cpp +++ b/modules/core/os_set.cpp @@ -41,7 +41,7 @@ class CommandOSSet : public Command if (setting.empty()) { - this->OnSyntaxError(u, "IGNORE"); + this->OnSyntaxError(source, "IGNORE"); return MOD_CONT; } @@ -70,7 +70,7 @@ class CommandOSSet : public Command if (setting.empty()) { - this->OnSyntaxError(u, "READONLY"); + this->OnSyntaxError(source, "READONLY"); return MOD_CONT; } @@ -99,7 +99,7 @@ class CommandOSSet : public Command if (setting.empty()) { - this->OnSyntaxError(u, "SUPERADMIN"); + this->OnSyntaxError(source, "SUPERADMIN"); return MOD_CONT; } @@ -137,7 +137,7 @@ class CommandOSSet : public Command if (setting.empty()) { - this->OnSyntaxError(u, "DEBUG"); + this->OnSyntaxError(source, "DEBUG"); return MOD_CONT; } @@ -172,7 +172,7 @@ class CommandOSSet : public Command if (setting.empty()) { - this->OnSyntaxError(u, "NOEXPIRE"); + this->OnSyntaxError(source, "NOEXPIRE"); return MOD_CONT; } @@ -220,34 +220,34 @@ class CommandOSSet : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { if (subcommand.empty()) - u->SendMessage(OperServ, OPER_HELP_SET); + source.Reply(OPER_HELP_SET); else if (subcommand.equals_ci("LIST")) - u->SendMessage(OperServ, OPER_HELP_SET_LIST); + source.Reply(OPER_HELP_SET_LIST); else if (subcommand.equals_ci("READONLY")) - u->SendMessage(OperServ, OPER_HELP_SET_READONLY); + source.Reply(OPER_HELP_SET_READONLY); else if (subcommand.equals_ci("NOEXPIRE")) - u->SendMessage(OperServ, OPER_HELP_SET_NOEXPIRE); + source.Reply(OPER_HELP_SET_NOEXPIRE); else if (subcommand.equals_ci("IGNORE")) - u->SendMessage(OperServ,OPER_HELP_SET_IGNORE); + source.Reply(OPER_HELP_SET_IGNORE); else if (subcommand.equals_ci("SUPERADMIN")) - u->SendMessage(OperServ, OPER_HELP_SET_SUPERADMIN); + source.Reply(OPER_HELP_SET_SUPERADMIN); else return false; return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SET", OPER_SET_SYNTAX); + SyntaxError(source, "SET", OPER_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SET); + source.Reply(OPER_HELP_CMD_SET); } }; diff --git a/modules/core/os_shutdown.cpp b/modules/core/os_shutdown.cpp index b177678aa..01a5fd8ae 100644 --- a/modules/core/os_shutdown.cpp +++ b/modules/core/os_shutdown.cpp @@ -31,15 +31,15 @@ class CommandOSShutdown : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SHUTDOWN); + source.Reply(OPER_HELP_SHUTDOWN); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SHUTDOWN); + source.Reply(OPER_HELP_CMD_SHUTDOWN); } }; diff --git a/modules/core/os_snline.cpp b/modules/core/os_snline.cpp index 214a8ee68..d3b0683c1 100644 --- a/modules/core/os_snline.cpp +++ b/modules/core/os_snline.cpp @@ -162,7 +162,7 @@ class CommandOSSNLine : public Command if (param.empty()) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -172,7 +172,7 @@ class CommandOSSNLine : public Command if (rest.find(':') == Anope::string::npos) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -247,7 +247,7 @@ class CommandOSSNLine : public Command } else - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -266,7 +266,7 @@ class CommandOSSNLine : public Command if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -399,7 +399,6 @@ class CommandOSSNLine : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (cmd.equals_ci("ADD")) @@ -413,25 +412,25 @@ class CommandOSSNLine : public Command else if (cmd.equals_ci("CLEAR")) return this->OnClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SNLINE); + source.Reply(OPER_HELP_SNLINE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SNLINE", OPER_SNLINE_SYNTAX); + SyntaxError(source, "SNLINE", OPER_SNLINE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SNLINE); + source.Reply(OPER_HELP_CMD_SNLINE); } }; diff --git a/modules/core/os_sqline.cpp b/modules/core/os_sqline.cpp index 8d1e99634..d5184a8cc 100644 --- a/modules/core/os_sqline.cpp +++ b/modules/core/os_sqline.cpp @@ -161,7 +161,7 @@ class CommandOSSQLine : public Command if (params.size() <= last_param) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -230,7 +230,7 @@ class CommandOSSQLine : public Command } else - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -249,7 +249,7 @@ class CommandOSSQLine : public Command if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -371,7 +371,7 @@ class CommandOSSQLine : public Command User *u = source.u; FOREACH_MOD(I_OnDelXLine, OnDelXLine(u, NULL, X_SQLINE)); SGLine->Clear(); - u->SendMessage(OperServ, OPER_SQLINE_CLEAR); + source.Reply(OPER_SQLINE_CLEAR); return MOD_CONT; } @@ -382,7 +382,6 @@ class CommandOSSQLine : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (cmd.equals_ci("ADD")) @@ -396,24 +395,24 @@ class CommandOSSQLine : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SQLINE); + source.Reply(OPER_HELP_SQLINE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SQLINE", OPER_SQLINE_SYNTAX); + SyntaxError(source, "SQLINE", OPER_SQLINE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SQLINE); + source.Reply(OPER_HELP_CMD_SQLINE); } }; diff --git a/modules/core/os_staff.cpp b/modules/core/os_staff.cpp index f938f2207..5bf8344ca 100644 --- a/modules/core/os_staff.cpp +++ b/modules/core/os_staff.cpp @@ -22,8 +22,7 @@ class CommandOSStaff : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; - u->SendMessage(OperServ, OPER_STAFF_LIST_HEADER); + source.Reply(OPER_STAFF_LIST_HEADER); for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config->Opers.begin(), it_end = Config->Opers.end(); it != it_end; ++it) { @@ -52,19 +51,19 @@ class CommandOSStaff : public Command } } - u->SendMessage(OperServ, END_OF_ANY_LIST, "Staff"); + source.Reply(END_OF_ANY_LIST, "Staff"); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_STAFF); + source.Reply(OPER_HELP_STAFF); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_STAFF); + source.Reply(OPER_HELP_CMD_STAFF); } }; diff --git a/modules/core/os_stats.cpp b/modules/core/os_stats.cpp index 0e425c8ae..f06c2acbb 100644 --- a/modules/core/os_stats.cpp +++ b/modules/core/os_stats.cpp @@ -122,19 +122,17 @@ class CommandOSStats : public Command CommandReturn DoStatsReset(CommandSource &source) { - User *u = source.u; maxusercnt = usercnt; - u->SendMessage(OperServ, OPER_STATS_RESET); + source.Reply(OPER_STATS_RESET); return MOD_CONT; } CommandReturn DoStatsUptime(CommandSource &source) { - User *u = source.u; time_t uptime = Anope::CurTime - start_time; int days = uptime / 86400, hours = (uptime / 3600) % 24, mins = (uptime / 60) % 60, secs = uptime % 60; - u->SendMessage(OperServ, OPER_STATS_CURRENT_USERS, usercnt, opcnt); - u->SendMessage(OperServ, OPER_STATS_MAX_USERS, maxusercnt, do_strftime(maxusertime).c_str()); + source.Reply(OPER_STATS_CURRENT_USERS, usercnt, opcnt); + source.Reply(OPER_STATS_MAX_USERS, maxusercnt, do_strftime(maxusertime).c_str()); if (days > 1) source.Reply(OPER_STATS_UPTIME_DHMS, days, hours, mins, secs); else if (days == 1) @@ -259,15 +257,15 @@ class CommandOSStats : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_STATS); + source.Reply(OPER_HELP_STATS); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_STATS); + source.Reply(OPER_HELP_CMD_STATS); } }; diff --git a/modules/core/os_svsnick.cpp b/modules/core/os_svsnick.cpp index 51e0c06b8..4a31ed91b 100644 --- a/modules/core/os_svsnick.cpp +++ b/modules/core/os_svsnick.cpp @@ -65,20 +65,20 @@ class CommandOSSVSNick : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SVSNICK); + source.Reply(OPER_HELP_SVSNICK); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SVSNICK", OPER_SVSNICK_SYNTAX); + SyntaxError(source, "SVSNICK", OPER_SVSNICK_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SVSNICK); + source.Reply(OPER_HELP_CMD_SVSNICK); } }; diff --git a/modules/core/os_szline.cpp b/modules/core/os_szline.cpp index 030bb5387..b3297146d 100644 --- a/modules/core/os_szline.cpp +++ b/modules/core/os_szline.cpp @@ -161,7 +161,7 @@ class CommandOSSZLine : public Command if (params.size() <= last_param) { - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -231,7 +231,7 @@ class CommandOSSZLine : public Command } else - this->OnSyntaxError(u, "ADD"); + this->OnSyntaxError(source, "ADD"); return MOD_CONT; } @@ -250,7 +250,7 @@ class CommandOSSZLine : public Command if (mask.empty()) { - this->OnSyntaxError(u, "DEL"); + this->OnSyntaxError(source, "DEL"); return MOD_CONT; } @@ -370,7 +370,7 @@ class CommandOSSZLine : public Command User *u = source.u; FOREACH_MOD(I_OnDelXLine, OnDelXLine(u, NULL, X_SZLINE)); SZLine->Clear(); - u->SendMessage(OperServ, OPER_SZLINE_CLEAR); + source.Reply(OPER_SZLINE_CLEAR); return MOD_CONT; } @@ -381,7 +381,6 @@ class CommandOSSZLine : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &cmd = params[0]; if (cmd.equals_ci("ADD")) @@ -395,25 +394,25 @@ class CommandOSSZLine : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SZLINE); + source.Reply(OPER_HELP_SZLINE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "SZLINE", OPER_SZLINE_SYNTAX); + SyntaxError(source, "SZLINE", OPER_SZLINE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SZLINE); + source.Reply(OPER_HELP_CMD_SZLINE); } }; diff --git a/modules/core/os_umode.cpp b/modules/core/os_umode.cpp index 352896122..83c08a075 100644 --- a/modules/core/os_umode.cpp +++ b/modules/core/os_umode.cpp @@ -34,7 +34,7 @@ class CommandOSUMode : public Command **/ if (modes[0] != '+' && modes[0] != '-') { - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); return MOD_CONT; } if (!(u2 = finduser(nick))) @@ -52,20 +52,20 @@ class CommandOSUMode : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_UMODE); + source.Reply(OPER_HELP_UMODE); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - SyntaxError(OperServ, u, "UMODE", OPER_UMODE_SYNTAX); + SyntaxError(source, "UMODE", OPER_UMODE_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_UMODE); + source.Reply(OPER_HELP_CMD_UMODE); } }; diff --git a/modules/core/os_update.cpp b/modules/core/os_update.cpp index 2b9bc20b6..fdf77534a 100644 --- a/modules/core/os_update.cpp +++ b/modules/core/os_update.cpp @@ -22,21 +22,20 @@ class CommandOSUpdate : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; - u->SendMessage(OperServ, OPER_UPDATING); + source.Reply(OPER_UPDATING); save_data = true; return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_UPDATE); + source.Reply(OPER_HELP_UPDATE); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_UPDATE); + source.Reply(OPER_HELP_CMD_UPDATE); } }; diff --git a/modules/core/os_userlist.cpp b/modules/core/os_userlist.cpp index 8a56dea2e..45a9d40ed 100644 --- a/modules/core/os_userlist.cpp +++ b/modules/core/os_userlist.cpp @@ -22,7 +22,6 @@ class CommandOSUserList : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &pattern = !params.empty() ? params[0] : ""; const Anope::string &opt = params.size() > 1 ? params[1] : ""; Channel *c; @@ -69,19 +68,19 @@ class CommandOSUserList : public Command } } - u->SendMessage(OperServ, OPER_USERLIST_END); + source.Reply(OPER_USERLIST_END); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_USERLIST); + source.Reply(OPER_HELP_USERLIST); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_USERLIST); + source.Reply(OPER_HELP_CMD_USERLIST); } }; diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp index b98efeed6..d0320f516 100644 --- a/modules/extra/cs_appendtopic.cpp +++ b/modules/extra/cs_appendtopic.cpp @@ -85,25 +85,25 @@ class CommandCSAppendTopic : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(ChanServ, u, _("Syntax: APPENDTOPIC channel text")); - u->SendMessage(Config->s_ChanServ, " "); - me->SendMessage(ChanServ, u, _("This command allows users to append text to a currently set\n" + me->SendMessage(source, _("Syntax: APPENDTOPIC channel text")); + source.Reply(" "); + me->SendMessage(source, _("This command allows users to append text to a currently set\n" "channel topic. When TOPICLOCK is on, the topic is updated and\n" "the new, updated topic is locked.")); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(ChanServ, u, _("Syntax: APPENDTOPIC channel text")); + me->SendMessage(source, _("Syntax: APPENDTOPIC channel text")); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - me->SendMessage(ChanServ, u, _(" APPENDTOPIC Add text to a channels topic")); + me->SendMessage(source, _(" APPENDTOPIC Add text to a channels topic")); } }; diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp index 4e21cf372..b15e23874 100644 --- a/modules/extra/cs_enforce.cpp +++ b/modules/extra/cs_enforce.cpp @@ -142,40 +142,40 @@ class CommandCSEnforce : public Command if (what.empty() || what.equals_ci("SET")) { this->DoSet(c); - me->SendMessage(ChanServ, u, _("Enforced %s"), !what.empty() ? what.c_str() : "SET"); + me->SendMessage(source, _("Enforced %s"), !what.empty() ? what.c_str() : "SET"); } else if (what.equals_ci("MODES")) { this->DoModes(c); - me->SendMessage(ChanServ, u, _("Enforced %s"), what.c_str()); + me->SendMessage(source, _("Enforced %s"), what.c_str()); } else if (what.equals_ci("SECUREOPS")) { this->DoSecureOps(c); - me->SendMessage(ChanServ, u, _("Enforced %s"), what.c_str()); + me->SendMessage(source, _("Enforced %s"), what.c_str()); } else if (what.equals_ci("RESTRICTED")) { this->DoRestricted(c); - me->SendMessage(ChanServ, u, _("Enforced %s"), what.c_str()); + me->SendMessage(source, _("Enforced %s"), what.c_str()); } else if (what.equals_ci("+R")) { this->DoCModeR(c); - me->SendMessage(ChanServ, u, _("Enforced %s"), what.c_str()); + me->SendMessage(source, _("Enforced %s"), what.c_str()); } else - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); } return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(ChanServ, u, _("Syntax: \002ENFORCE \037channel\037 [\037what\037]\002")); - me->SendMessage(ChanServ, u, " "); - me->SendMessage(ChanServ, u, _("Enforce various channel modes and set options. The \037channel\037\n" + me->SendMessage(source, _("Syntax: \002ENFORCE \037channel\037 [\037what\037]\002")); + me->SendMessage(source, " "); + me->SendMessage(source, _("Enforce various channel modes and set options. The \037channel\037\n" "option indicates what channel to enforce the modes and options\n" "on. The \037what\037 option indicates what modes and options to\n" "enforce, and can be any of SET, SECUREOPS, RESTRICTED, MODES,\n" @@ -186,14 +186,14 @@ class CommandCSEnforce : public Command "SECUREOPS to enforce the SECUREOPS option, even if it is not\n" "enabled. Use RESTRICTED to enfore the RESTRICTED option, also\n" "if it's not enabled.")); - me->SendMessage(ChanServ, u, " "); + me->SendMessage(source, " "); if (ModeManager::FindChannelModeByName(CMODE_REGISTERED)) - me->SendMessage(ChanServ, u, _("If \037what\037 is MODES, it will enforce channelmode +R if it is\n" + me->SendMessage(source, _("If \037what\037 is MODES, it will enforce channelmode +R if it is\n" "set. If +R is specified for \037what\037, the +R channelmode will\n" "also be enforced, but even if it is not set. If it is not set,\n" "users will be banned to ensure they don't just rejoin.")); else - me->SendMessage(ChanServ, u, _("If \037what\037 is MODES, nothing will be enforced, since it would\n" + me->SendMessage(source, _("If \037what\037 is MODES, nothing will be enforced, since it would\n" "enforce modes that the current ircd does not support. If +R is\n" "specified for \037what\037, an equalivant of channelmode +R on\n" "other ircds will be enforced. All users that are in the channel\n" @@ -203,14 +203,14 @@ class CommandCSEnforce : public Command return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(ChanServ, u, _("Syntax: \002ENFORCE \037channel\037 [\037what\037]\002")); + me->SendMessage(source, _("Syntax: \002ENFORCE \037channel\037 [\037what\037]\002")); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - me->SendMessage(ChanServ, u, _(" ENFORCE Enforce various channel modes and set options")); + me->SendMessage(source, _(" ENFORCE Enforce various channel modes and set options")); } }; diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp index 4c6dee644..aae1b5f0e 100644 --- a/modules/extra/cs_entrymsg.cpp +++ b/modules/extra/cs_entrymsg.cpp @@ -109,7 +109,7 @@ class CommandEntryMessage : public Command else if (params.size() < 3) { success = false; - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); } else if (params[1].equals_ci("ADD")) this->DoAdd(u, ci, params[2]); @@ -118,7 +118,7 @@ class CommandEntryMessage : public Command else { success = false; - this->OnSyntaxError(u, ""); + this->OnSyntaxError(source, ""); } if (success) Log(IsFounder(u, ci) ? LOG_COMMAND : LOG_OVERRIDE, u, this, ci) << params[1]; @@ -131,20 +131,20 @@ class CommandEntryMessage : public Command return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "ENTRYMSG", CHAN_ENTRYMSG_SYNTAX); + SyntaxError(source, "ENTRYMSG", CHAN_ENTRYMSG_SYNTAX); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(ChanServ, CHAN_HELP_ENTRYMSG); + source.Reply(CHAN_HELP_ENTRYMSG); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(ChanServ, CHAN_HELP_CMD_ENTRYMSG); + source.Reply(CHAN_HELP_CMD_ENTRYMSG); } }; @@ -174,7 +174,7 @@ class CSEntryMessage : public Module if (c->ci->GetExtRegular("cs_entrymsg", messages)) for (unsigned i = 0; i < messages.size(); ++i) - this->SendMessage(whosends(c->ci), u, "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str()); + u->SendMessage(whosends(c->ci)->nick, "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str()); } } diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index 0ed913b69..bdac568e5 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -39,14 +39,14 @@ class CommandCSSetMisc : public Command return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); + SyntaxError(source, "SET", CHAN_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(Config->s_ChanServ, " %-10s %s", this->name.c_str(), this->Desc.c_str()); + source.Reply(" %-10s %s", this->name.c_str(), this->Desc.c_str()); } }; @@ -57,9 +57,9 @@ class CommandCSSASetMisc : public CommandCSSetMisc { } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); + SyntaxError(source, "SASET", CHAN_SASET_SYNTAX); } }; diff --git a/modules/extra/cs_tban.cpp b/modules/extra/cs_tban.cpp index a037c8243..af29e76f6 100644 --- a/modules/extra/cs_tban.cpp +++ b/modules/extra/cs_tban.cpp @@ -80,30 +80,30 @@ class CommandCSTBan : public Command get_idealban(c->ci, u2, mask); c->SetMode(NULL, CMODE_BAN, mask); new TempBan(dotime(time), c, mask); - me->SendMessage(ChanServ, u, _("%s banned from %s, will auto-expire in %s"), mask.c_str(), c->name.c_str(), time.c_str()); + me->SendMessage(source, _("%s banned from %s, will auto-expire in %s"), mask.c_str(), c->name.c_str(), time.c_str()); } return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - this->OnSyntaxError(u, ""); - me->SendMessage(ChanServ, u, " "); - me->SendMessage(ChanServ, u, _("Bans the given user from a channel for a specified length of\n" + this->OnSyntaxError(source, ""); + me->SendMessage(source, " "); + me->SendMessage(source, _("Bans the given user from a channel for a specified length of\n" "time. If the ban is removed before by hand, it will NOT be replaced.")); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(ChanServ, u, _("Syntax: TBAN channel nick time")); + me->SendMessage(source, _("Syntax: TBAN channel nick time")); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - me->SendMessage(ChanServ, u, _(" TBAN Bans the user for a given length of time")); + me->SendMessage(source, _(" TBAN Bans the user for a given length of time")); } }; diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index b2f60236b..6c6c1c9e0 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -316,15 +316,15 @@ class CommandSQLSync : public Command CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms); - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - u->SendMessage(OperServ, OPER_HELP_SYNC); + source.Reply(OPER_HELP_SYNC); return true; } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(OperServ, OPER_HELP_CMD_SQLSYNC); + source.Reply(OPER_HELP_CMD_SQLSYNC); } }; diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index 031fa72b7..fbba8bb02 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -21,7 +21,7 @@ static bool HSRequestMemoUser = false; static bool HSRequestMemoOper = false; void my_add_host_request(const Anope::string &nick, const Anope::string &vIdent, const Anope::string &vhost, const Anope::string &creator, time_t tmp_time); -void req_send_memos(User *u, const Anope::string &vIdent, const Anope::string &vHost); +void req_send_memos(CommandSource &source, const Anope::string &vIdent, const Anope::string &vHost); struct HostRequest { @@ -62,24 +62,24 @@ class CommandHSRequest : public Command rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */ if (rawhostmask.empty()) { - me->SendMessage(HostServ, u, _("Syntax: \002REQUEST \037vhost\037\002")); + me->SendMessage(source, _("Syntax: \002REQUEST \037vhost\037\002")); 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 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; } } @@ -87,49 +87,49 @@ class CommandHSRequest : 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; } if (HSRequestMemoOper && Config->MSSendDelay > 0 && u && u->lastmemosend + Config->MSSendDelay > Anope::CurTime) { - me->SendMessage(HostServ, u, _("Please wait %d seconds before requesting a new vHost"), Config->MSSendDelay); + me->SendMessage(source, _("Please wait %d seconds before requesting a new vHost"), Config->MSSendDelay); u->lastmemosend = Anope::CurTime; return MOD_CONT; } my_add_host_request(u->nick, vIdent, hostmask, u->nick, Anope::CurTime); - me->SendMessage(HostServ, u, _("Your vHost has been requested")); - req_send_memos(u, vIdent, hostmask); + me->SendMessage(source, _("Your vHost has been requested")); + req_send_memos(source, vIdent, hostmask); Log(LOG_COMMAND, u, this, NULL) << "to request new vhost " << (!vIdent.empty() ? vIdent + "@" : "") << hostmask; return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002REQUEST \037vhost\037\002")); - me->SendMessage(HostServ, u, " "); - me->SendMessage(HostServ, u, _("Request the given vHost to be actived for your nick by the\n" + me->SendMessage(source, _("Syntax: \002REQUEST \037vhost\037\002")); + me->SendMessage(source, " "); + me->SendMessage(source, _("Request the given vHost to be actived for your nick by the\n" "network administrators. Please be patient while your request\n" "is being considered.")); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002REQUEST \037vhost\037\002")); + me->SendMessage(source, _("Syntax: \002REQUEST \037vhost\037\002")); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - me->SendMessage(HostServ, u, _(" REQUEST Request a vHost for your nick")); + me->SendMessage(source, _(" REQUEST Request a vHost for your nick")); } }; @@ -155,15 +155,15 @@ class CommandHSActivate : public Command na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time); if (HSRequestMemoUser) - memo_send(u, na->nick, _("[auto memo] Your requested vHost has been approved."), 2); + memo_send(source, na->nick, _("[auto memo] Your requested vHost has been approved."), 2); - me->SendMessage(HostServ, u, _("vHost for %s has been activated"), na->nick.c_str()); + me->SendMessage(source, _("vHost for %s has been activated"), na->nick.c_str()); Log(LOG_COMMAND, u, this, NULL) << "for " << na->nick << " for vhost " << (!it->second->ident.empty() ? it->second->ident + "@" : "") << it->second->host; delete it->second; Requests.erase(it); } else - me->SendMessage(HostServ, u, _("No request for nick %s found."), nick.c_str()); + me->SendMessage(source, _("No request for nick %s found."), nick.c_str()); } else u->SendMessage(HostServ, NICK_X_NOT_REGISTERED, nick.c_str()); @@ -171,25 +171,25 @@ class CommandHSActivate : public Command return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002ACTIVATE \037nick\037\002")); - me->SendMessage(HostServ, u, " "); - me->SendMessage(HostServ, u, _("Activate the requested vHost for the given nick.")); + me->SendMessage(source, _("Syntax: \002ACTIVATE \037nick\037\002")); + me->SendMessage(source, " "); + me->SendMessage(source, _("Activate the requested vHost for the given nick.")); if (HSRequestMemoUser) - me->SendMessage(HostServ, u, _("A memo informing the user will also be sent.")); + me->SendMessage(source, _("A memo informing the user will also be sent.")); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002ACTIVATE \037nick\037\002")); + me->SendMessage(source, _("Syntax: \002ACTIVATE \037nick\037\002")); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - me->SendMessage(HostServ, u, _(" ACTIVATE Approve the requested vHost of a user\n" + me->SendMessage(source, _(" ACTIVATE Approve the requested vHost of a user\n" " REJECT Reject the requested vHost of a user\n" " WAITING Convenience command for LIST +req")); } @@ -223,32 +223,32 @@ class CommandHSReject : public Command else snprintf(message, sizeof(message), _("[auto memo] Your requested vHost has been rejected.")); - memo_send(u, nick, message, 2); + memo_send(source, nick, message, 2); } - me->SendMessage(HostServ, u, _("vHost for %s has been rejected"), nick.c_str()); + me->SendMessage(source, _("vHost for %s has been rejected"), nick.c_str()); Log(LOG_COMMAND, u, this, NULL) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "") << ")"; } else - me->SendMessage(HostServ, u, _("No request for nick %s found."), nick.c_str()); + me->SendMessage(source, _("No request for nick %s found."), nick.c_str()); return MOD_CONT; } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002REJECT \037nick\037\002")); - me->SendMessage(HostServ, u, " "); - me->SendMessage(HostServ, u, _("Reject the requested vHost for the given nick.")); + me->SendMessage(source, _("Syntax: \002REJECT \037nick\037\002")); + me->SendMessage(source, " "); + me->SendMessage(source, _("Reject the requested vHost for the given nick.")); if (HSRequestMemoUser) - me->SendMessage(HostServ, u, _("A memo informing the user will also be sent.")); + me->SendMessage(source, _("A memo informing the user will also be sent.")); return true; } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002REJECT \037nick\037\002")); + me->SendMessage(source, _("Syntax: \002REJECT \037nick\037\002")); } }; @@ -283,7 +283,7 @@ class HSListBase : public Command { } - void OnSyntaxError(User *u, const Anope::string &subcommand) + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { // no-op } @@ -301,11 +301,11 @@ class CommandHSWaiting : public HSListBase return this->DoList(source.u); } - bool OnHelp(User *u, const Anope::string &subcommand) + bool OnHelp(CommandSource &source, const Anope::string &subcommand) { - me->SendMessage(HostServ, u, _("Syntax: \002WAITING\002")); - me->SendMessage(HostServ, u, " "); - me->SendMessage(HostServ, u, _("This command is provided for convenience. It is essentially\n" + me->SendMessage(source, _("Syntax: \002WAITING\002")); + me->SendMessage(source, " "); + me->SendMessage(source, _("This command is provided for convenience. It is essentially\n" "the same as performing a LIST +req .")); return true; @@ -348,11 +348,12 @@ class HSRequest : public Module } } - EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> ¶ms) + EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { + BotInfo *service = source.owner; if (service == HostServ) { - if (command.equals_ci("LIST")) + if (command->name.equals_ci("LIST")) { Anope::string key = params.size() ? params[0] : ""; @@ -362,12 +363,6 @@ class HSRequest : public Module Command *c = FindCommand(HostServ, "WAITING"); if (!c) throw CoreException("No waiting command?"); - CommandSource source; - source.u = u; - source.ci = NULL; - source.owner = service; - source.service = service; - source.fantasy = false; c->Execute(source, emptyParams); return EVENT_STOP; } @@ -375,9 +370,9 @@ class HSRequest : public Module } else if (service == NickServ) { - if (command.equals_ci("DROP")) + if (command->name.equals_ci("DROP")) { - NickAlias *na = findnick(u->nick); + NickAlias *na = findnick(source.u->nick); if (na) { @@ -429,7 +424,7 @@ class HSRequest : public Module } }; -void req_send_memos(User *u, const Anope::string &vIdent, const Anope::string &vHost) +void req_send_memos(CommandSource &source, const Anope::string &vIdent, const Anope::string &vHost) { Anope::string host; std::list<std::pair<Anope::string, Anope::string> >::iterator it, it_end; @@ -445,7 +440,7 @@ void req_send_memos(User *u, const Anope::string &vIdent, const Anope::string &v Anope::string nick = it->first; char message[BUFSIZE]; snprintf(message, sizeof(message), _("[auto memo] vHost \002%s\002 has been requested."), host.c_str()); - memo_send(u, nick, message, 2); + memo_send(source, nick, message, 2); } } diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp index 4eac38179..de23557a3 100644 --- a/modules/extra/m_alias.cpp +++ b/modules/extra/m_alias.cpp @@ -56,8 +56,9 @@ class ModuleAlias : public Module } } - EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, bool fantasy) + EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci) { + bool fantasy = ci != NULL; std::map<Anope::string, CommandAlias, std::less<ci::string> >::const_iterator it = aliases.find(command); if (it != aliases.end()) { diff --git a/modules/extra/ns_maxemail.cpp b/modules/extra/ns_maxemail.cpp index 9be204d29..ddde5d740 100644 --- a/modules/extra/ns_maxemail.cpp +++ b/modules/extra/ns_maxemail.cpp @@ -19,18 +19,18 @@ class NSMaxEmail : public Module { int NSEmailMax; - bool CheckLimitReached(const Anope::string &email, User *u) + bool CheckLimitReached(CommandSource &source, const Anope::string &email) { if (this->NSEmailMax < 1 || email.empty()) return false; - if (this->CountEmail(email, u) < this->NSEmailMax) + if (this->CountEmail(email, source.u) < this->NSEmailMax) return false; if (this->NSEmailMax == 1) - this->SendMessage(NickServ, u, _("The given email address has reached it's usage limit of 1 user.")); + this->SendMessage(source, _("The given email address has reached it's usage limit of 1 user.")); else - this->SendMessage(NickServ, u, _("The given email address has reached it's usage limit of %d users."), this->NSEmailMax); + this->SendMessage(source, _("The given email address has reached it's usage limit of %d users."), this->NSEmailMax); return true; } @@ -72,21 +72,22 @@ class NSMaxEmail : public Module Log(LOG_DEBUG) << "[ns_maxemail] NSEmailMax set to " << NSEmailMax; } - EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> ¶ms) + EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector<Anope::string> ¶ms) { - if (service == findbot(Config->s_NickServ)) + BotInfo *service = source.owner; + if (service == NickServ) { - if (command.equals_ci("REGISTER")) + if (command->name.equals_ci("REGISTER")) { - if (CheckLimitReached(params.size() > 1 ? params[1] : "", u)) + if (this->CheckLimitReached(source, params.size() > 1 ? params[1] : "")) return EVENT_STOP; } - else if (command.equals_ci("SET")) + else if (command->name.equals_ci("SET")) { Anope::string set = params[0]; Anope::string email = params.size() > 1 ? params[1] : ""; - if (set.equals_ci("email") && CheckLimitReached(email, u)) + if (set.equals_ci("email") && this->CheckLimitReached(source, email)) return EVENT_STOP; } } diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index f7a2f815f..87263fd64 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -43,14 +43,14 @@ class CommandNSSetMisc : public Command return MOD_CONT; } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SET", NICK_SET_SYNTAX); + SyntaxError(source, "SET", NICK_SET_SYNTAX); } - void OnServHelp(User *u) + void OnServHelp(CommandSource &source) { - u->SendMessage(Config->s_NickServ, " %-10s %s", this->name.c_str(), this->Desc.c_str()); + source.Reply(" %-10s %s", this->name.c_str(), this->Desc.c_str()); } }; @@ -61,9 +61,9 @@ class CommandNSSASetMisc : public CommandNSSetMisc { } - void OnSyntaxError(User *u, const Anope::string &) + void OnSyntaxError(CommandSource &source, const Anope::string &) { - SyntaxError(NickServ, u, "SASET", NICK_SASET_SYNTAX); + SyntaxError(source, "SASET", NICK_SASET_SYNTAX); } }; diff --git a/src/botserv.cpp b/src/botserv.cpp index 82826b489..1e7eb9551 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -332,7 +332,7 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) Anope::string message = sep.GetRemaining(); EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, ci->bi, command, message, true)); + FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, ci->bi, command, message, ci)); if (MOD_RESULT == EVENT_STOP) return; @@ -346,7 +346,7 @@ void botchanmsgs(User *u, ChannelInfo *ci, const Anope::string &buf) message = ci->name + " " + message; message = command + " " + message; - mod_run_cmd(ChanServ, u, message, true); + mod_run_cmd(ChanServ, u, message, ci); } FOREACH_MOD(I_OnBotFantasy, OnBotFantasy(command, u, ci, sep.GetRemaining())); diff --git a/src/command.cpp b/src/command.cpp index d71685f4f..7c0a503fb 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -78,11 +78,11 @@ Command::~Command() this->module->DelCommand(this->service, this); } -void Command::OnServHelp(User *u) { } +void Command::OnServHelp(CommandSource &source) { } -bool Command::OnHelp(User *u, const Anope::string &subcommand) { return false; } +bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { return false; } -void Command::OnSyntaxError(User *u, const Anope::string &subcommand) { } +void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcommand) { } void Command::SetPermission(const Anope::string &reststr) { diff --git a/src/commands.cpp b/src/commands.cpp index 97078af09..e9671f3bd 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -26,7 +26,7 @@ Command *FindCommand(BotInfo *bi, const Anope::string &name) return NULL; } -void mod_run_cmd(BotInfo *bi, User *u, const Anope::string &fullmessage, bool fantasy) +void mod_run_cmd(BotInfo *bi, User *u, const Anope::string &fullmessage, ChannelInfo *ci) { if (!bi || !u) return; @@ -39,16 +39,16 @@ void mod_run_cmd(BotInfo *bi, User *u, const Anope::string &fullmessage, bool fa message = sep.GetRemaining(); EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, bi, command, message, fantasy)); + FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, bi, command, message, ci)); if (MOD_RESULT == EVENT_STOP) return; Command *c = FindCommand(bi, command); - mod_run_cmd(bi, u, c, command, message, fantasy); + mod_run_cmd(bi, u, c, command, message, ci); } -void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, const Anope::string &message, bool fantasy) +void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, const Anope::string &message, ChannelInfo *ci) { if (!bi || !u) return; @@ -88,18 +88,7 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, params.push_back(endparam); } - if (params.size() < c->MinParams) - { - c->OnSyntaxError(u, !params.empty() ? params[params.size() - 1] : ""); - return; - } - - EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnPreCommand, OnPreCommand(u, c->service, c->name, params)); - if (MOD_RESULT == EVENT_STOP) - return; - - ChannelInfo *ci = NULL; + bool fantasy = ci != NULL; if (params.size() > 0 && !c->HasFlag(CFLAG_STRIP_CHANNEL) && (bi == ChanServ || bi == BotServ)) { if (ircdproto->IsChannelValid(params[0])) @@ -134,6 +123,24 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, } } + CommandSource source; + source.u = u; + source.ci = ci; + source.owner = bi; + source.service = fantasy && ci ? ci->bi : c->service; + source.fantasy = fantasy; + + if (params.size() < c->MinParams) + { + c->OnSyntaxError(source, !params.empty() ? params[params.size() - 1] : ""); + return; + } + + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnPreCommand, OnPreCommand(source, c, params)); + if (MOD_RESULT == EVENT_STOP) + return; + // If the command requires a permission, and they aren't registered or don't have the required perm, DENIED if (!c->permission.empty() && !u->Account()->HasCommand(c->permission)) { @@ -142,13 +149,6 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, return; } - CommandSource source; - source.u = u; - source.ci = ci; - source.owner = bi; - source.service = fantasy && ci ? ci->bi : c->service; - source.fantasy = fantasy; - CommandReturn ret = c->Execute(source, params); if (ret == MOD_CONT) @@ -159,13 +159,12 @@ void mod_run_cmd(BotInfo *bi, User *u, Command *c, const Anope::string &command, /** * Prints the help message for a given command. - * @param services Services Client - * @param u User Struct - * @param Command Hash Table + * @param bi Client the command is on + * @param u User + * @param ci Optional channel the command was executed one (fantasy) * @param cmd Command - * @return void */ -void mod_help_cmd(BotInfo *bi, User *u, const Anope::string &cmd) +void mod_help_cmd(BotInfo *bi, User *u, ChannelInfo *ci, const Anope::string &cmd) { if (!bi || !u || cmd.empty()) return; @@ -175,10 +174,16 @@ void mod_help_cmd(BotInfo *bi, User *u, const Anope::string &cmd) tokens.GetToken(token); Command *c = FindCommand(bi, token); - Anope::string subcommand = tokens.StreamEnd() ? "" : tokens.GetRemaining(); - if (!c || (Config->HidePrivilegedCommands && !c->permission.empty() && (!u->Account() || !u->Account()->HasCommand(c->permission))) || !c->OnHelp(u, subcommand)) + CommandSource source; + source.u = u; + source.ci = ci; + source.owner = bi; + source.service = ci ? ci->bi : bi; + source.fantasy = ci != NULL; + + if (!c || (Config->HidePrivilegedCommands && !c->permission.empty() && (!u->Account() || !u->Account()->HasCommand(c->permission))) || !c->OnHelp(source, subcommand)) u->SendMessage(bi, NO_HELP_AVAILABLE, cmd.c_str()); else { diff --git a/src/language.cpp b/src/language.cpp index ea6f37ee8..649398cb3 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -123,14 +123,14 @@ const Anope::string GetString(const char *domain, Anope::string language, const } #endif -void SyntaxError(BotInfo *bi, User *u, const Anope::string &command, LanguageString message) +void SyntaxError(CommandSource &source, const Anope::string &command, LanguageString message) { - if (!bi || !u || command.empty()) + if (command.empty()) return; - Anope::string str = GetString(u, message); - u->SendMessage(bi, SYNTAX_ERROR, str.c_str()); - u->SendMessage(bi, MORE_INFO, bi->nick.c_str(), command.c_str()); + Anope::string str = GetString(source.u, message); + source.Reply(SYNTAX_ERROR, str.c_str()); + source.Reply(MORE_INFO, source.owner->nick.c_str(), command.c_str()); } const char *const language_strings[LANG_STRING_COUNT] = { diff --git a/src/memoserv.cpp b/src/memoserv.cpp index eac54cc6d..ef6a9a5f8 100644 --- a/src/memoserv.cpp +++ b/src/memoserv.cpp @@ -145,7 +145,7 @@ MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid) /** * Split from do_send, this way we can easily send a memo from any point - * @param u User Struct + * @param source Where replies should go * @param name Target of the memo * @param text Memo Text * @param z type see info @@ -155,71 +155,73 @@ MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid) * 3 - reply to user and request read receipt * @return void */ -void memo_send(User *u, const Anope::string &name, const Anope::string &text, int z) +void memo_send(CommandSource &source, const Anope::string &name, const Anope::string &text, int z) { if (Config->s_MemoServ.empty()) return; + User *u = source.u; + bool ischan, isforbid; MemoInfo *mi; - Anope::string source = u->Account()->display; - int is_servoper = u->Account() && u->Account()->IsServicesOper(); + Anope::string sender = u && u->Account() ? u->Account()->display : ""; + int is_servoper = u && u->Account() && u->Account()->IsServicesOper(); if (readonly) u->SendMessage(MemoServ, MEMO_SEND_DISABLED); else if (text.empty()) { if (!z) - SyntaxError(MemoServ, u, "SEND", MEMO_SEND_SYNTAX); + SyntaxError(source, "SEND", MEMO_SEND_SYNTAX); if (z == 3) - SyntaxError(MemoServ, u, "RSEND", MEMO_RSEND_SYNTAX); + SyntaxError(source, "RSEND", MEMO_RSEND_SYNTAX); } else if (!u->IsIdentified() && !u->IsRecognized()) { if (!z || z == 3) - u->SendMessage(MemoServ, NICK_IDENTIFY_REQUIRED, Config->s_NickServ.c_str()); + source.Reply(NICK_IDENTIFY_REQUIRED, Config->s_NickServ.c_str()); } else if (!(mi = getmemoinfo(name, ischan, isforbid))) { if (!z || z == 3) { if (isforbid) - u->SendMessage(MemoServ, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str()); + source.Reply(ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str()); else - u->SendMessage(MemoServ, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str()); + source.Reply(ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str()); } } else if (z != 2 && Config->MSSendDelay > 0 && u && u->lastmemosend + Config->MSSendDelay > Anope::CurTime) { u->lastmemosend = Anope::CurTime; if (!z) - u->SendMessage(MemoServ, MEMO_SEND_PLEASE_WAIT, Config->MSSendDelay); + source.Reply(MEMO_SEND_PLEASE_WAIT, Config->MSSendDelay); if (z == 3) - u->SendMessage(MemoServ, MEMO_RSEND_PLEASE_WAIT, Config->MSSendDelay); + source.Reply(MEMO_RSEND_PLEASE_WAIT, Config->MSSendDelay); } else if (!mi->memomax && !is_servoper) { if (!z || z == 3) - u->SendMessage(MemoServ, MEMO_X_GETS_NO_MEMOS, name.c_str()); + source.Reply(MEMO_X_GETS_NO_MEMOS, name.c_str()); } else if (mi->memomax > 0 && mi->memos.size() >= mi->memomax && !is_servoper) { if (!z || z == 3) - u->SendMessage(MemoServ, MEMO_X_HAS_TOO_MANY_MEMOS, name.c_str()); + source.Reply(MEMO_X_HAS_TOO_MANY_MEMOS, name.c_str()); } else { if (!z || z == 3) - u->SendMessage(MemoServ, MEMO_SENT, name.c_str()); + source.Reply(MEMO_SENT, name.c_str()); if ((!u->Account() || !u->Account()->IsServicesOper()) && mi->HasIgnore(u)) return; u->lastmemosend = Anope::CurTime; Memo *m = new Memo(); mi->memos.push_back(m); - m->sender = source; + m->sender = sender; m->time = Anope::CurTime; m->text = text; m->SetFlag(MF_UNREAD); @@ -244,13 +246,13 @@ void memo_send(User *u, const Anope::string &name, const Anope::string &text, in NickAlias *na = *it; User *user = finduser(na->nick); if (user && user->IsIdentified()) - user->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->s_MemoServ.c_str(), mi->memos.size()); + source.Reply(MEMO_NEW_MEMO_ARRIVED, sender.c_str(), Config->s_MemoServ.c_str(), mi->memos.size()); } } else { if ((u = finduser(name)) && u->IsIdentified() && nc->HasFlag(NI_MEMO_RECEIVE)) - u->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->s_MemoServ.c_str(), mi->memos.size()); + source.Reply(MEMO_NEW_MEMO_ARRIVED, sender.c_str(), Config->s_MemoServ.c_str(), mi->memos.size()); } /* if (flags & MEMO_RECEIVE) */ } /* if (MSNotifyAll) */ @@ -333,7 +335,7 @@ static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m) /* Send receipt notification to sender. */ -void rsend_notify(User *u, Memo *m, const Anope::string &chan) +void rsend_notify(CommandSource &source, Memo *m, const Anope::string &chan) { /* Only send receipt if memos are allowed */ if (!readonly) @@ -359,11 +361,11 @@ void rsend_notify(User *u, Memo *m, const Anope::string &chan) snprintf(text, sizeof(text), "%s", GetString(na->nc, MEMO_RSEND_NICK_MEMO_TEXT).c_str()); /* Send notification */ - memo_send(u, m->sender, text, 2); + memo_send(source, m->sender, text, 2); /* Notify recepient of the memo that a notification has been sent to the sender */ - u->SendMessage(MemoServ, MEMO_RSEND_USER_NOTIFICATION, nc->display.c_str()); + source.Reply(MEMO_RSEND_USER_NOTIFICATION, nc->display.c_str()); } /* Remove receipt flag from the original memo */ diff --git a/src/modules.cpp b/src/modules.cpp index 1fc83c06e..63e6bcab3 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -282,9 +282,9 @@ Version Module::GetVersion() const return Version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD); } -void Module::SendMessage(BotInfo *from, User *to, const char *fmt, ...) +void Module::SendMessage(CommandSource &source, const char *fmt, ...) { - Anope::string language = (to && to->Account() ? to->Account()->language : ""); + Anope::string language = (source.u && source.u->Account() ? source.u->Account()->language : ""); Anope::string message = GetString(this->name.c_str(), language, fmt); @@ -298,7 +298,7 @@ void Module::SendMessage(BotInfo *from, User *to, const char *fmt, ...) Anope::string token; while (sep.GetToken(token)) - to->SendMessage(from->nick, token); + source.Reply(token.c_str()); } Service::Service(Module *o, const Anope::string &n) : owner(o), name(n) |