diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-11 23:43:02 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-11 23:43:02 +0000 |
| commit | d16f4930f462386a5ad5507e56c07ac6610ac2bb (patch) | |
| tree | 4ce544024c3d45ac66ebdbf638b27b5aaf43741b /src/core | |
| parent | 30b7e50a43a354e2eeeec66345b6469bd3424269 (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')
86 files changed, 256 insertions, 225 deletions
diff --git a/src/core/bs_act.c b/src/core/bs_act.c index 96d7e3c93..0fea7e929 100644 --- a/src/core/bs_act.c +++ b/src/core/bs_act.c @@ -55,7 +55,7 @@ class CommandBSAct : public Command return MOD_CONT; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "ACT", BOT_ACT_SYNTAX); } diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c index d710cb11e..82542580e 100644 --- a/src/core/bs_assign.c +++ b/src/core/bs_assign.c @@ -72,7 +72,7 @@ class CommandBSAssign : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "ASSIGN", BOT_ASSIGN_SYNTAX); } diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c index bef4a7dad..fc9c10bcd 100644 --- a/src/core/bs_badwords.c +++ b/src/core/bs_badwords.c @@ -244,7 +244,7 @@ class CommandBSBadwords : public Command if (need_args ? 0 : !word) { - this->OnSyntaxError(u); + this->OnSyntaxError(u, cmd); return MOD_CONT; } @@ -271,7 +271,8 @@ class CommandBSBadwords : public Command else if (cmd == "CLEAR") return this->DoClear(u, ci, word); else - this->OnSyntaxError(u); + this->OnSyntaxError(u, ""); + return MOD_CONT; } @@ -281,7 +282,7 @@ class CommandBSBadwords : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "BADWORDS", BOT_BADWORDS_SYNTAX); } 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> ¶ms) { 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); } diff --git a/src/core/bs_help.c b/src/core/bs_help.c index ae0e73fdf..05fbc9f8d 100644 --- a/src/core/bs_help.c +++ b/src/core/bs_help.c @@ -30,7 +30,7 @@ class CommandBSHelp : public Command return MOD_CONT; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { // Abuse syntax error to display general list help. notice_help(s_BotServ, u, BOT_HELP); diff --git a/src/core/bs_info.c b/src/core/bs_info.c index eb438e572..86daebbd2 100644 --- a/src/core/bs_info.c +++ b/src/core/bs_info.c @@ -238,7 +238,7 @@ class CommandBSInfo : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "INFO", BOT_INFO_SYNTAX); } diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index c1294c9c2..7f9ee8b7b 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -342,7 +342,7 @@ class CommandBSKick : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "KICK", BOT_KICK_SYNTAX); } diff --git a/src/core/bs_say.c b/src/core/bs_say.c index f0f8c8454..2a1752c05 100644 --- a/src/core/bs_say.c +++ b/src/core/bs_say.c @@ -51,7 +51,7 @@ class CommandBSSay : public Command if (text[0] == '\001') { - this->OnSyntaxError(u); + this->OnSyntaxError(u, ""); return MOD_CONT; } @@ -68,7 +68,7 @@ class CommandBSSay : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "SAY", BOT_SAY_SYNTAX); } diff --git a/src/core/bs_set.c b/src/core/bs_set.c index ec569c205..34dbda165 100644 --- a/src/core/bs_set.c +++ b/src/core/bs_set.c @@ -173,7 +173,7 @@ class CommandBSSet : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "SET", BOT_SET_SYNTAX); } diff --git a/src/core/bs_unassign.c b/src/core/bs_unassign.c index 25a5c2ada..605bc3c37 100644 --- a/src/core/bs_unassign.c +++ b/src/core/bs_unassign.c @@ -50,7 +50,7 @@ class CommandBSUnassign : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_BotServ, u, "UNASSIGN", BOT_UNASSIGN_SYNTAX); } diff --git a/src/core/cs_access.c b/src/core/cs_access.c index b8792bfca..62ac477a2 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -153,7 +153,7 @@ class CommandCSAccess : public Command * If DEL, we require a nick and no level. * Else (ADD), we require a level (which implies a nick). */ if (is_list || cmd == "CLEAR" ? 0 : (cmd == "DEL" ? (!nick || s) : !s)) - this->OnSyntaxError(u); + this->OnSyntaxError(u, cmd); /* We still allow LIST in xOP mode, but not others */ else if ((ci->HasFlag(CI_XOP)) && !is_list) { @@ -404,7 +404,7 @@ class CommandCSAccess : public Command } else - this->OnSyntaxError(u); + this->OnSyntaxError(u, ""); return MOD_CONT; } @@ -415,7 +415,7 @@ class CommandCSAccess : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "ACCESS", CHAN_ACCESS_SYNTAX); } @@ -445,7 +445,7 @@ class CommandCSLevels : public Command * one; else, we want none. */ if (cmd == "SET" ? !s : (cmd.substr(0, 3) == "DIS" ? (!what || s) : !!what)) - this->OnSyntaxError(u); + this->OnSyntaxError(u, cmd); else if (ci->HasFlag(CI_XOP)) notice_lang(s_ChanServ, u, CHAN_LEVELS_XOP); else if (!IsFounder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) @@ -454,7 +454,7 @@ class CommandCSLevels : public Command level = strtol(s, &error, 10); if (*error != '\0') { - this->OnSyntaxError(u); + this->OnSyntaxError(u, "SET"); return MOD_CONT; } @@ -535,7 +535,7 @@ class CommandCSLevels : public Command s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, ci->name); notice_lang(s_ChanServ, u, CHAN_LEVELS_RESET, chan); } else { - this->OnSyntaxError(u); + this->OnSyntaxError(u, ""); } return MOD_CONT; } @@ -546,7 +546,7 @@ class CommandCSLevels : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); } diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index c0f3fc12c..8d2faffa5 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -534,7 +534,7 @@ class CommandCSAKick : public Command ChannelInfo *ci = cs_findchan(chan.c_str()); if (mask.empty() && (cmd == "ADD" || cmd == "STICK" || cmd == "UNSTICK" || cmd == "DEL")) - this->OnSyntaxError(u); + this->OnSyntaxError(u, cmd); else if (!check_access(u, ci, CA_AKICK) && !u->nc->HasPriv("chanserv/access/modify")) notice_lang(s_ChanServ, u, ACCESS_DENIED); else if (cmd != "LIST" && cmd != "VIEW" && cmd != "ENFORCE" && readonly) @@ -556,7 +556,7 @@ class CommandCSAKick : public Command else if (cmd == "CLEAR") this->DoClear(u, ci, params); else - this->OnSyntaxError(u); + this->OnSyntaxError(u, ""); return MOD_CONT; } @@ -567,7 +567,7 @@ class CommandCSAKick : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "AKICK", CHAN_AKICK_SYNTAX); } diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c index dcb051eb2..560563ce8 100644 --- a/src/core/cs_ban.c +++ b/src/core/cs_ban.c @@ -104,7 +104,7 @@ class CommandCSBan : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "BAN", CHAN_BAN_SYNTAX); } @@ -151,7 +151,7 @@ class CommandCSUnban : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX); } diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c index a4f6cd224..e59e4ab4e 100644 --- a/src/core/cs_clear.c +++ b/src/core/cs_clear.c @@ -275,7 +275,7 @@ class CommandCSClear : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "CLEAR", CHAN_CLEAR_SYNTAX); } diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c index 5d4c43bfb..8363b9400 100644 --- a/src/core/cs_drop.c +++ b/src/core/cs_drop.c @@ -102,7 +102,7 @@ class CommandCSDrop : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "DROP", CHAN_DROP_SYNTAX); } diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index c4c916c1b..5ca5b395c 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -112,7 +112,7 @@ class CommandCSForbid : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "FORBID", CHAN_FORBID_SYNTAX); } diff --git a/src/core/cs_getkey.c b/src/core/cs_getkey.c index 447b866b7..387769aee 100644 --- a/src/core/cs_getkey.c +++ b/src/core/cs_getkey.c @@ -52,7 +52,7 @@ class CommandCSGetKey : public Command return true; } - void OnSyntaxError(User *u) + void OnSyntaxError(User *u, const ci::string &subcommand) { syntax_error(s_ChanServ, u, "GETKEY", CHAN_GETKEY_SYNTAX); } diff --git a/src/core/cs_help.c b/src/core/cs_help.c index 267483f8d..e610e0634 100644 --- a/src/core/cs_help.c +++ b/src/core/cs_help.c @@ -52,7 +52,7 @@ class CommandCSHelp : public Command |
