From 71c433cc502cc6073dd1e9d5cab3f49f8f6fd49e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 27 Nov 2010 00:04:13 -0600 Subject: The rest of the earlier command changes --- include/commands.h | 18 ++-- include/extern.h | 6 +- include/modules.h | 14 ++- modules/core/bs_act.cpp | 12 +-- modules/core/bs_assign.cpp | 14 +-- modules/core/bs_badwords.cpp | 16 ++-- modules/core/bs_bot.cpp | 24 ++--- modules/core/bs_botlist.cpp | 8 +- modules/core/bs_help.cpp | 12 +-- modules/core/bs_info.cpp | 12 +-- modules/core/bs_kick.cpp | 34 +++---- modules/core/bs_say.cpp | 14 +-- modules/core/bs_set.cpp | 47 +++++----- modules/core/bs_unassign.cpp | 12 +-- modules/core/cs_access.cpp | 42 ++++----- modules/core/cs_akick.cpp | 20 ++-- modules/core/cs_ban.cpp | 12 +-- modules/core/cs_clearusers.cpp | 14 +-- modules/core/cs_clone.cpp | 14 +-- modules/core/cs_drop.cpp | 17 ++-- modules/core/cs_forbid.cpp | 16 ++-- modules/core/cs_getkey.cpp | 14 +-- modules/core/cs_help.cpp | 13 +-- modules/core/cs_info.cpp | 22 ++--- modules/core/cs_invite.cpp | 12 +-- modules/core/cs_kick.cpp | 12 +-- modules/core/cs_list.cpp | 16 ++-- modules/core/cs_mode.cpp | 16 ++-- modules/core/cs_modes.cpp | 167 ++++++++++++++++------------------ modules/core/cs_register.cpp | 8 +- modules/core/cs_saset.cpp | 18 ++-- modules/core/cs_saset_noexpire.cpp | 15 ++- modules/core/cs_set.cpp | 18 ++-- modules/core/cs_set_bantype.cpp | 20 ++-- modules/core/cs_set_description.cpp | 23 +++-- modules/core/cs_set_founder.cpp | 22 ++--- modules/core/cs_set_keeptopic.cpp | 23 +++-- modules/core/cs_set_opnotice.cpp | 23 +++-- modules/core/cs_set_peace.cpp | 23 +++-- modules/core/cs_set_persist.cpp | 23 +++-- modules/core/cs_set_private.cpp | 23 +++-- modules/core/cs_set_restricted.cpp | 23 +++-- modules/core/cs_set_secure.cpp | 23 +++-- modules/core/cs_set_securefounder.cpp | 22 ++--- modules/core/cs_set_secureops.cpp | 23 +++-- modules/core/cs_set_signkick.cpp | 23 +++-- modules/core/cs_set_successor.cpp | 20 ++-- modules/core/cs_set_topiclock.cpp | 23 +++-- modules/core/cs_set_xop.cpp | 22 ++--- modules/core/cs_status.cpp | 13 ++- modules/core/cs_suspend.cpp | 30 +++--- modules/core/cs_topic.cpp | 12 +-- modules/core/cs_unban.cpp | 12 +-- modules/core/cs_xop.cpp | 75 ++++++++------- modules/core/hs_del.cpp | 12 +-- modules/core/hs_delall.cpp | 12 +-- modules/core/hs_group.cpp | 8 +- modules/core/hs_help.cpp | 9 +- modules/core/hs_list.cpp | 8 +- modules/core/hs_off.cpp | 8 +- modules/core/hs_on.cpp | 8 +- modules/core/hs_set.cpp | 12 +-- modules/core/hs_setall.cpp | 12 +-- modules/core/ms_cancel.cpp | 12 +-- modules/core/ms_check.cpp | 12 +-- modules/core/ms_del.cpp | 14 +-- modules/core/ms_help.cpp | 11 ++- modules/core/ms_ignore.cpp | 14 +-- modules/core/ms_info.cpp | 11 ++- modules/core/ms_list.cpp | 14 +-- modules/core/ms_read.cpp | 23 +++-- modules/core/ms_rsend.cpp | 16 ++-- modules/core/ms_send.cpp | 15 ++- modules/core/ms_sendall.cpp | 16 ++-- modules/core/ms_set.cpp | 27 +++--- modules/core/ms_staff.cpp | 14 +-- modules/core/ns_access.cpp | 18 ++-- modules/core/ns_alist.cpp | 11 ++- modules/core/ns_drop.cpp | 11 ++- modules/core/ns_forbid.cpp | 16 ++-- modules/core/ns_getemail.cpp | 12 +-- modules/core/ns_getpass.cpp | 12 +-- modules/core/ns_ghost.cpp | 12 +-- modules/core/ns_group.cpp | 31 ++++--- modules/core/ns_help.cpp | 15 +-- modules/core/ns_identify.cpp | 12 +-- modules/core/ns_info.cpp | 12 +-- modules/core/ns_list.cpp | 22 +++-- modules/core/ns_logout.cpp | 17 ++-- modules/core/ns_recover.cpp | 14 +-- modules/core/ns_register.cpp | 41 +++++---- modules/core/ns_release.cpp | 13 +-- modules/core/ns_resetpass.cpp | 26 +++--- modules/core/ns_saset.cpp | 45 +++++---- modules/core/ns_saset_noexpire.cpp | 15 ++- modules/core/ns_sendpass.cpp | 12 +-- modules/core/ns_set.cpp | 44 ++++----- modules/core/ns_set_autoop.cpp | 27 +++--- modules/core/ns_set_email.cpp | 16 ++-- modules/core/ns_set_greet.cpp | 16 ++-- modules/core/ns_set_hide.cpp | 29 +++--- modules/core/ns_set_kill.cpp | 27 +++--- modules/core/ns_set_language.cpp | 33 ++++--- modules/core/ns_set_message.cpp | 27 +++--- modules/core/ns_set_private.cpp | 27 +++--- modules/core/ns_set_secure.cpp | 27 +++--- modules/core/ns_status.cpp | 8 +- modules/core/ns_suspend.cpp | 28 +++--- modules/core/ns_update.cpp | 10 +- modules/core/os_akill.cpp | 23 +++-- modules/core/os_chankill.cpp | 14 +-- modules/core/os_chanlist.cpp | 11 +-- modules/core/os_defcon.cpp | 67 +++++++------- modules/core/os_global.cpp | 12 +-- modules/core/os_help.cpp | 11 ++- modules/core/os_ignore.cpp | 29 +++--- modules/core/os_jupe.cpp | 12 +-- modules/core/os_kick.cpp | 12 +-- modules/core/os_mode.cpp | 12 +-- modules/core/os_modinfo.cpp | 12 +-- modules/core/os_modlist.cpp | 11 +-- modules/core/os_modload.cpp | 12 +-- modules/core/os_modreload.cpp | 12 +-- modules/core/os_modunload.cpp | 12 +-- modules/core/os_news.cpp | 46 +++++----- modules/core/os_noop.cpp | 14 +-- modules/core/os_oline.cpp | 14 +-- modules/core/os_quit.cpp | 8 +- modules/core/os_reload.cpp | 12 +-- modules/core/os_restart.cpp | 8 +- modules/core/os_session.cpp | 72 +++++++-------- modules/core/os_set.cpp | 32 +++---- modules/core/os_shutdown.cpp | 8 +- modules/core/os_snline.cpp | 23 +++-- modules/core/os_sqline.cpp | 23 +++-- modules/core/os_staff.cpp | 13 ++- modules/core/os_stats.cpp | 16 ++-- modules/core/os_svsnick.cpp | 12 +-- modules/core/os_szline.cpp | 23 +++-- modules/core/os_umode.cpp | 14 +-- modules/core/os_update.cpp | 11 +-- modules/core/os_userlist.cpp | 11 +-- modules/extra/cs_appendtopic.cpp | 16 ++-- modules/extra/cs_enforce.cpp | 34 +++---- modules/extra/cs_entrymsg.cpp | 18 ++-- modules/extra/cs_set_misc.cpp | 12 +-- modules/extra/cs_tban.cpp | 18 ++-- modules/extra/db_mysql.cpp | 8 +- modules/extra/hs_request.cpp | 109 +++++++++++----------- modules/extra/m_alias.cpp | 3 +- modules/extra/ns_maxemail.cpp | 21 +++-- modules/extra/ns_set_misc.cpp | 12 +-- src/botserv.cpp | 4 +- src/command.cpp | 6 +- src/commands.cpp | 65 +++++++------ src/language.cpp | 10 +- src/memoserv.cpp | 42 +++++---- src/modules.cpp | 6 +- 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 virtual CommandReturn Execute(CommandSource &source, const std::vector ¶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 ¶ms) { return EVENT_CONTINUE; } + virtual EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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 ¶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_u