summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-03-23 04:29:25 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-03-23 04:29:25 +0000
commitce09914e1d767e88f6f5d72ac622d1321c91f9ee (patch)
treec8849a22d6843e562977f45126d525ea6ae07f73 /src/commands.c
parent656cc9973e5fbedf1ad25951c9fe80cbaa2fb3bb (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/commands.c')
-rw-r--r--src/commands.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/commands.c b/src/commands.c
index d4932fe4d..6c422a9d7 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -15,6 +15,7 @@
#include "services.h"
#include "commands.h"
#include "language.h"
+#include "hashcomp.h"
/*************************************************************************/
@@ -96,7 +97,7 @@ XXX: priv checking
return;
}
*/
-
+
std::vector<std::string> params;
std::string curparam;
char *s = NULL;
@@ -180,23 +181,21 @@ void do_help_limited(char *service, User * u, Command * c)
void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[],
const char *cmd)
{
- Command *c = findCommand(cmdTable, cmd);
- Command *current;
bool has_had_help = false;
int cont = MOD_CONT;
- const char *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL;
-
- for (current = c; (current) && (cont == MOD_CONT);
- current = current->next) {
- p1 = current->help_param1;
- p2 = current->help_param2;
- p3 = current->help_param3;
- p4 = current->help_param4;
- has_had_help = current->OnHelp(u, ""); // XXX: this needs finishing to actually pass a subcommand
- }
- if (has_had_help == false) {
+
+ spacesepstream tokens(cmd);
+ std::string token;
+ tokens.GetToken(token);
+
+ Command *c = findCommand(cmdTable, token.c_str());
+
+ std::string subcommand = tokens.StreamEnd() ? "" : tokens.GetRemaining();
+
+ for (Command *current = c; current && cont == MOD_CONT; current = current->next)
+ has_had_help = current->OnHelp(u, subcommand);
+ if (!has_had_help)
notice_lang(service, u, NO_HELP_AVAILABLE, cmd);
- }
//else {
// do_help_limited(service, u, c);
//}