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 | |
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
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/commands.c | 18 | ||||
-rw-r--r-- | src/core/bs_assign.c | 6 |
3 files changed, 18 insertions, 7 deletions
@@ -46,7 +46,6 @@ Legend: [ ] HelpServ must die (1.9.1?) [-] Command parser cleanup: mod_current_buffer needs to go away and be replaced by a proper parser. Commands should then indicate how they want the buffer split. These all need reviewing, remove them from the list _AS YOU GO_. Talk t0 w00t or CBX if you don't know what this is for: - src/core/bs_act.c src/core/bs_assign.c src/core/bs_badwords.c src/core/bs_bot.c 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) { diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c index dc9dca37a..73bbd6213 100644 --- a/src/core/bs_assign.c +++ b/src/core/bs_assign.c @@ -20,14 +20,14 @@ void myBotServHelp(User * u); class CommandBSAssign : public Command { public: - CommandBSAssign() : Command("ASSIGN", 1, 1) + CommandBSAssign() : Command("ASSIGN", 2, 2) { } CommandReturn Execute(User *u, std::vector<std::string> ¶ms) { - char *chan = strtok(NULL, " "); - char *nick = strtok(NULL, " "); + const char *chan = params[0].c_str(); + const char *nick = params[1].c_str(); BotInfo *bi; ChannelInfo *ci; |