diff options
author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-11 11:17:10 +0000 |
---|---|---|
committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-11 11:17:10 +0000 |
commit | badcd21abb770c040dd3a842be5e21723cd82e71 (patch) | |
tree | 9c8377c940a5d00b828591153147407713e20649 /src/commands.c | |
parent | 136ea16ed8f594f8b86d3fa79337e4d7a7c573df (diff) |
Make max params work correctly, and fix bs_act to request params correctly. Audited as working ok.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2013 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/commands.c b/src/commands.c index fc66334c4..5dd24bb1d 100644 --- a/src/commands.c +++ b/src/commands.c @@ -84,14 +84,26 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * char *s = NULL; while ((s = strtok(NULL, " "))) { - if (params.size() < c->MaxParams) - params.push_back(s); - else + // - 1 because params[0] corresponds with a maxparam of 1. + if (params.size() >= (c->MaxParams - 1)) + { curparam += s; + curparam += " "; + } + else + { + params.push_back(s); + } } if (!curparam.empty()) + { + // Remove trailing space + curparam.erase(curparam.size() - 1, curparam.size()); + + // Add it params.push_back(curparam); + } if (params.size() < c->MinParams) { |