summaryrefslogtreecommitdiff
path: root/src/core/bs_bot.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 23:43:02 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-11 23:43:02 +0000
commitd16f4930f462386a5ad5507e56c07ac6610ac2bb (patch)
tree4ce544024c3d45ac66ebdbf638b27b5aaf43741b /src/core/bs_bot.c
parent30b7e50a43a354e2eeeec66345b6469bd3424269 (diff)
Made Command::OnSyntaxError accept a subcommand parameter, we now give syntax error messages for subcommands (eg, cs_set) instead of giving the general syntax error for the main command
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2643 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/bs_bot.c')
-rw-r--r--src/core/bs_bot.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c
index e6a6e59e8..955f4e42c 100644
--- a/src/core/bs_bot.c
+++ b/src/core/bs_bot.c
@@ -21,18 +21,12 @@ class CommandBSBot : public Command
CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *nick = params[1].c_str();
- const char *user = params.size() > 2 ? params[2].c_str() : NULL;
- const char *host = params.size() > 3 ? params[3].c_str() : NULL;
- const char *real = params.size() > 4 ? params[4].c_str() : NULL;
+ const char *user = params[2].c_str();
+ const char *host = params[3].c_str();
+ const char *real = params[4].c_str();
const char *ch = NULL;
BotInfo *bi;
- if (!nick || !user || !host || !real)
- {
- this->OnSyntaxError(u);
- return MOD_CONT;
- }
-
if (findbot(nick))
{
notice_lang(s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick);
@@ -135,7 +129,7 @@ class CommandBSBot : public Command
if (!oldnick || !nick)
{
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "CHANGE");
return MOD_CONT;
}
@@ -310,7 +304,7 @@ class CommandBSBot : public Command
if (!nick)
{
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "DEL");
return MOD_CONT;
}
@@ -362,7 +356,7 @@ class CommandBSBot : public Command
if (params.size() < 5)
{
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "ADD");
return MOD_CONT;
}
@@ -384,7 +378,7 @@ class CommandBSBot : public Command
if (params.size() < 3)
{
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "CHANGE");
return MOD_CONT;
}
@@ -401,14 +395,14 @@ class CommandBSBot : public Command
if (params.size() < 1)
{
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "DEL");
return MOD_CONT;
}
return this->DoDel(u, params);
}
else
- this->OnSyntaxError(u);
+ this->OnSyntaxError(u, "");
return MOD_CONT;
}
@@ -419,7 +413,7 @@ class CommandBSBot : public Command
return true;
}
- void OnSyntaxError(User *u)
+ void OnSyntaxError(User *u, const ci::string &subcommand)
{
syntax_error(s_BotServ, u, "BOT", BOT_BOT_SYNTAX);
}