diff options
author | Adam <Adam@drink-coca-cola.info> | 2010-05-30 17:21:44 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 21:04:09 -0400 |
commit | 6cd88494662c5c4af2da891926dcc82367596cb9 (patch) | |
tree | 59f67163abee4e7468a26b25f9cecca270f57b70 /src | |
parent | b8f9116b19eb511c4f5e6a683725f50bf732a7dd (diff) |
Moved the *Serv help functions to Command, will come in use later with subcommands
Diffstat (limited to 'src')
115 files changed, 696 insertions, 765 deletions
diff --git a/src/command.cpp b/src/command.cpp index b440c741f..7fd5975ef 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -22,6 +22,8 @@ Command::~Command() CommandReturn Command::Execute(User *u, const std::vector<ci::string> &) { return MOD_CONT; } +void Command::OnServHelp(User *u) { } + bool Command::OnHelp(User *u, const ci::string &subcommand) { return false; } void Command::OnSyntaxError(User *u, const ci::string &subcommand) { } diff --git a/src/core/bs_act.cpp b/src/core/bs_act.cpp index da921b47a..d313fd587 100644 --- a/src/core/bs_act.cpp +++ b/src/core/bs_act.cpp @@ -65,6 +65,11 @@ class CommandBSAct : public Command notice_help(Config.s_BotServ, u, BOT_HELP_ACT); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ACT); + } }; class BSAct : public Module @@ -76,12 +81,6 @@ class BSAct : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSAct()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ACT); } }; diff --git a/src/core/bs_assign.cpp b/src/core/bs_assign.cpp index dc847eb66..d5fa0bdef 100644 --- a/src/core/bs_assign.cpp +++ b/src/core/bs_assign.cpp @@ -75,6 +75,11 @@ class CommandBSAssign : public Command { syntax_error(Config.s_BotServ, u, "ASSIGN", BOT_ASSIGN_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ASSIGN); + } }; class BSAssign : public Module @@ -86,12 +91,6 @@ class BSAssign : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSAssign); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ASSIGN); } }; diff --git a/src/core/bs_badwords.cpp b/src/core/bs_badwords.cpp index 62a9ef665..7a9c6ebdf 100644 --- a/src/core/bs_badwords.cpp +++ b/src/core/bs_badwords.cpp @@ -259,6 +259,11 @@ class CommandBSBadwords : public Command { syntax_error(Config.s_BotServ, u, "BADWORDS", BOT_BADWORDS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BADWORDS); + } }; class BSBadwords : public Module @@ -270,12 +275,6 @@ class BSBadwords : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSBadwords); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BADWORDS); } }; diff --git a/src/core/bs_bot.cpp b/src/core/bs_bot.cpp index 2c5888554..1d3103e29 100644 --- a/src/core/bs_bot.cpp +++ b/src/core/bs_bot.cpp @@ -409,6 +409,11 @@ class CommandBSBot : public Command { syntax_error(Config.s_BotServ, u, "BOT", BOT_BOT_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BOT); + } }; class BSBot : public Module @@ -420,12 +425,6 @@ class BSBot : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSBot()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BOT); } }; diff --git a/src/core/bs_botlist.cpp b/src/core/bs_botlist.cpp index 12c90ab8b..ebebf7a71 100644 --- a/src/core/bs_botlist.cpp +++ b/src/core/bs_botlist.cpp @@ -73,6 +73,11 @@ class CommandBSBotList : public Command notice_help(Config.s_BotServ, u, BOT_HELP_BOTLIST); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BOTLIST); + } }; class BSBotList : public Module @@ -84,12 +89,6 @@ class BSBotList : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSBotList()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BOTLIST); } }; diff --git a/src/core/bs_help.cpp b/src/core/bs_help.cpp index a3e53df5c..80070c138 100644 --- a/src/core/bs_help.cpp +++ b/src/core/bs_help.cpp @@ -33,7 +33,8 @@ class CommandBSHelp : public Command { // Abuse syntax error to display general list help. notice_help(Config.s_BotServ, u, BOT_HELP); - FOREACH_MOD(I_OnBotServHelp, OnBotServHelp(u)); + for (CommandMap::const_iterator it = BotServ->Commands.begin(); it != BotServ->Commands.end(); ++it) + it->second->OnServHelp(u); notice_help(Config.s_BotServ, u, BOT_HELP_FOOTER, Config.BSMinUsers); } }; diff --git a/src/core/bs_info.cpp b/src/core/bs_info.cpp index f7d6fb46d..4e8cf042f 100644 --- a/src/core/bs_info.cpp +++ b/src/core/bs_info.cpp @@ -240,6 +240,11 @@ class CommandBSInfo : public Command { syntax_error(Config.s_BotServ, u, "INFO", BOT_INFO_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_INFO); + } }; class BSInfo : public Module @@ -251,12 +256,6 @@ class BSInfo : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSInfo()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_INFO); } }; diff --git a/src/core/bs_kick.cpp b/src/core/bs_kick.cpp index ab2782c8d..6c8e020e4 100644 --- a/src/core/bs_kick.cpp +++ b/src/core/bs_kick.cpp @@ -325,6 +325,11 @@ class CommandBSKick : public Command { syntax_error(Config.s_BotServ, u, "KICK", BOT_KICK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_KICK); + } }; class BSKick : public Module @@ -336,12 +341,6 @@ class BSKick : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSKick()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_KICK); } }; diff --git a/src/core/bs_say.cpp b/src/core/bs_say.cpp index 8dfc55115..a388a1ec9 100644 --- a/src/core/bs_say.cpp +++ b/src/core/bs_say.cpp @@ -71,6 +71,11 @@ class CommandBSSay : public Command { syntax_error(Config.s_BotServ, u, "SAY", BOT_SAY_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_SAY); + } }; class BSSay : public Module @@ -82,12 +87,6 @@ class BSSay : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSSay()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_SAY); } }; diff --git a/src/core/bs_set.cpp b/src/core/bs_set.cpp index 3468198a2..a5fee9d4f 100644 --- a/src/core/bs_set.cpp +++ b/src/core/bs_set.cpp @@ -176,6 +176,11 @@ class CommandBSSet : public Command { syntax_error(Config.s_BotServ, u, "SET", BOT_SET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_SET); + } }; class BSSet : public Module { @@ -186,12 +191,6 @@ class BSSet : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSSet()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_SET); } }; diff --git a/src/core/bs_unassign.cpp b/src/core/bs_unassign.cpp index 067e4cc14..72e62a310 100644 --- a/src/core/bs_unassign.cpp +++ b/src/core/bs_unassign.cpp @@ -53,6 +53,11 @@ class CommandBSUnassign : public Command { syntax_error(Config.s_BotServ, u, "UNASSIGN", BOT_UNASSIGN_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_UNASSIGN); + } }; class BSUnassign : public Module @@ -64,12 +69,6 @@ class BSUnassign : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(BotServ, new CommandBSUnassign); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_UNASSIGN); } }; diff --git a/src/core/cs_access.cpp b/src/core/cs_access.cpp index 02a04b51c..49d253d12 100644 --- a/src/core/cs_access.cpp +++ b/src/core/cs_access.cpp @@ -637,6 +637,12 @@ class CommandCSLevels : public Command { syntax_error(Config.s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_ACCESS); + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_LEVELS); + } }; @@ -651,13 +657,6 @@ class CSAccess : public Module this->AddCommand(ChanServ, new CommandCSAccess()); this->AddCommand(ChanServ, new CommandCSLevels()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_ACCESS); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_LEVELS); } }; diff --git a/src/core/cs_akick.cpp b/src/core/cs_akick.cpp index 09ec7c3fc..e2ad9de99 100644 --- a/src/core/cs_akick.cpp +++ b/src/core/cs_akick.cpp @@ -570,6 +570,11 @@ class CommandCSAKick : public Command { syntax_error(Config.s_ChanServ, u, "AKICK", CHAN_AKICK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_AKICK); + } }; @@ -584,12 +589,6 @@ class CSAKick : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSAKick()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_AKICK); } }; diff --git a/src/core/cs_ban.cpp b/src/core/cs_ban.cpp index 39f290d98..9aee9d1dc 100644 --- a/src/core/cs_ban.cpp +++ b/src/core/cs_ban.cpp @@ -93,6 +93,11 @@ class CommandCSBan : public Command { syntax_error(Config.s_ChanServ, u, "BAN", CHAN_BAN_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_BAN); + } }; @@ -106,12 +111,6 @@ class CSBan : public Module this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSBan("BAN")); this->AddCommand(ChanServ, new CommandCSBan("KB")); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_BAN); } }; diff --git a/src/core/cs_clear.cpp b/src/core/cs_clear.cpp index 5e7ef2674..f331f7a24 100644 --- a/src/core/cs_clear.cpp +++ b/src/core/cs_clear.cpp @@ -161,6 +161,11 @@ class CommandCSClear : public Command { syntax_error(Config.s_ChanServ, u, "CLEAR", CHAN_CLEAR_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_CLEAR); + } }; class CSClear : public Module @@ -172,12 +177,6 @@ class CSClear : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSClear()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_CLEAR); } }; diff --git a/src/core/cs_drop.cpp b/src/core/cs_drop.cpp index afeb522a9..04b2f595f 100644 --- a/src/core/cs_drop.cpp +++ b/src/core/cs_drop.cpp @@ -104,6 +104,11 @@ class CommandCSDrop : public Command { syntax_error(Config.s_ChanServ, u, "DROP", CHAN_DROP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DROP); + } }; class CSDrop : public Module @@ -115,12 +120,6 @@ class CSDrop : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSDrop()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DROP); } }; diff --git a/src/core/cs_forbid.cpp b/src/core/cs_forbid.cpp index ad9881782..d59be57b2 100644 --- a/src/core/cs_forbid.cpp +++ b/src/core/cs_forbid.cpp @@ -109,6 +109,11 @@ class CommandCSForbid : public Command { syntax_error(Config.s_ChanServ, u, "FORBID", CHAN_FORBID_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_FORBID); + } }; class CSForbid : public Module @@ -120,12 +125,6 @@ class CSForbid : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSForbid()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_FORBID); } }; diff --git a/src/core/cs_getkey.cpp b/src/core/cs_getkey.cpp index 935a2bdbe..dc89bbbd0 100644 --- a/src/core/cs_getkey.cpp +++ b/src/core/cs_getkey.cpp @@ -55,6 +55,11 @@ class CommandCSGetKey : public Command { syntax_error(Config.s_ChanServ, u, "GETKEY", CHAN_GETKEY_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_GETKEY); + } }; @@ -67,12 +72,6 @@ class CSGetKey : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSGetKey()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_GETKEY); } }; diff --git a/src/core/cs_help.cpp b/src/core/cs_help.cpp index 941634483..3fe704349 100644 --- a/src/core/cs_help.cpp +++ b/src/core/cs_help.cpp @@ -54,7 +54,8 @@ class CommandCSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_ChanServ, u, CHAN_HELP); - FOREACH_MOD(I_OnChanServHelp, OnChanServHelp(u)); + for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it) + it->second->OnServHelp(u); if (Config.CSExpire >= 86400) notice_help(Config.s_ChanServ, u, CHAN_HELP_EXPIRES, Config.CSExpire / 86400); if (u->Account() && u->Account()->IsServicesOper()) diff --git a/src/core/cs_info.cpp b/src/core/cs_info.cpp index c0c99c856..4e5bf9159 100644 --- a/src/core/cs_info.cpp +++ b/src/core/cs_info.cpp @@ -158,6 +158,11 @@ class CommandCSInfo : public Command { syntax_error(Config.s_ChanServ, u, "INFO", CHAN_INFO_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_INFO); + } }; class CSInfo : public Module @@ -169,12 +174,6 @@ class CSInfo : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSInfo()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_INFO); } }; diff --git a/src/core/cs_invite.cpp b/src/core/cs_invite.cpp index bf243080f..40999af83 100644 --- a/src/core/cs_invite.cpp +++ b/src/core/cs_invite.cpp @@ -74,6 +74,11 @@ class CommandCSInvite : public Command { syntax_error(Config.s_ChanServ, u, "INVITE", CHAN_INVITE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_INVITE); + } }; class CSInvite : public Module @@ -85,12 +90,6 @@ class CSInvite : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSInvite()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_INVITE); } }; diff --git a/src/core/cs_kick.cpp b/src/core/cs_kick.cpp index 1c05ea77e..e28b1f176 100644 --- a/src/core/cs_kick.cpp +++ b/src/core/cs_kick.cpp @@ -79,6 +79,11 @@ class CommandCSKick : public Command { syntax_error(Config.s_ChanServ, u, "KICK", CHAN_KICK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_KICK); + } }; class CSKick : public Module @@ -91,12 +96,6 @@ class CSKick : public Module this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSKick("KICK")); this->AddCommand(ChanServ, new CommandCSKick("K")); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_KICK); } }; diff --git a/src/core/cs_list.cpp b/src/core/cs_list.cpp index 4b6f1d242..9e8ed1779 100644 --- a/src/core/cs_list.cpp +++ b/src/core/cs_list.cpp @@ -178,6 +178,11 @@ public: { syntax_error(Config.s_ChanServ, u, "LIST", CHAN_LIST_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_LIST); + } }; class CSList : public Module @@ -189,12 +194,6 @@ public: this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSList()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_LIST); } }; diff --git a/src/core/cs_modes.cpp b/src/core/cs_modes.cpp index 312bc55dc..67d38ba49 100644 --- a/src/core/cs_modes.cpp +++ b/src/core/cs_modes.cpp @@ -92,6 +92,11 @@ class CommandCSOp : public Command { syntax_error(Config.s_ChanServ, u, "OP", CHAN_OP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_OP); + } }; @@ -119,6 +124,11 @@ class CommandCSDeOp : public Command { syntax_error(Config.s_ChanServ, u, "DEOP", CHAN_DEOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEOP); + } }; @@ -146,6 +156,11 @@ class CommandCSVoice : public Command { syntax_error(Config.s_ChanServ, u, "VOICE", CHAN_VOICE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_VOICE); + } }; @@ -173,6 +188,11 @@ class CommandCSDeVoice : public Command { syntax_error(Config.s_ChanServ, u, "DEVOICE", CHAN_DEVOICE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEVOICE); + } }; @@ -205,6 +225,11 @@ class CommandCSHalfOp : public Command { syntax_error(Config.s_ChanServ, u, "HALFOP", CHAN_HALFOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_HALFOP); + } }; @@ -238,6 +263,11 @@ class CommandCSDeHalfOp : public Command { syntax_error(Config.s_ChanServ, u, "DEHALFOP", CHAN_DEHALFOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEHALFOP); + } }; @@ -270,6 +300,11 @@ class CommandCSProtect : public Command { syntax_error(Config.s_ChanServ, u, "PROTECT", CHAN_PROTECT_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_PROTECT); + } }; class CommandCSDeProtect : public Command @@ -301,6 +336,11 @@ class CommandCSDeProtect : public Command { syntax_error(Config.s_ChanServ, u, "DEPROTECT", CHAN_DEPROTECT_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEPROTECT); + } }; class CommandCSOwner : public Command @@ -332,6 +372,11 @@ class CommandCSOwner : public Command { syntax_error(Config.s_ChanServ, u, "OWNER", CHAN_OWNER_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_OWNER); + } }; class CommandCSDeOwner : public Command @@ -363,6 +408,11 @@ class CommandCSDeOwner : public Command { syntax_error(Config.s_ChanServ, u, "DEOWNER", CHAN_DEOWNER_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEOWNER); + } }; @@ -384,9 +434,9 @@ class CSModes : public Module OnUplinkSync(NULL); Implementation i[] = { - I_OnUplinkSync, I_OnServerDisconnect, I_OnChanServHelp + I_OnUplinkSync, I_OnServerDisconnect }; - ModuleManager::Attach(i, this, 3); + ModuleManager::Attach(i, this, 2); } void OnUplinkSync(Server *) @@ -419,33 +469,6 @@ class CSModes : public Module this->DelCommand(ChanServ, FindCommand(ChanServ, "HALFOP")); this->DelCommand(ChanServ, FindCommand(ChanServ, "DEHALFOP")); } - - void OnChanServHelp(User *u) - { - if (ModeManager::FindChannelModeByName(CMODE_OWNER)) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_OWNER); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEOWNER); - } - - if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_PROTECT); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEPROTECT); - } - - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_OP); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEOP); - - if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_HALFOP); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEHALFOP); - } - - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_VOICE); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_DEVOICE); - } }; diff --git a/src/core/cs_register.cpp b/src/core/cs_register.cpp index 882e0e17c..1706ac16e 100644 --- a/src/core/cs_register.cpp +++ b/src/core/cs_register.cpp @@ -112,6 +112,11 @@ class CommandCSRegister : public Command { syntax_error(Config.s_ChanServ, u, "REGISTER", CHAN_REGISTER_SYNTAX); } + + void OnSyntaxError(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_REGISTER); + } }; class CSRegister : public Module @@ -124,12 +129,6 @@ class CSRegister : public Module this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSRegister()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_REGISTER); } }; diff --git a/src/core/cs_set.cpp b/src/core/cs_set.cpp index 71136bc2b..f169e2264 100644 --- a/src/core/cs_set.cpp +++ b/src/core/cs_set.cpp @@ -812,6 +812,11 @@ class CommandCSSet : public Command syntax_error(Config.s_ChanServ, u, command.c_str(), reply); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SET); + } }; class CSSet : public Module @@ -823,12 +828,6 @@ class CSSet : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSSet()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SET); } }; diff --git a/src/core/cs_status.cpp b/src/core/cs_status.cpp index 9db2b2d00..174d1a2d8 100644 --- a/src/core/cs_status.cpp +++ b/src/core/cs_status.cpp @@ -55,6 +55,11 @@ class CommandCSStatus : public Command { syntax_error(Config.s_ChanServ, u, "STATUS", CHAN_STATUS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_STATUS); + } }; class CSStatus : public Module @@ -65,14 +70,6 @@ class CSStatus : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - - this->AddCommand(ChanServ, new CommandCSStatus()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_STATUS); } }; diff --git a/src/core/cs_suspend.cpp b/src/core/cs_suspend.cpp index 426d44945..6931fb62b 100644 --- a/src/core/cs_suspend.cpp +++ b/src/core/cs_suspend.cpp @@ -98,6 +98,11 @@ class CommandCSSuspend : public Command { syntax_error(Config.s_ChanServ, u, "SUSPEND", Config.ForceForbidReason ? CHAN_SUSPEND_SYNTAX_REASON : CHAN_SUSPEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SUSPEND); + } }; class CommandCSUnSuspend : public Command @@ -168,6 +173,11 @@ class CommandCSUnSuspend : public Command { syntax_error(Config.s_ChanServ, u, "UNSUSPEND", CHAN_UNSUSPEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNSUSPEND); + } }; class CSSuspend : public Module @@ -181,13 +191,6 @@ class CSSuspend : public Module this->AddCommand(ChanServ, new CommandCSSuspend()); this->AddCommand(ChanServ, new CommandCSUnSuspend()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SUSPEND); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNSUSPEND); } }; diff --git a/src/core/cs_topic.cpp b/src/core/cs_topic.cpp index b8642666c..9e62fe681 100644 --- a/src/core/cs_topic.cpp +++ b/src/core/cs_topic.cpp @@ -77,6 +77,11 @@ class CommandCSTopic : public Command { syntax_error(Config.s_ChanServ, u, "TOPIC", CHAN_TOPIC_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_TOPIC); + } }; class CSTopic : public Module @@ -89,12 +94,6 @@ class CSTopic : public Module this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSTopic()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_TOPIC); } }; diff --git a/src/core/cs_unban.cpp b/src/core/cs_unban.cpp index 9dd4e74e3..c361032bf 100644 --- a/src/core/cs_unban.cpp +++ b/src/core/cs_unban.cpp @@ -67,6 +67,11 @@ class CommandCSUnban : public Command { syntax_error(Config.s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN); + } }; class CSUnban : public Module @@ -79,13 +84,6 @@ class CSUnban : public Module this->SetType(CORE); this->AddCommand(ChanServ, new CommandCSUnban()); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - - void OnChanServHelp(User *u) - { - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN); } }; diff --git a/src/core/cs_xop.cpp b/src/core/cs_xop.cpp index a4556fdd9..4eb8d15f2 100644 --- a/src/core/cs_xop.cpp +++ b/src/core/cs_xop.cpp @@ -476,6 +476,8 @@ class XOPBase : public Command virtual bool OnHelp(User *u, const ci::string &subcommand) = 0; virtual void OnSyntaxError(User *u, const ci::string &subcommand) = 0; + + virtual void OnServHelp(User *u) = 0; }; class CommandCSQOP : public XOPBase @@ -500,6 +502,11 @@ class CommandCSQOP : public XOPBase { syntax_error(Config.s_ChanServ, u, "QOP", CHAN_QOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_QOP); + } }; class CommandCSAOP : public XOPBase @@ -524,6 +531,11 @@ class CommandCSAOP : public XOPBase { syntax_error(Config.s_ChanServ, u, "AOP", CHAN_AOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_AOP); + } }; class CommandCSHOP : public XOPBase @@ -548,6 +560,11 @@ class CommandCSHOP : public XOPBase { syntax_error(Config.s_ChanServ, u, "HOP", CHAN_HOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_HOP); + } }; class CommandCSSOP : public XOPBase @@ -572,6 +589,11 @@ class CommandCSSOP : public XOPBase { syntax_error(Config.s_ChanServ, u, "SOP", CHAN_SOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SOP); + } }; class CommandCSVOP : public XOPBase @@ -596,6 +618,11 @@ class CommandCSVOP : public XOPBase { syntax_error(Config.s_ChanServ, u, "VOP", CHAN_VOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_VOP); + } }; class CSXOP : public Module @@ -615,9 +642,9 @@ class CSXOP : public Module OnUplinkSync(NULL); Implementation i[] = { - I_OnUplinkSync, I_OnServerDisconnect, I_OnChanServHelp + I_OnUplinkSync, I_OnServerDisconnect }; - ModuleManager::Attach(i, this, 3); + ModuleManager::Attach(i, this, 2); } void OnUplinkSync(Server *) @@ -633,18 +660,6 @@ class CSXOP : public Module this->DelCommand(ChanServ, FindCommand(ChanServ, "QOP")); this->DelCommand(ChanServ, FindCommand(ChanServ, "HOP")); } - - void OnChanServHelp(User *u) - { - if (ModeManager::FindChannelModeByName(CMODE_OWNER)) - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_QOP); - if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_SOP); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_AOP); - if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_HOP); - notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_VOP); - } }; MODULE_INIT(CSXOP) diff --git a/src/core/hs_del.cpp b/src/core/hs_del.cpp index 12610d31f..e86db7e81 100644 --- a/src/core/hs_del.cpp +++ b/src/core/hs_del.cpp @@ -52,6 +52,11 @@ class CommandHSDel : public Command { syntax_error(Config.s_HostServ, u, "DEL", HOST_DEL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_DEL); + } }; class HSDel : public Module @@ -64,12 +69,6 @@ class HSDel : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSDel()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_DEL); } }; diff --git a/src/core/hs_delall.cpp b/src/core/hs_delall.cpp index aaab9b6e1..97a09a073 100644 --- a/src/core/hs_delall.cpp +++ b/src/core/hs_delall.cpp @@ -57,6 +57,11 @@ class CommandHSDelAll : public Command { syntax_error(Config.s_HostServ, u, "DELALL", HOST_DELALL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_DELALL); + } }; class HSDelAll : public Module @@ -69,12 +74,6 @@ class HSDelAll : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSDelAll()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_DELALL); } }; diff --git a/src/core/hs_group.cpp b/src/core/hs_group.cpp index 3c744ef90..d71c4088d 100644 --- a/src/core/hs_group.cpp +++ b/src/core/hs_group.cpp @@ -45,6 +45,11 @@ class CommandHSGroup : public Command notice_help(Config.s_HostServ, u, HOST_HELP_GROUP); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_GROUP); + } }; class HSGroup : public Module @@ -57,12 +62,6 @@ class HSGroup : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSGroup()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_GROUP); } }; diff --git a/src/core/hs_help.cpp b/src/core/hs_help.cpp index 7e8d1e69a..5cc7e5129 100644 --- a/src/core/hs_help.cpp +++ b/src/core/hs_help.cpp @@ -31,7 +31,8 @@ class CommandHSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_HostServ, u, HOST_HELP, Config.s_HostServ); - FOREACH_MOD(I_OnHostServHelp, OnHostServHelp(u)); + for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it) + it->second->OnServHelp(u); } }; diff --git a/src/core/hs_list.cpp b/src/core/hs_list.cpp index 427864e54..d92822b63 100644 --- a/src/core/hs_list.cpp +++ b/src/core/hs_list.cpp @@ -111,6 +111,11 @@ class CommandHSList : public Command notice_help(Config.s_HostServ, u, HOST_HELP_LIST); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_LIST); + } }; class HSList : public Module @@ -123,12 +128,6 @@ class HSList : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSList()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_LIST); } }; diff --git a/src/core/hs_off.cpp b/src/core/hs_off.cpp index ac6416cea..0a483e2a4 100644 --- a/src/core/hs_off.cpp +++ b/src/core/hs_off.cpp @@ -41,6 +41,11 @@ class CommandHSOff : public Command notice_help(Config.s_HostServ, u, HOST_HELP_OFF); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_OFF); + } }; class HSOff : public Module @@ -53,12 +58,6 @@ class HSOff : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSOff()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_OFF); } }; diff --git a/src/core/hs_on.cpp b/src/core/hs_on.cpp index d04040de1..4fd415ead 100644 --- a/src/core/hs_on.cpp +++ b/src/core/hs_on.cpp @@ -55,6 +55,11 @@ class CommandHSOn : public Command notice_help(Config.s_HostServ, u, HOST_HELP_ON); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_ON); + } }; class HSOn : public Module @@ -67,12 +72,6 @@ class HSOn : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSOn()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_ON); } }; diff --git a/src/core/hs_set.cpp b/src/core/hs_set.cpp index a570986ac..3aeb5c6be 100644 --- a/src/core/hs_set.cpp +++ b/src/core/hs_set.cpp @@ -149,6 +149,11 @@ class CommandHSSet : public Command { syntax_error(Config.s_HostServ, u, "SET", HOST_SET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_SET); + } }; class HSSet : public Module @@ -161,12 +166,6 @@ class HSSet : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSSet()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_SET); } }; diff --git a/src/core/hs_setall.cpp b/src/core/hs_setall.cpp index dd90d4153..88a47dc9a 100644 --- a/src/core/hs_setall.cpp +++ b/src/core/hs_setall.cpp @@ -147,6 +147,11 @@ class CommandHSSetAll : public Command { syntax_error(Config.s_HostServ, u, "SETALL", HOST_SETALL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_SETALL); + } }; class HSSetAll : public Module @@ -159,12 +164,6 @@ class HSSetAll : public Module this->SetType(CORE); this->AddCommand(HostServ, new CommandHSSetAll()); - - ModuleManager::Attach(I_OnHostServHelp, this); - } - void OnHostServHelp(User *u) - { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_SETALL); } }; diff --git a/src/core/ms_cancel.cpp b/src/core/ms_cancel.cpp index 33d8006db..4528134fa 100644 --- a/src/core/ms_cancel.cpp +++ b/src/core/ms_cancel.cpp @@ -69,6 +69,11 @@ class CommandMSCancel : public Command { syntax_error(Config.s_MemoServ, u, "CANCEL", MEMO_CANCEL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_CANCEL); + } }; class MSCancel : public Module @@ -80,12 +85,6 @@ class MSCancel : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSCancel()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_CANCEL); } }; diff --git a/src/core/ms_check.cpp b/src/core/ms_check.cpp index 51281574e..87d4a4417 100644 --- a/src/core/ms_check.cpp +++ b/src/core/ms_check.cpp @@ -85,6 +85,11 @@ class CommandMSCheck : public Command { syntax_error(Config.s_MemoServ, u, "CHECK", MEMO_CHECK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_CHECK); + } }; class MSCheck : public Module @@ -96,12 +101,6 @@ class MSCheck : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSCheck()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_CHECK); } }; diff --git a/src/core/ms_del.cpp b/src/core/ms_del.cpp index 7fd5138b5..e10b7f3fb 100644 --- a/src/core/ms_del.cpp +++ b/src/core/ms_del.cpp @@ -152,6 +152,11 @@ class CommandMSDel : public Command { syntax_error(Config.s_MemoServ, u, "DEL", MEMO_DEL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_DEL); + } }; class MSDel : public Module @@ -162,61 +167,7 @@ class MSDel : public Module this->SetAuthor("Anope"); this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSDel()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_DEL); } }; -/** - * Delete a single memo from a MemoInfo. callback function - * @param u User Struct - * @param int Number - * @param va_list Variable Arguemtns - * @return 1 if successful, 0 if it fails - */ -int del_memo_callback(User *u, int num, va_list args) -{ - MemoInfo *mi = va_arg(args, MemoInfo *); - int *last = va_arg(args, int *); - int *last0 = va_arg(args, int *); - char **end = va_arg(args, char **); - int *left = va_arg(args, int *); - ChannelInfo *ci = va_arg(args, ChannelInfo *); - - if (ci) - { - FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, num)); - } - else - { - FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, num)); - } - if (delmemo(mi, num)) - { - if (num != (*last) + 1) - { - if (*last != -1) - { - int len; - if (*last0 != *last) - len = snprintf(*end, *left, ",%d-%d", *last0, *last); - else - len = snprintf(*end, *left, ",%d", *last); - *end += len; - *left -= len; - } - *last0 = num; - } - *last = num; - return 1; - } - else - return 0; -} - MODULE_INIT(MSDel) diff --git a/src/core/ms_help.cpp b/src/core/ms_help.cpp index 09570eca2..2aa837d64 100644 --- a/src/core/ms_help.cpp +++ b/src/core/ms_help.cpp @@ -31,7 +31,8 @@ class CommandMSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_MemoServ, u, MEMO_HELP_HEADER); - FOREACH_MOD(I_OnMemoServHelp, OnMemoServHelp(u)); + for (CommandMap::const_iterator it = NickServ->Commands.begin(); it != NickServ->Commands.end(); ++it) + it->second->OnServHelp(u); notice_help(Config.s_MemoServ, u, MEMO_HELP_FOOTER, Config.s_ChanServ); } }; diff --git a/src/core/ms_info.cpp b/src/core/ms_info.cpp index 0519fd5b8..81650d584 100644 --- a/src/core/ms_info.cpp +++ b/src/core/ms_info.cpp @@ -198,6 +198,11 @@ class CommandMSInfo : public Command return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_INFO); + } }; class MSInfo : public Module @@ -209,12 +214,6 @@ class MSInfo : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSInfo()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_INFO); } }; diff --git a/src/core/ms_list.cpp b/src/core/ms_list.cpp index 22ffb93c0..088fcdb12 100644 --- a/src/core/ms_list.cpp +++ b/src/core/ms_list.cpp @@ -156,6 +156,11 @@ class CommandMSList : public Command { syntax_error(Config.s_MemoServ, u, "LIST", MEMO_LIST_SYNTAX); } + + void OnServCommand(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_LIST); + } }; class MSList : public Module @@ -167,12 +172,6 @@ class MSList : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSList()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_LIST); } }; diff --git a/src/core/ms_read.cpp b/src/core/ms_read.cpp index 0347ba020..9553127af 100644 --- a/src/core/ms_read.cpp +++ b/src/core/ms_read.cpp @@ -141,6 +141,11 @@ class CommandMSRead : public Command { syntax_error(Config.s_MemoServ, u, "READ", MEMO_READ_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_READ); + } }; class MSRead : public Module @@ -152,12 +157,6 @@ class MSRead : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSRead()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_READ); } }; diff --git a/src/core/ms_rsend.cpp b/src/core/ms_rsend.cpp index 7759edb2c..5ad43ac49 100644 --- a/src/core/ms_rsend.cpp +++ b/src/core/ms_rsend.cpp @@ -69,6 +69,11 @@ class CommandMSRSend : public Command { syntax_error(Config.s_MemoServ, u, "RSEND", MEMO_RSEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_RSEND); + } }; class MSRSend : public Module @@ -83,12 +88,6 @@ class MSRSend : public Module if (!Config.MSMemoReceipt) throw ModuleException("Don't like memo reciepts, or something."); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_RSEND); } }; diff --git a/src/core/ms_send.cpp b/src/core/ms_send.cpp index ffd3a911c..71479924c 100644 --- a/src/core/ms_send.cpp +++ b/src/core/ms_send.cpp @@ -40,6 +40,11 @@ class CommandMSSend : public Command { syntax_error(Config.s_MemoServ, u, "SEND", MEMO_SEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SEND); + } }; class MSSend : public Module @@ -51,12 +56,6 @@ class MSSend : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSSend()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SEND); } }; diff --git a/src/core/ms_sendall.cpp b/src/core/ms_sendall.cpp index 2e3abe640..9150152df 100644 --- a/src/core/ms_sendall.cpp +++ b/src/core/ms_sendall.cpp @@ -56,6 +56,11 @@ class CommandMSSendAll : public Command { syntax_error(Config.s_MemoServ, u, "SENDALL", MEMO_SEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SENDALL); + } }; class MSSendAll : public Module @@ -67,12 +72,6 @@ class MSSendAll : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSSendAll()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SENDALL); } }; diff --git a/src/core/ms_set.cpp b/src/core/ms_set.cpp index 9171b0f21..d915d7856 100644 --- a/src/core/ms_set.cpp +++ b/src/core/ms_set.cpp @@ -251,6 +251,11 @@ class CommandMSSet : public Command { syntax_error(Config.s_MemoServ, u, "SET", MEMO_SET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SET); + } }; class MSSet : public Module @@ -263,12 +268,6 @@ class MSSet : public Module this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSSet()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_SET); } }; diff --git a/src/core/ms_staff.cpp b/src/core/ms_staff.cpp index d3ff161c9..3d2877e44 100644 --- a/src/core/ms_staff.cpp +++ b/src/core/ms_staff.cpp @@ -53,6 +53,11 @@ class CommandMSStaff : public Command { syntax_error(Config.s_MemoServ, u, "STAFF", MEMO_STAFF_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_STAFF); + } }; class MSStaff : public Module @@ -64,12 +69,6 @@ class MSStaff : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(MemoServ, new CommandMSStaff()); - - ModuleManager::Attach(I_OnMemoServHelp, this); - } - void OnMemoServHelp(User *u) - { - notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_STAFF); } }; diff --git a/src/core/ns_access.cpp b/src/core/ns_access.cpp index aa96c45b1..c578e6095 100644 --- a/src/core/ns_access.cpp +++ b/src/core/ns_access.cpp @@ -160,6 +160,11 @@ class CommandNSAccess : public Command { syntax_error(Config.s_NickServ, u, "ACCESS", NICK_ACCESS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_ACCESS); + } }; class NSAccess : public Module @@ -172,12 +177,6 @@ class NSAccess : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSAccess()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_ACCESS); } }; diff --git a/src/core/ns_alist.cpp b/src/core/ns_alist.cpp index 0fd7b47af..a904fe9b0 100644 --- a/src/core/ns_alist.cpp +++ b/src/core/ns_alist.cpp @@ -134,6 +134,11 @@ class CommandNSAList : public Command return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_ALIST); + } }; class NSAList : public Module @@ -146,12 +151,6 @@ class NSAList : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSAList()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_ALIST); } }; diff --git a/src/core/ns_drop.cpp b/src/core/ns_drop.cpp index 16c73f04a..7383706d9 100644 --- a/src/core/ns_drop.cpp +++ b/src/core/ns_drop.cpp @@ -107,6 +107,11 @@ class CommandNSDrop : public Command return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_DROP); + } }; class NSDrop : public Module @@ -119,12 +124,6 @@ class NSDrop : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSDrop()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_DROP); } }; diff --git a/src/core/ns_forbid.cpp b/src/core/ns_forbid.cpp index 70943ceeb..61a28e552 100644 --- a/src/core/ns_forbid.cpp +++ b/src/core/ns_forbid.cpp @@ -100,6 +100,11 @@ class CommandNSForbid : public Command { syntax_error(Config.s_NickServ, u, "FORBID", Config.ForceForbidReason ? NICK_FORBID_SYNTAX_REASON : NICK_FORBID_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_FORBID); + } }; class NSForbid : public Module @@ -112,12 +117,6 @@ class NSForbid : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSForbid()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_FORBID); } }; diff --git a/src/core/ns_getemail.cpp b/src/core/ns_getemail.cpp index 2c15a0042..c0a2980c5 100644 --- a/src/core/ns_getemail.cpp +++ b/src/core/ns_getemail.cpp @@ -66,6 +66,11 @@ class CommandNSGetEMail : public Command { syntax_error(Config.s_NickServ, u, "GETMAIL", NICK_GETEMAIL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GETEMAIL); + } }; class NSGetEMail : public Module @@ -78,12 +83,6 @@ class NSGetEMail : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSGetEMail()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GETEMAIL); } }; diff --git a/src/core/ns_getpass.cpp b/src/core/ns_getpass.cpp index f1acaf6ca..cda008967 100644 --- a/src/core/ns_getpass.cpp +++ b/src/core/ns_getpass.cpp @@ -69,6 +69,11 @@ class CommandNSGetPass : public Command { syntax_error(Config.s_NickServ, u, "GETPASS", NICK_GETPASS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GETPASS); + } }; class NSGetPass : public Module @@ -85,12 +90,6 @@ class NSGetPass : public Module std::string tmp_pass = "plain:tmp"; if (enc_decrypt(tmp_pass, tmp_pass) == -1) throw ModuleException("Incompatible with the encryption module being used"); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GETPASS); } }; diff --git a/src/core/ns_ghost.cpp b/src/core/ns_ghost.cpp index 674fb3d08..1ae0a1946 100644 --- a/src/core/ns_ghost.cpp +++ b/src/core/ns_ghost.cpp @@ -82,6 +82,11 @@ class CommandNSGhost : public Command { syntax_error(Config.s_NickServ, u, "GHOST", NICK_GHOST_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GHOST); + } }; class NSGhost : public Module @@ -94,12 +99,6 @@ class NSGhost : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSGhost()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GHOST); } }; diff --git a/src/core/ns_group.cpp b/src/core/ns_group.cpp index f9811cad7..ffb94296b 100644 --- a/src/core/ns_group.cpp +++ b/src/core/ns_group.cpp @@ -149,6 +149,11 @@ class CommandNSGroup : public Command { syntax_error(Config.s_NickServ, u, "GROUP", NICK_GROUP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GROUP); + } }; class CommandNSUngroup : public Command @@ -215,6 +220,11 @@ class CommandNSUngroup : public Command notice_help(Config.s_NickServ, u, NICK_HELP_UNGROUP); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UNGROUP); + } }; class CommandNSGList : public Command @@ -269,6 +279,11 @@ class CommandNSGList : public Command return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GLIST); + } }; class NSGroup : public Module @@ -283,15 +298,6 @@ class NSGroup : public Module this->AddCommand(NickServ, new CommandNSGroup()); this->AddCommand(NickServ, new CommandNSUngroup()); this->AddCommand(NickServ, new CommandNSGList()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GROUP); - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UNGROUP); - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GLIST); } }; diff --git a/src/core/ns_help.cpp b/src/core/ns_help.cpp index 233c7252f..a9b40592f 100644 --- a/src/core/ns_help.cpp +++ b/src/core/ns_help.cpp @@ -42,7 +42,8 @@ class CommandNSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_NickServ, u, NICK_HELP); - FOREACH_MOD(I_OnNickServHelp, OnNickServHelp(u)); + for (CommandMap::const_iterator it = NickServ->Commands.begin(); it != NickServ->Commands.end(); ++it) + it->second->OnServHelp(u); if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP); if (Config.NSExpire >= 86400) diff --git a/src/core/ns_identify.cpp b/src/core/ns_identify.cpp index c3e034f7a..2f02cac81 100644 --- a/src/core/ns_identify.cpp +++ b/src/core/ns_identify.cpp @@ -104,6 +104,12 @@ class CommandNSIdentify : public Command { syntax_error(Config.s_NickServ, u, "IDENTIFY", NICK_IDENTIFY_SYNTAX); } + + void OnServHelp(User *u) + { + if (this->name == "IDENTIFY") + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_IDENTIFY); + } }; class NSIdentify : public Module @@ -117,12 +123,6 @@ class NSIdentify : public Module this->AddCommand(NickServ, new CommandNSIdentify("IDENTIFY")); this->AddCommand(NickServ, new CommandNSIdentify("ID")); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_IDENTIFY); } }; diff --git a/src/core/ns_info.cpp b/src/core/ns_info.cpp index a73766c06..e5a4d5e9e 100644 --- a/src/core/ns_info.cpp +++ b/src/core/ns_info.cpp @@ -199,6 +199,11 @@ class CommandNSInfo : public Command { syntax_error(Config.s_NickServ, u, "INFO", NICK_INFO_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_INFO); + } }; class NSInfo : public Module @@ -211,12 +216,6 @@ class NSInfo : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSInfo()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_INFO); } }; diff --git a/src/core/ns_list.cpp b/src/core/ns_list.cpp index bc27e9619..7b9419a14 100644 --- a/src/core/ns_list.cpp +++ b/src/core/ns_list.cpp @@ -206,6 +206,11 @@ class CommandNSList : public Command else syntax_error(Config.s_NickServ, u, "LIST", NICK_LIST_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_LIST); + } }; class NSList : public Module @@ -218,12 +223,6 @@ class NSList : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSList()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_LIST); } }; diff --git a/src/core/ns_logout.cpp b/src/core/ns_logout.cpp index 463916082..c3d5696f2 100644 --- a/src/core/ns_logout.cpp +++ b/src/core/ns_logout.cpp @@ -77,6 +77,11 @@ class CommandNSLogout : public Command { syntax_error(Config.s_NickServ, u, "LOGOUT", NICK_LOGOUT_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_LOGOUT); + } }; class NSLogout : public Module @@ -89,12 +94,6 @@ class NSLogout : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSLogout()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_LOGOUT); } }; diff --git a/src/core/ns_recover.cpp b/src/core/ns_recover.cpp index b44998d86..501c06642 100644 --- a/src/core/ns_recover.cpp +++ b/src/core/ns_recover.cpp @@ -103,6 +103,11 @@ class CommandNSRecover : public Command { syntax_error(Config.s_NickServ, u, "RECOVER", NICK_RECOVER_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RECOVER); + } }; class NSRecover : public Module @@ -115,12 +120,6 @@ class NSRecover : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSRecover()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RECOVER); } }; diff --git a/src/core/ns_register.cpp b/src/core/ns_register.cpp index 791f2cad5..f8bf1691f 100644 --- a/src/core/ns_register.cpp +++ b/src/core/ns_register.cpp @@ -164,6 +164,11 @@ class CommandNSConfirm : public Command { notice_lang(Config.s_NickServ, u, NICK_CONFIRM_INVALID); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_CONFIRM); + } }; class CommandNSRegister : public CommandNSConfirm @@ -314,6 +319,11 @@ class CommandNSRegister : public CommandNSConfirm else syntax_error(Config.s_NickServ, u, "REGISTER", NICK_REGISTER_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_REGISTER); + } }; class CommandNSResend : public Command @@ -357,6 +367,11 @@ class CommandNSResend : public Command notice_help(Config.s_NickServ, u, NICK_HELP_RESEND); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RESEND); + } }; class NSRegister : public Module @@ -371,18 +386,6 @@ class NSRegister : public Module this->AddCommand(NickServ, new CommandNSRegister()); this->AddCommand(NickServ, new CommandNSConfirm("CONFIRM", 1, 1)); this->AddCommand(NickServ, new CommandNSResend()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_REGISTER); - if (Config.NSEmailReg) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_CONFIRM); - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RESEND); - } } }; diff --git a/src/core/ns_release.cpp b/src/core/ns_release.cpp index 7201f3493..7efcdae88 100644 --- a/src/core/ns_release.cpp +++ b/src/core/ns_release.cpp @@ -85,6 +85,11 @@ class CommandNSRelease : public Command { syntax_error(Config.s_NickServ, u, "RELEASE", NICK_RELEASE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RELEASE); + } }; class NSRelease : public Module @@ -97,12 +102,6 @@ class NSRelease : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSRelease()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RELEASE); } }; diff --git a/src/core/ns_resetpass.cpp b/src/core/ns_resetpass.cpp index 53e284ada..be14caa08 100644 --- a/src/core/ns_resetpass.cpp +++ b/src/core/ns_resetpass.cpp @@ -55,6 +55,11 @@ class CommandNSResetPass : public Command { syntax_error(Config.s_NickServ, u, "RESETPASS", NICK_RESETPASS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RESETPASS); + } }; class NSResetPass : public Module @@ -71,13 +76,7 @@ class NSResetPass : public Module this->AddCommand(NickServ, new CommandNSResetPass()); - Implementation i[] = { I_OnNickServHelp, I_OnPreCommand }; - ModuleManager::Attach(i, this, 2); - } - - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RESETPASS); + ModuleManager::Attach(I_OnPreCommand, this); } EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> ¶ms) diff --git a/src/core/ns_saset.cpp b/src/core/ns_saset.cpp index 7117ffab7..c2e5831bd 100644 --- a/src/core/ns_saset.cpp +++ b/src/core/ns_saset.cpp @@ -565,6 +565,11 @@ public: { syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET); + } }; class NSSASet : public Module @@ -577,12 +582,6 @@ public: this->SetType(CORE); this->AddCommand(NickServ, new CommandNSSASet()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET); } }; diff --git a/src/core/ns_sendpass.cpp b/src/core/ns_sendpass.cpp index 70ec1ab9d..6d4358f06 100644 --- a/src/core/ns_sendpass.cpp +++ b/src/core/ns_sendpass.cpp @@ -62,6 +62,11 @@ class CommandNSSendPass : public Command { syntax_error(Config.s_NickServ, u, "SENDPASS", NICK_SENDPASS_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SENDPASS); + } }; class NSSendPass : public Module @@ -81,13 +86,6 @@ class NSSendPass : public Module std::string tmp_pass = "plain:tmp"; if (enc_decrypt(tmp_pass, tmp_pass) == -1) throw ModuleException("Incompatible with the encryption module being used"); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SENDPASS); } }; diff --git a/src/core/ns_set.cpp b/src/core/ns_set.cpp index 1325f6b32..9cc515700 100644 --- a/src/core/ns_set.cpp +++ b/src/core/ns_set.cpp @@ -521,6 +521,11 @@ class CommandNSSet : public Command { syntax_error(Config.s_NickServ, u, "SET", NICK_SET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET); + } }; class NSSet : public Module @@ -533,12 +538,6 @@ class NSSet : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSSet()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET); } }; diff --git a/src/core/ns_status.cpp b/src/core/ns_status.cpp index f6bc6ca34..9695dd4fd 100644 --- a/src/core/ns_status.cpp +++ b/src/core/ns_status.cpp @@ -56,6 +56,11 @@ class CommandNSStatus : public Command notice_help(Config.s_NickServ, u, NICK_HELP_STATUS); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_STATUS); + } }; class NSStatus : public Module @@ -68,12 +73,6 @@ class NSStatus : public Module this->SetType(CORE); this->AddCommand(NickServ, new CommandNSStatus()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_STATUS); } }; diff --git a/src/core/ns_suspend.cpp b/src/core/ns_suspend.cpp index 94408adac..ef147551a 100644 --- a/src/core/ns_suspend.cpp +++ b/src/core/ns_suspend.cpp @@ -104,6 +104,11 @@ class CommandNSSuspend : public Command { syntax_error(Config.s_NickServ, u, "SUSPEND", NICK_SUSPEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SUSPEND); + } }; class CommandNSUnSuspend : public Command @@ -172,6 +177,11 @@ class CommandNSUnSuspend : public Command { syntax_error(Config.s_NickServ, u, "UNSUSPEND", NICK_UNSUSPEND_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UNSUSPEND); + } }; class NSSuspend : public Module @@ -185,13 +195,6 @@ class NSSuspend : public Module this->AddCommand(NickServ, new CommandNSSuspend()); this->AddCommand(NickServ, new CommandNSUnSuspend()); - - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SUSPEND); - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UNSUSPEND); } }; diff --git a/src/core/ns_update.cpp b/src/core/ns_update.cpp index 755df4dc0..4ed3b5b77 100644 --- a/src/core/ns_update.cpp +++ b/src/core/ns_update.cpp @@ -46,6 +46,11 @@ class CommandNSUpdate : public Command notice_help(Config.s_NickServ, u, NICK_HELP_UPDATE); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UPDATE); + } }; class NSUpdate : public Module @@ -57,11 +62,6 @@ class NSUpdate : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(NickServ, new CommandNSUpdate()); - ModuleManager::Attach(I_OnNickServHelp, this); - } - void OnNickServHelp(User *u) - { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_UPDATE); } }; diff --git a/src/core/os_akill.cpp b/src/core/os_akill.cpp index 6d4e9ab46..fd840cd5c 100644 --- a/src/core/os_akill.cpp +++ b/src/core/os_akill.cpp @@ -380,6 +380,11 @@ class CommandOSAKill : public Command { syntax_error(Config.s_OperServ, u, "AKILL", OPER_AKILL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_AKILL); + } }; class OSAKill : public Module @@ -391,12 +396,6 @@ class OSAKill : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(OperServ, new CommandOSAKill()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_AKILL); } }; diff --git a/src/core/os_chankill.cpp b/src/core/os_chankill.cpp index aa6ffa142..033bf380d 100644 --- a/src/core/os_chankill.cpp +++ b/src/core/os_chankill.cpp @@ -96,6 +96,11 @@ class CommandOSChanKill : public Command { syntax_error(Config.s_OperServ, u, "CHANKILL", OPER_CHANKILL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CHANKILL); + } }; class OSChanKill : public Module @@ -108,12 +113,6 @@ class OSChanKill : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSChanKill()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CHANKILL); } }; diff --git a/src/core/os_chanlist.cpp b/src/core/os_chanlist.cpp index 5d1ab1873..eb8c32e6a 100644 --- a/src/core/os_chanlist.cpp +++ b/src/core/os_chanlist.cpp @@ -86,6 +86,11 @@ class CommandOSChanList : public Command notice_help(Config.s_OperServ, u, OPER_HELP_CHANLIST); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CHANLIST); + } }; class OSChanList : public Module @@ -98,12 +103,6 @@ class OSChanList : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSChanList()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CHANLIST); } }; diff --git a/src/core/os_clearmodes.cpp b/src/core/os_clearmodes.cpp index 89b10a4a1..b5ebba938 100644 --- a/src/core/os_clearmodes.cpp +++ b/src/core/os_clearmodes.cpp @@ -166,6 +166,11 @@ class CommandOSClearModes : public Command { syntax_error(Config.s_OperServ, u, "CLEARMODES", OPER_CLEARMODES_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CLEARMODES); + } }; class OSClearModes : public Module @@ -178,12 +183,6 @@ class OSClearModes : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSClearModes()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CLEARMODES); } }; diff --git a/src/core/os_defcon.cpp b/src/core/os_defcon.cpp index 5945ad3ba..caf2836fe 100644 --- a/src/core/os_defcon.cpp +++ b/src/core/os_defcon.cpp @@ -125,6 +125,11 @@ class CommandOSDEFCON : public Command { syntax_error(Config.s_OperServ, u, "DEFCON", OPER_DEFCON_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_DEFCON); + } }; class OSDEFCON : public Module @@ -141,19 +146,14 @@ class OSDEFCON : public Module throw ModuleException("Invalid configuration settings"); } - Implementation i[] = { I_OnOperServHelp, I_OnPreUserConnect, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommandRun, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate }; - ModuleManager::Attach(i, this, 9); + Implementation i[] = { I_OnPreUserConnect, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommandRun, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate }; + ModuleManager::Attach(i, this, 8); this->AddCommand(OperServ, new CommandOSDEFCON()); defconParseModeString(Config.DefConChanModes); } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_DEFCON); - } - EventReturn OnPreUserConnect(User *u) { if (u->server->IsSynced() && CheckDefCon(DEFCON_AKILL_NEW_CLIENTS) && !u->server->IsULined()) diff --git a/src/core/os_global.cpp b/src/core/os_global.cpp index 791bdcbc0..df62f753f 100644 --- a/src/core/os_global.cpp +++ b/src/core/os_global.cpp @@ -41,6 +41,11 @@ class CommandOSGlobal : public Command { syntax_error(Config.s_OperServ, u, "GLOBAL", OPER_GLOBAL_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_GLOBAL); + } }; class OSGlobal : public Module @@ -53,12 +58,6 @@ class OSGlobal : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSGlobal()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_GLOBAL); } }; diff --git a/src/core/os_help.cpp b/src/core/os_help.cpp index 8e9893407..d6f9001b4 100644 --- a/src/core/os_help.cpp +++ b/src/core/os_help.cpp @@ -30,7 +30,8 @@ class CommandOSHelp : public Command void OnSyntaxError(User *u, const ci::string &subcommand) { notice_help(Config.s_OperServ, u, OPER_HELP); - FOREACH_MOD(I_OnOperServHelp, OnOperServHelp(u)); + for (CommandMap::const_iterator it = NickServ->Commands.begin(); it != NickServ->Commands.end(); ++it) + it->second->OnServHelp(u); notice_help(Config.s_OperServ, u, OPER_HELP_LOGGED); } }; diff --git a/src/core/os_ignore.cpp b/src/core/os_ignore.cpp index f71a1cd2c..f852a36b8 100644 --- a/src/core/os_ignore.cpp +++ b/src/core/os_ignore.cpp @@ -127,6 +127,11 @@ class CommandOSIgnore : public Command { syntax_error(Config.s_OperServ, u, "IGNORE", OPER_IGNORE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_IGNORE); + } }; class OSIgnore : public Module @@ -139,15 +144,10 @@ class OSIgnore : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSIgnore()); - Implementation i[] = { I_OnOperServHelp, I_OnDatabaseRead, I_OnDatabaseWrite }; - ModuleManager::Attach(i, this, 3); + Implementation i[] = { I_OnDatabaseRead, I_OnDatabaseWrite }; + ModuleManager::Attach(i, this, 2); } - - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_IGNORE); - } - + EventReturn OnDatabaseRead(const std::vector<std::string> ¶ms) { std::string buf; diff --git a/src/core/os_jupe.cpp b/src/core/os_jupe.cpp index 11d9fafee..7fedb968c 100644 --- a/src/core/os_jupe.cpp +++ b/src/core/os_jupe.cpp @@ -57,6 +57,11 @@ class CommandOSJupe : public Command { syntax_error(Config.s_OperServ, u, "JUPE", OPER_JUPE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_JUPE); + } }; class OSJupe : public Module @@ -69,12 +74,6 @@ class OSJupe : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSJupe()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_JUPE); } }; diff --git a/src/core/os_kick.cpp b/src/core/os_kick.cpp index 72a47b9c4..f4fb4f7e5 100644 --- a/src/core/os_kick.cpp +++ b/src/core/os_kick.cpp @@ -59,6 +59,11 @@ class CommandOSKick : public Command { syntax_error(Config.s_OperServ, u, "KICK", OPER_KICK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_KICK); + } }; class OSKick : public Module @@ -71,12 +76,6 @@ class OSKick : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSKick()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_KICK); } }; diff --git a/src/core/os_mode.cpp b/src/core/os_mode.cpp index c72ab9e26..1f9396169 100644 --- a/src/core/os_mode.cpp +++ b/src/core/os_mode.cpp @@ -50,6 +50,11 @@ class CommandOSMode : public Command { syntax_error(Config.s_OperServ, u, "MODE", OPER_MODE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODE); + } }; class OSMode : public Module @@ -62,12 +67,6 @@ class OSMode : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSMode()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODE); } }; diff --git a/src/core/os_modinfo.cpp b/src/core/os_modinfo.cpp index 0a000bc00..055d2a136 100644 --- a/src/core/os_modinfo.cpp +++ b/src/core/os_modinfo.cpp @@ -59,6 +59,11 @@ class CommandOSModInfo : public Command { syntax_error(Config.s_OperServ, u, "MODINFO", OPER_MODULE_INFO_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODINFO); + } }; class OSModInfo : public Module @@ -70,12 +75,6 @@ class OSModInfo : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(OperServ, new CommandOSModInfo()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODINFO); } }; diff --git a/src/core/os_modlist.cpp b/src/core/os_modlist.cpp index b51be2067..a8ab244fd 100644 --- a/src/core/os_modlist.cpp +++ b/src/core/os_modlist.cpp @@ -187,6 +187,11 @@ class CommandOSModList : public Command notice_help(Config.s_OperServ, u, OPER_HELP_MODLIST); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODLIST); + } }; class OSModList : public Module @@ -199,12 +204,6 @@ class OSModList : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSModList()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODLIST); } }; diff --git a/src/core/os_modload.cpp b/src/core/os_modload.cpp index ddda212d5..9265c8e72 100644 --- a/src/core/os_modload.cpp +++ b/src/core/os_modload.cpp @@ -51,6 +51,11 @@ class CommandOSModLoad : public Command { syntax_error(Config.s_OperServ, u, "MODLOAD", OPER_MODULE_LOAD_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODLOAD); + } }; class OSModLoad : public Module @@ -64,12 +69,6 @@ class OSModLoad : public Module this->SetPermanent(true); this->AddCommand(OperServ, new CommandOSModLoad()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODLOAD); } }; diff --git a/src/core/os_modunload.cpp b/src/core/os_modunload.cpp index 8c5fee850..77ef413ca 100644 --- a/src/core/os_modunload.cpp +++ b/src/core/os_modunload.cpp @@ -53,6 +53,11 @@ class CommandOSModUnLoad : public Command { syntax_error(Config.s_OperServ, u, "MODUNLOAD", OPER_MODULE_UNLOAD_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODUNLOAD); + } }; class OSModUnLoad : public Module @@ -66,12 +71,6 @@ class OSModUnLoad : public Module this->SetPermanent(true); this->AddCommand(OperServ, new CommandOSModUnLoad()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_MODUNLOAD); } }; diff --git a/src/core/os_news.cpp b/src/core/os_news.cpp index 68cb827f9..7be0bc5f7 100644 --- a/src/core/os_news.cpp +++ b/src/core/os_news.cpp @@ -339,6 +339,11 @@ class CommandOSLogonNews : public NewsBase { syntax_error(Config.s_OperServ, u, "LOGONNEWS", NEWS_LOGON_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_LOGONNEWS); + } }; class CommandOSOperNews : public NewsBase @@ -363,6 +368,11 @@ class CommandOSOperNews : public NewsBase { syntax_error(Config.s_OperServ, u, "OPERNEWS", NEWS_OPER_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_OPERNEWS); + } }; class CommandOSRandomNews : public NewsBase @@ -387,6 +397,11 @@ class CommandOSRandomNews : public NewsBase { syntax_error(Config.s_OperServ, u, "RANDOMNEWS", NEWS_RANDOM_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RANDOMNEWS); + } }; class OSNews : public Module @@ -402,8 +417,8 @@ class OSNews : public Module this->AddCommand(OperServ, new CommandOSOperNews()); this->AddCommand(OperServ, new CommandOSRandomNews()); - Implementation i[] = { I_OnOperServHelp, I_OnUserModeSet, I_OnUserConnect, I_OnDatabaseRead, I_OnDatabaseWrite }; - ModuleManager::Attach(i, this, 5); + Implementation i[] = { I_OnUserModeSet, I_OnUserConnect, I_OnDatabaseRead, I_OnDatabaseWrite }; + ModuleManager::Attach(i, this, 4); } ~OSNews() @@ -413,13 +428,6 @@ class OSNews : public Module News.clear(); } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_LOGONNEWS); - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_OPERNEWS); - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RANDOMNEWS); - } - void OnUserModeSet(User *u, UserModeName Name) { if (Name == UMODE_OPER) diff --git a/src/core/os_noop.cpp b/src/core/os_noop.cpp index bfa1fcbeb..270373f0c 100644 --- a/src/core/os_noop.cpp +++ b/src/core/os_noop.cpp @@ -68,6 +68,11 @@ class CommandOSNOOP : public Command { syntax_error(Config.s_OperServ, u, "NOOP", OPER_NOOP_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_NOOP); + } }; class OSNOOP : public Module @@ -80,12 +85,6 @@ class OSNOOP : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSNOOP()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_NOOP); } }; diff --git a/src/core/os_oline.cpp b/src/core/os_oline.cpp index f02484352..d0ee5ea96 100644 --- a/src/core/os_oline.cpp +++ b/src/core/os_oline.cpp @@ -59,6 +59,11 @@ class CommandOSOLine : public Command { syntax_error(Config.s_OperServ, u, "OLINE", OPER_OLINE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_OLINE); + } }; class OSOLine : public Module @@ -74,12 +79,6 @@ class OSOLine : public Module if (!ircd->omode) throw ModuleException("Your IRCd does not support OMODE."); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_OLINE); } }; diff --git a/src/core/os_quit.cpp b/src/core/os_quit.cpp index 5d3630a2d..41703c1b7 100644 --- a/src/core/os_quit.cpp +++ b/src/core/os_quit.cpp @@ -41,6 +41,11 @@ class CommandOSQuit : public Command notice_help(Config.s_OperServ, u, OPER_HELP_QUIT); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_QUIT); + } }; class OSQuit : public Module @@ -53,12 +58,6 @@ class OSQuit : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSQuit()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_QUIT); } }; diff --git a/src/core/os_reload.cpp b/src/core/os_reload.cpp index 67c1c679f..07fffa94f 100644 --- a/src/core/os_reload.cpp +++ b/src/core/os_reload.cpp @@ -43,6 +43,11 @@ class CommandOSReload : public Command notice_help(Config.s_OperServ, u, OPER_HELP_RELOAD); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RELOAD); + } }; class OSReload : public Module @@ -55,12 +60,6 @@ class OSReload : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSReload()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RELOAD); } }; diff --git a/src/core/os_restart.cpp b/src/core/os_restart.cpp index 8904381f5..efb5bdada 100644 --- a/src/core/os_restart.cpp +++ b/src/core/os_restart.cpp @@ -41,6 +41,11 @@ class CommandOSRestart : public Command notice_help(Config.s_OperServ, u, OPER_HELP_RESTART); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RESTART); + } }; class OSRestart : public Module @@ -52,12 +57,6 @@ class OSRestart : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(OperServ, new CommandOSRestart()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RESTART); } }; diff --git a/src/core/os_session.cpp b/src/core/os_session.cpp index 8c019c537..34d34fcc4 100644 --- a/src/core/os_session.cpp +++ b/src/core/os_session.cpp @@ -204,6 +204,11 @@ class CommandOSSession : public Command { syntax_error(Config.s_OperServ, u, "SESSION", OPER_SESSION_LIST_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SESSION); + } }; class CommandOSException : public Command @@ -479,6 +484,11 @@ class CommandOSException : public Command { syntax_error(Config.s_OperServ, u, "EXCEPTION", OPER_EXCEPTION_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_EXCEPTION); + } }; class OSSession : public Module @@ -492,13 +502,6 @@ class OSSession : public Module this->AddCommand(OperServ, new CommandOSSession()); this->AddCommand(OperServ, new CommandOSException()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SESSION); - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_EXCEPTION); } }; diff --git a/src/core/os_set.cpp b/src/core/os_set.cpp index 419802871..d51a13bd6 100644 --- a/src/core/os_set.cpp +++ b/src/core/os_set.cpp @@ -287,6 +287,11 @@ class CommandOSSet : public Command { syntax_error(Config.s_OperServ, u, "SET", OPER_SET_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SET); + } }; class OSSet : public Module @@ -299,12 +304,6 @@ class OSSet : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSSet()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SET); } }; diff --git a/src/core/os_shutdown.cpp b/src/core/os_shutdown.cpp index 99801b8d0..772457602 100644 --- a/src/core/os_shutdown.cpp +++ b/src/core/os_shutdown.cpp @@ -41,6 +41,11 @@ class CommandOSShutdown : public Command notice_help(Config.s_OperServ, u, OPER_HELP_SHUTDOWN); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SHUTDOWN); + } }; class OSShutdown : public Module @@ -53,12 +58,6 @@ class OSShutdown : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSShutdown()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SHUTDOWN); } }; diff --git a/src/core/os_snline.cpp b/src/core/os_snline.cpp index f792fd1ee..5463457de 100644 --- a/src/core/os_snline.cpp +++ b/src/core/os_snline.cpp @@ -398,6 +398,11 @@ class CommandOSSNLine : public Command { syntax_error(Config.s_OperServ, u, "SNLINE", OPER_SNLINE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SNLINE); + } }; class OSSNLine : public Module @@ -414,12 +419,6 @@ class OSSNLine : public Module if (!ircd->snline) throw ModuleException("Your IRCd does not support SNLine"); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SNLINE); } }; diff --git a/src/core/os_sqline.cpp b/src/core/os_sqline.cpp index 2d32bf507..37f22b14a 100644 --- a/src/core/os_sqline.cpp +++ b/src/core/os_sqline.cpp @@ -380,6 +380,11 @@ class CommandOSSQLine : public Command { syntax_error(Config.s_OperServ, u, "SQLINE", OPER_SQLINE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SQLINE); + } }; class OSSQLine : public Module @@ -395,12 +400,6 @@ class OSSQLine : public Module if (!ircd->sqline) throw ModuleException("Your IRCd does not support QLines."); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SQLINE); } }; diff --git a/src/core/os_staff.cpp b/src/core/os_staff.cpp index 80d1f95a1..930f8db7b 100644 --- a/src/core/os_staff.cpp +++ b/src/core/os_staff.cpp @@ -63,6 +63,11 @@ class CommandOSStaff : public Command notice_help(Config.s_OperServ, u, OPER_HELP_STAFF); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_STAFF); + } }; class OSStaff : public Module @@ -75,12 +80,6 @@ class OSStaff : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSStaff()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_STAFF); } }; diff --git a/src/core/os_stats.cpp b/src/core/os_stats.cpp index fb9623771..5b993ad8f 100644 --- a/src/core/os_stats.cpp +++ b/src/core/os_stats.cpp @@ -293,6 +293,11 @@ class CommandOSStats : public Command notice_help(Config.s_OperServ, u, OPER_HELP_STATS); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_STATS); + } }; class OSStats : public Module @@ -305,12 +310,6 @@ class OSStats : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSStats()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_STATS); } }; diff --git a/src/core/os_svsnick.cpp b/src/core/os_svsnick.cpp index 7f5f0e637..d3b0a5eaa 100644 --- a/src/core/os_svsnick.cpp +++ b/src/core/os_svsnick.cpp @@ -77,6 +77,11 @@ class CommandOSSVSNick : public Command { syntax_error(Config.s_OperServ, u, "SVSNICK", OPER_SVSNICK_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SVSNICK); + } }; class OSSVSNick : public Module @@ -92,12 +97,6 @@ class OSSVSNick : public Module if (!ircd->svsnick) throw ModuleException("Your IRCd does not support SVSNICK"); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SVSNICK); } }; diff --git a/src/core/os_szline.cpp b/src/core/os_szline.cpp index a99f099c9..2a8b642cd 100644 --- a/src/core/os_szline.cpp +++ b/src/core/os_szline.cpp @@ -378,6 +378,11 @@ class CommandOSSZLine : public Command { syntax_error(Config.s_OperServ, u, "SZLINE", OPER_SZLINE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SZLINE); + } }; class OSSZLine : public Module @@ -393,12 +398,6 @@ class OSSZLine : public Module if (!ircd->szline) throw ModuleException("Your IRCd does not support ZLINEs"); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SZLINE); } }; diff --git a/src/core/os_umode.cpp b/src/core/os_umode.cpp index 2532d531d..bfd0e3777 100644 --- a/src/core/os_umode.cpp +++ b/src/core/os_umode.cpp @@ -62,6 +62,11 @@ class CommandOSUMode : public Command { syntax_error(Config.s_OperServ, u, "UMODE", OPER_UMODE_SYNTAX); } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_UMODE); + } }; class OSUMode : public Module @@ -77,12 +82,6 @@ class OSUMode : public Module if (!ircd->umode) throw ModuleException("Your IRCd does not support setting umodes"); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_UMODE); } }; diff --git a/src/core/os_update.cpp b/src/core/os_update.cpp index 750bb0e14..0355db90e 100644 --- a/src/core/os_update.cpp +++ b/src/core/os_update.cpp @@ -33,6 +33,11 @@ class CommandOSUpdate : public Command notice_help(Config.s_OperServ, u, OPER_HELP_UPDATE); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_UPDATE); + } }; class OSUpdate : public Module @@ -45,12 +50,6 @@ class OSUpdate : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSUpdate()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_UPDATE); } }; diff --git a/src/core/os_userlist.cpp b/src/core/os_userlist.cpp index fbc57f406..2a35299fd 100644 --- a/src/core/os_userlist.cpp +++ b/src/core/os_userlist.cpp @@ -89,6 +89,11 @@ class CommandOSUserList : public Command notice_help(Config.s_OperServ, u, OPER_HELP_USERLIST); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_USERLIST); + } }; class OSUserList : public Module @@ -101,12 +106,6 @@ class OSUserList : public Module this->SetType(CORE); this->AddCommand(OperServ, new CommandOSUserList()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_USERLIST); } }; diff --git a/src/modules/cs_appendtopic.cpp b/src/modules/cs_appendtopic.cpp index 311ac0717..a44e6d1a9 100644 --- a/src/modules/cs_appendtopic.cpp +++ b/src/modules/cs_appendtopic.cpp @@ -128,6 +128,11 @@ class CommandCSAppendTopic : public Command { me->NoticeLang(Config.s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); + } }; class CSAppendTopic : public Module @@ -222,12 +227,6 @@ class CSAppendTopic : public Module this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); } }; diff --git a/src/modules/cs_enforce.cpp b/src/modules/cs_enforce.cpp index 906e42ea6..271b9da05 100644 --- a/src/modules/cs_enforce.cpp +++ b/src/modules/cs_enforce.cpp @@ -216,6 +216,11 @@ class CommandCSEnforce : public Command { me->NoticeLang(Config.s_ChanServ, u, LNG_ENFORCE_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); + } }; class CSEnforce : public Module @@ -438,12 +443,6 @@ class CSEnforce : public Module this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); } }; diff --git a/src/modules/cs_tban.cpp b/src/modules/cs_tban.cpp index 483f5f2d6..5a768dc81 100644 --- a/src/modules/cs_tban.cpp +++ b/src/modules/cs_tban.cpp @@ -83,6 +83,11 @@ class CommandCSTBan : public Command { me->NoticeLang(Config.s_ChanServ, u, TBAN_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_ChanServ, u, TBAN_HELP); + } }; class CSTBan : public Module @@ -154,12 +159,6 @@ class CSTBan : public Module this->InsertLanguage(LANG_PT, LANG_NUM_STRINGS, langtable_pt); this->InsertLanguage(LANG_RU, LANG_NUM_STRINGS, langtable_ru); this->InsertLanguage(LANG_IT, LANG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, TBAN_HELP); } }; diff --git a/src/modules/hs_request.cpp b/src/modules/hs_request.cpp index 385dfc8c5..cc5637bef 100644 --- a/src/modules/hs_request.cpp +++ b/src/modules/hs_request.cpp @@ -205,6 +205,11 @@ class CommandHSRequest : public Command { me->NoticeLang(Config.s_HostServ, u, LNG_REQUEST_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_HostServ, u, LNG_HELP); + } }; class CommandHSActivate : public Command @@ -257,6 +262,11 @@ class CommandHSActivate : public Command { me->NoticeLang(Config.s_HostServ, u, LNG_ACTIVATE_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_HostServ, u, LNG_HELP_SETTER); + } }; class CommandHSReject : public Command @@ -645,8 +655,8 @@ class HSRequest : public Module this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); - Implementation i[] = { I_OnHostServHelp, I_OnPreCommand, I_OnDatabaseRead, I_OnDatabaseWrite }; - ModuleManager::Attach(i, this, 4); + Implementation i[] = { I_OnPreCommand, I_OnDatabaseRead, I_OnDatabaseWrite }; + ModuleManager::Attach(i, this, 3); } ~HSRequest() @@ -698,12 +708,6 @@ class HSRequest : public Module return EVENT_CONTINUE; } - void OnHostServHelp(User *u) - { - this->NoticeLang(Config.s_HostServ, u, LNG_HELP); - this->NoticeLang(Config.s_HostServ, u, LNG_HELP_SETTER); - } - EventReturn OnDatabaseRead(const std::vector<std::string> ¶ms) { if (params[0] == "HS_REQUEST" && params.size() >= 5) diff --git a/src/modules/mysql/db_mysql_write.cpp b/src/modules/mysql/db_mysql_write.cpp index fdb11562f..b5686fa2f 100644 --- a/src/modules/mysql/db_mysql_write.cpp +++ b/src/modules/mysql/db_mysql_write.cpp @@ -391,6 +391,11 @@ class CommandSyncSQL : public Command notice_help(Config.s_OperServ, u, OPER_HELP_SYNC); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SQLSYNC); + } }; class DBMySQLWrite : public DBMySQL @@ -433,15 +438,10 @@ class DBMySQLWrite : public DBMySQL /* MemoServ */ I_OnMemoSend, I_OnMemoDel, /* OperServ */ - I_OnOperServHelp, I_OnAddAkill, I_OnDelAkill, I_OnExceptionAdd, I_OnExceptionDel, + I_OnAddAkill, I_OnDelAkill, I_OnExceptionAdd, I_OnExceptionDel, I_OnAddXLine, I_OnDelXLine }; - ModuleManager::Attach(i, this, 40); - } - - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_SQLSYNC); + ModuleManager::Attach(i, this, 39); } EventReturn OnSaveDatabase() diff --git a/src/modules/os_info.cpp b/src/modules/os_info.cpp index a49fa8a88..38d9c99c5 100644 --- a/src/modules/os_info.cpp +++ b/src/modules/os_info.cpp @@ -116,6 +116,11 @@ class CommandNSOInfo : public Command { me->NoticeLang(Config.s_NickServ, u, OINFO_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_NickServ, u, OINFO_HELP_CMD); + } }; class CommandCSOInfo : public Command @@ -180,6 +185,11 @@ class CommandCSOInfo : public Command { me->NoticeLang(Config.s_ChanServ, u, OCINFO_SYNTAX); } + + void OnServHelp(User *u) + { + me->NoticeLang(Config.s_ChanServ, u, OCINFO_HELP_CMD); + } }; class OSInfo : public Module @@ -409,8 +419,8 @@ class OSInfo : public Module this->InsertLanguage(LANG_RU, LANG_NUM_STRINGS, langtable_ru); this->InsertLanguage(LANG_IT, LANG_NUM_STRINGS, langtable_it); - Implementation i[] = { I_OnNickServHelp, I_OnChanServHelp, I_OnNickInfo, I_OnChanInfo, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata }; - ModuleManager::Attach(i, this, 6); + Implementation i[] = { I_OnNickInfo, I_OnChanInfo, I_OnDatabaseReadMetadata, I_OnDatabaseWriteMetadata }; + ModuleManager::Attach(i, this, 4); } ~OSInfo() @@ -452,16 +462,6 @@ class OSInfo : public Module } } - void OnNickServHelp(User *u) - { - this->NoticeLang(Config.s_NickServ, u, OINFO_HELP_CMD); - } - - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, OCINFO_HELP_CMD); - } - void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), NickCore *nc) { char *c; |