summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-30 16:19:31 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-30 16:19:31 +0200
commite0931343939bc15ea9aaa884eab61d80827074c6 (patch)
tree7842c30db2823be50e739412e097fa899bb5ea6c /src/modules
parentcf6a8ee7e3fb11ea19d627216f53118c563a0a71 (diff)
Change Membership:hasMode() to accept a PrefixMode
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_channelban.cpp4
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_rmode.cpp2
-rw-r--r--src/modules/m_servprotect.cpp6
5 files changed, 10 insertions, 6 deletions
diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp
index 189c0d0bc..ffb43eef1 100644
--- a/src/modules/m_channelban.cpp
+++ b/src/modules/m_channelban.cpp
@@ -34,7 +34,7 @@ class ModuleBadChannelExtban : public Module
{
std::string rm(mask, 2);
char status = 0;
- ModeHandler* mh = ServerInstance->Modes->FindPrefix(rm[0]);
+ const PrefixMode* const mh = ServerInstance->Modes->FindPrefix(rm[0]);
if (mh)
{
rm.assign(mask, 3, std::string::npos);
@@ -44,7 +44,7 @@ class ModuleBadChannelExtban : public Module
{
if (InspIRCd::Match((*i)->chan->name, rm))
{
- if (!status || (*i)->hasMode(status))
+ if ((!status) || ((*i)->HasMode(mh)))
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 56cef10b4..2573e8b78 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -139,7 +139,7 @@ class ModuleOjoin : public Module
ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) CXX11_OVERRIDE
{
// Don't do anything if they're not +Y
- if (!memb->hasMode(np.GetModeChar()))
+ if (!memb->HasMode(&np))
return MOD_RES_PASSTHRU;
// Let them do whatever they want to themselves.
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 51281a528..d66f99450 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -77,7 +77,7 @@ class ModuleOperPrefixMode : public Module
if ((!IS_LOCAL(memb->user)) || (!memb->user->IsOper()) || (memb->user->IsModeSet(hideopermode)))
return;
- if (memb->hasMode(opm.GetModeChar()))
+ if (memb->HasMode(&opm))
return;
// The user was force joined and OnUserPreJoin() did not run. Set the operprefix now.
diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp
index feb17383d..37c6e62ff 100644
--- a/src/modules/m_rmode.cpp
+++ b/src/modules/m_rmode.cpp
@@ -70,7 +70,7 @@ class CommandRMode : public Command
{
if (!InspIRCd::Match(it->first->nick, pattern))
continue;
- if (it->second->hasMode(modeletter) && !((it->first == user) && (pm->GetPrefixRank() > VOICE_VALUE)))
+ if (it->second->HasMode(pm) && !((it->first == user) && (pm->GetPrefixRank() > VOICE_VALUE)))
changelist.push_remove(mh, it->first->nick);
}
}
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 88bde9b57..97670237b 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -73,6 +73,10 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
*/
if (!adding && chan && IS_LOCAL(user) && !param.empty())
{
+ const PrefixMode* const pm = mh->IsPrefixMode();
+ if (!pm)
+ return MOD_RES_PASSTHRU;
+
/* Check if the parameter is a valid nick/uuid
*/
User *u = ServerInstance->FindNick(param);
@@ -83,7 +87,7 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
* This includes any prefix permission mode, even those registered in other modules, e.g. +qaohv. Using ::ModeString()
* here means that the number of modes is restricted to only modes the user has, limiting it to as short a loop as possible.
*/
- if (u->IsModeSet(bm) && memb && memb->hasMode(mh->GetModeChar()))
+ if ((u->IsModeSet(bm)) && (memb) && (memb->HasMode(pm)))
{
/* BZZZT, Denied! */
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You are not permitted to remove privileges from %s services", ServerInstance->Config->Network.c_str()));