1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 07:16:39 +02:00

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
This commit is contained in:
rburchell
2009-02-11 11:17:10 +00:00
parent 136ea16ed8
commit badcd21abb
3 changed files with 18 additions and 7 deletions
-1
View File
@@ -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
+15 -3
View File
@@ -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)
{
+3 -3
View File
@@ -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> &params)
{
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;