1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 09:13:13 +02:00
This commit is contained in:
Adam
2011-02-04 22:10:39 -05:00
parent 032c30dd5d
commit b2e52553a7
10 changed files with 200 additions and 133 deletions
+20 -10
View File
@@ -162,9 +162,15 @@ class CommandCSAccess : public Command
CommandReturn DoAdd(User *u, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
Anope::string nick = params[2];
int level = params[3].is_number_only() ? convertTo<int>(params[3]) : ACCESS_INVALID;
int ulev = get_access(u, ci);
int level = ACCESS_INVALID;
try
{
level = convertTo<int>(params[3]);
}
catch (const CoreException &) { }
if (level >= ulev && !u->Account()->HasPriv("chanserv/access/modify"))
{
u->SendMessage(ChanServ, ACCESS_DENIED);
@@ -456,20 +462,24 @@ class CommandCSLevels : public Command
Anope::string what = params[2];
Anope::string lev = params[3];
Anope::string error;
int level = (lev.is_number_only() ? convertTo<int>(lev, error, false) : 0);
if (!lev.is_number_only())
error = "1";
int level = 0;
if (lev.equals_ci("FOUNDER"))
{
level = ACCESS_FOUNDER;
error.clear();
else
{
try
{
level = convertTo<int>(lev);
}
catch (const CoreException &)
{
this->OnSyntaxError(u, "SET");
return MOD_CONT;
}
}
if (!error.empty())
this->OnSyntaxError(u, "SET");
else if (level <= ACCESS_INVALID || level > ACCESS_FOUNDER)
if (level <= ACCESS_INVALID || level > ACCESS_FOUNDER)
u->SendMessage(ChanServ, CHAN_LEVELS_RANGE, ACCESS_INVALID + 1, ACCESS_FOUNDER - 1);
else
{