From d7d01bdc5c667a1fafd95241282b58e03b4caa5b Mon Sep 17 00:00:00 2001 From: rburchell Date: Mon, 9 Feb 2009 21:01:05 +0000 Subject: Squashed commit: merge next (1.9.1) back to trunk. SVN users, NOTE: THIS WILL NOT BUILD, NOR SHOULD YOU RUN IT YET. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1953 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/he_help.c | 63 ++++++++++++++++++++++-------------------------------- 1 file changed, 26 insertions(+), 37 deletions(-) (limited to 'src/core/he_help.c') diff --git a/src/core/he_help.c b/src/core/he_help.c index 6b8741353..5b3f4a129 100644 --- a/src/core/he_help.c +++ b/src/core/he_help.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -15,52 +15,41 @@ #include "module.h" -int do_help(User * u); +class CommandHEHelp : public Command +{ + public: + CommandHEHelp() : Command("HELP", 1, 1) + { + } + + CommandResult Execute(User *u, std::vector ¶ms) + { + mod_help_cmd(s_HelpServ, u, HELPSERV, params[0].c_str()); + return MOD_CONT; + } + + void OnSyntaxError(User *u) + { + notice_help(s_HelpServ, u, HELP_HELP, s_NickServ, s_ChanServ, s_MemoServ); + if (s_BotServ) + notice_help(s_HelpServ, u, HELP_HELP_BOT, s_BotServ); + if (s_HostServ) + notice_help(s_HelpServ, u, HELP_HELP_HOST, s_HostServ); + moduleDisplayHelp(7, u); + } +}; class HEHelp : public Module { public: HEHelp(const std::string &modname, const std::string &creator) : Module(modname, creator) { - Command *c; - this->SetAuthor("Anope"); this->SetVersion("$Id$"); this->SetType(CORE); - c = createCommand("HELP", do_help, NULL, -1, -1, -1, -1, -1); - this->AddCommand(HELPSERV, c, MOD_UNIQUE); + this->AddCommand(HELPSERV, new CommandHEHelp(), MOD_UNIQUE); } }; - - -/** - * Display the HelpServ help. - * This core function has been embed in the source for a long time, but - * it moved into it's own file so we now all can enjoy the joy of - * modules for HelpServ. - * @param u The user who issued the command - * @param MOD_CONT to continue processing other modules, MOD_STOP to stop processing. - */ -int do_help(User * u) -{ - char *cmd = strtok(NULL, ""); - - if (!cmd) { - notice_help(s_HelpServ, u, HELP_HELP, s_NickServ, s_ChanServ, - s_MemoServ); - if (s_BotServ) { - notice_help(s_HelpServ, u, HELP_HELP_BOT, s_BotServ); - } - if (s_HostServ) { - notice_help(s_HelpServ, u, HELP_HELP_HOST, s_HostServ); - } - moduleDisplayHelp(7, u); - } else { - mod_help_cmd(s_HelpServ, u, HELPSERV, cmd); - } - return MOD_CONT; -} - MODULE_INIT("he_help", HEHelp) -- cgit