diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-23 04:29:25 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-23 04:29:25 +0000 |
commit | ce09914e1d767e88f6f5d72ac622d1321c91f9ee (patch) | |
tree | c8849a22d6843e562977f45126d525ea6ae07f73 /src/core/cs_help.c | |
parent | 656cc9973e5fbedf1ad25951c9fe80cbaa2fb3bb (diff) |
Fix part #2 of bug #1010, patched partially by Adam and cleaned up / finished by me, the help commands should work as expected now, including "help set ..." and similar help entries.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2194 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/cs_help.c')
-rw-r--r-- | src/core/cs_help.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/core/cs_help.c b/src/core/cs_help.c index 17ec5fe4c..173fe1a7f 100644 --- a/src/core/cs_help.c +++ b/src/core/cs_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$ * */ @@ -18,29 +18,21 @@ class CommandCSHelp : public Command { public: - CommandCSHelp() : Command("HELP", 0, 2) + CommandCSHelp() : Command("HELP", 1, 1) { this->SetFlag(CFLAG_ALLOW_UNREGISTERED); } CommandReturn Execute(User *u, std::vector<std::string> ¶ms) { - const char *cmd = params.size() > 0 ? params[0].c_str() : NULL; + const char *cmd = params[0].c_str(); - if (!cmd) - { - notice_help(s_ChanServ, u, CHAN_HELP); - moduleDisplayHelp(2, u); - if (CSExpire >= 86400) - notice_help(s_ChanServ, u, CHAN_HELP_EXPIRES, CSExpire / 86400); - if (is_services_oper(u)) - notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP); - } - else if (stricmp(cmd, "LEVELS DESC") == 0) + if (!stricmp(cmd, "LEVELS DESC")) { int i; notice_help(s_ChanServ, u, CHAN_HELP_LEVELS_DESC); - if (!levelinfo_maxwidth) { + if (!levelinfo_maxwidth) + { for (i = 0; levelinfo[i].what >= 0; i++) { int len = strlen(levelinfo[i].name); @@ -50,17 +42,24 @@ class CommandCSHelp : public Command } for (i = 0; levelinfo[i].what >= 0; i++) { - notice_help(s_ChanServ, u, CHAN_HELP_LEVELS_DESC_FORMAT, - levelinfo_maxwidth, levelinfo[i].name, - getstring(u, levelinfo[i].desc)); + notice_help(s_ChanServ, u, CHAN_HELP_LEVELS_DESC_FORMAT, levelinfo_maxwidth, levelinfo[i].name, getstring(u, levelinfo[i].desc)); } } else - { mod_help_cmd(s_ChanServ, u, CHANSERV, cmd); - } + return MOD_CONT; } + + void OnSyntaxError(User *u) + { + notice_help(s_ChanServ, u, CHAN_HELP); + moduleDisplayHelp(2, u); + if (CSExpire >= 86400) + notice_help(s_ChanServ, u, CHAN_HELP_EXPIRES, CSExpire / 86400); + if (is_services_oper(u)) + notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP); + } }; |