diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-21 01:25:37 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-21 01:25:37 +0000 |
commit | 1707cf3dd3d442e71a418511b89533752fb8416b (patch) | |
tree | d17e1caafac11d3fbb56a74c77297b4669b3d993 /src/core/cs_access.c | |
parent | bb666ab90209cd65436757788546ccb354da641b (diff) |
Fix cs_access not displaying syntax errors and having a signed vs unsigned bug, spotted by Adam.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2121 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/cs_access.c')
-rw-r--r-- | src/core/cs_access.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/core/cs_access.c b/src/core/cs_access.c index d921be7b5..0996a48cf 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -123,7 +123,7 @@ class CommandCSAccess : public Command * Else (ADD), we require a level (which implies a nick). */ if (!cmd || ((is_list || !stricmp(cmd, "CLEAR")) ? 0 : (stricmp(cmd, "DEL") == 0) ? (!nick || s) : !s)) { - syntax_error(s_ChanServ, u, "ACCESS", CHAN_ACCESS_SYNTAX); + this->OnSyntaxError(u); } else if (!(ci = cs_findchan(chan))) { notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); } else if (ci->flags & CI_FORBIDDEN) { @@ -306,8 +306,8 @@ class CommandCSAccess : public Command /* After reordering only the entries at the end could still be empty. * We ll free the places no longer in use... */ - for (i = ci->accesscount - 1; i >= 0; i--) { - if (ci->access[i].in_use == 1) + for (int j = ci->accesscount - 1; j >= 0; j--) { + if (ci->access[j].in_use == 1) break; ci->accesscount--; @@ -369,7 +369,7 @@ class CommandCSAccess : public Command get_access(u, ci), chan); } else { - syntax_error(s_ChanServ, u, "ACCESS", CHAN_ACCESS_SYNTAX); + this->OnSyntaxError(u); } return MOD_CONT; } @@ -380,6 +380,11 @@ class CommandCSAccess : public Command notice_help(s_ChanServ, u, CHAN_HELP_ACCESS_LEVELS); return true; } + + void OnSyntaxError(User *u) + { + syntax_error(s_ChanServ, u, "ACCESS", CHAN_ACCESS_SYNTAX); + } }; @@ -408,7 +413,7 @@ class CommandCSLevels : public Command if (!cmd || ((stricmp(cmd, "SET") == 0) ? !s : ((strnicmp(cmd, "DIS", 3) == 0)) ? (!what || s) : !!what)) { - syntax_error(s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); + this->OnSyntaxError(u); } else if (!(ci = cs_findchan(chan))) { notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); } else if (ci->flags & CI_FORBIDDEN) { @@ -421,7 +426,7 @@ class CommandCSLevels : public Command level = strtol(s, &error, 10); if (*error != '\0') { - syntax_error(s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); + this->OnSyntaxError(u); return MOD_CONT; } @@ -502,7 +507,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 { - syntax_error(s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); + this->OnSyntaxError(u); } return MOD_CONT; } @@ -512,6 +517,11 @@ class CommandCSLevels : public Command notice_help(s_ChanServ, u, CHAN_HELP_LEVELS); return true; } + + void OnSyntaxError(User *u) + { + syntax_error(s_ChanServ, u, "LEVELS", CHAN_LEVELS_SYNTAX); + } }; |