summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-02-13 19:28:45 -0500
committerAdam <Adam@anope.org>2013-02-14 01:20:18 -0500
commit5cf1edeb6efe6277f5674e0647f2c9c091346ddc (patch)
tree14ef411c0205620f8a7fb1db4e74c01c1b0129cd
parent9e544a6443117861c3d6406e435043f1cf0f7099 (diff)
Fix CommandCSMode::CanSet letting everyone set voice
-rw-r--r--include/modes.h6
-rw-r--r--modules/commands/cs_mode.cpp8
-rw-r--r--modules/protocol/inspircd20.cpp4
-rw-r--r--src/modes.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/include/modes.h b/include/modes.h
index 3aaf6d1ff..5d884692e 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -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
*/
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp
index 5a6a51d4e..8c2845178 100644
--- a/modules/commands/cs_mode.cpp
+++ b/modules/commands/cs_mode.cpp
@@ -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)
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 2c6e562f1..9815438fa 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -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--;
}
}
}
diff --git a/src/modes.cpp b/src/modes.cpp
index 4f77a044b..e50d4affb 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -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;
}