1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 13:23:13 +02:00

Fix CommandCSMode::CanSet letting everyone set voice

This commit is contained in:
Adam
2013-02-13 19:28:45 -05:00
parent 9e544a6443
commit 5cf1edeb6e
4 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -185,15 +185,15 @@ class CoreExport ChannelModeStatus : public ChannelMode
/* The "level" of the mode, used to compare with other modes.
* Used so we know op > halfop > voice etc.
*/
unsigned short Level;
short level;
/** constructor
* @param name The mode name
* @param mc The mode char
* @param mSymbol The symbol for the mode, eg @ %
* @param mLevel A level for the mode, which is usually determined by the PREFIX capab
* @param mlevel A level for the mode, which is usually determined by the PREFIX capab
*/
ChannelModeStatus(const Anope::string &name, char mc, char mSymbol, unsigned short mLevel = 0);
ChannelModeStatus(const Anope::string &name, char mc, char mSymbol, short mlevel = 0);
/** destructor
*/
+4 -4
View File
@@ -25,7 +25,7 @@ class CommandCSMode : public Command
const Anope::string modes[] = { "VOICE", "HALFOP", "OP", "PROTECT", "OWNER" };
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
AccessGroup access = source.AccessFor(ci);
unsigned short u_level = 0;
short u_level = -1;
for (int i = 0; !accesses[i].empty(); ++i)
if (access.HasPriv(self ? accesses_self[i] : accesses[i]))
@@ -34,11 +34,11 @@ class CommandCSMode : public Command
if (cm2 == NULL || cm2->type != MODE_STATUS)
continue;
ChannelModeStatus *cms2 = anope_dynamic_static_cast<ChannelModeStatus *>(cm2);
if (cms2->Level > u_level)
u_level = cms2->Level;
if (cms2->level > u_level)
u_level = cms2->level;
}
return u_level >= cms->Level;
return u_level >= cms->level;
}
void DoLock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
+2 -2
View File
@@ -454,7 +454,7 @@ struct IRCDMessageCapab : Message::Capab
{
Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')'));
Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end());
unsigned short level = modes.length() - 1;
short level = modes.length() - 1;
for (size_t t = 0, end = modes.length(); t < end; ++t)
{
@@ -466,7 +466,7 @@ struct IRCDMessageCapab : Message::Capab
}
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
cms->Level = level--;
cms->level = level--;
}
}
}
+1 -1
View File
@@ -119,7 +119,7 @@ ChannelModeParam::~ChannelModeParam()
{
}
ChannelModeStatus::ChannelModeStatus(const Anope::string &mname, char modeChar, char mSymbol, unsigned short mLevel) : ChannelMode(mname, modeChar), Symbol(mSymbol), Level(mLevel)
ChannelModeStatus::ChannelModeStatus(const Anope::string &mname, char modeChar, char mSymbol, short mlevel) : ChannelMode(mname, modeChar), Symbol(mSymbol), level(mlevel)
{
this->type = MODE_STATUS;
}