summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.c18
-rw-r--r--src/core/bs_assign.c6
2 files changed, 18 insertions, 6 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)
{
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> &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;