summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-02-21 14:18:49 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-02-21 14:18:49 +0100
commit9e123ad1218e8c3ff29cee2a8a6e1b4b6f56b33b (patch)
tree5863fec6e189f27b9a9771d8ddaf6f4727bc4a79 /src/modules
parent5303501b930d3d6c765c24ff69edb722d8a6b5f1 (diff)
Replace mode letter parameter of OnRawMode() with a ModeHandler*, remove pcnt
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_delayjoin.cpp4
-rw-r--r--src/modules/m_mlock.cpp3
-rw-r--r--src/modules/m_permchannels.cpp4
-rw-r--r--src/modules/m_servprotect.cpp4
4 files changed, 8 insertions, 7 deletions
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index e183fbe46..dd07710bd 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -52,7 +52,7 @@ class ModuleDelayJoin : public Module
void OnUserKick(User* source, Membership*, const std::string &reason, CUList&) CXX11_OVERRIDE;
void OnBuildNeighborList(User* source, IncludeChanList& include, std::map<User*, bool>& exception) CXX11_OVERRIDE;
void OnText(User* user, void* dest, int target_type, const std::string &text, char status, CUList &exempt_list) CXX11_OVERRIDE;
- ModResult OnRawMode(User* user, Channel* channel, const char mode, const std::string &param, bool adding, int pcnt) CXX11_OVERRIDE;
+ ModResult OnRawMode(User* user, Channel* channel, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE;
};
ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
@@ -162,7 +162,7 @@ void ModuleDelayJoin::OnText(User* user, void* dest, int target_type, const std:
}
/* make the user visible if he receives any mode change */
-ModResult ModuleDelayJoin::OnRawMode(User* user, Channel* channel, const char mode, const std::string &param, bool adding, int pcnt)
+ModResult ModuleDelayJoin::OnRawMode(User* user, Channel* channel, ModeHandler* mh, const std::string& param, bool adding)
{
if (!user || !channel || param.empty())
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp
index 45f5dd853..d9c43ec10 100644
--- a/src/modules/m_mlock.cpp
+++ b/src/modules/m_mlock.cpp
@@ -34,7 +34,7 @@ class ModuleMLock : public Module
return Version("Implements the ability to have server-side MLOCK enforcement.", VF_VENDOR);
}
- ModResult OnRawMode(User* source, Channel* channel, const char mode, const std::string& parameter, bool adding, int pcnt)
+ ModResult OnRawMode(User* source, Channel* channel, ModeHandler* mh, const std::string& parameter, bool adding)
{
if (!channel)
return MOD_RES_PASSTHRU;
@@ -46,6 +46,7 @@ class ModuleMLock : public Module
if (!mlock_str)
return MOD_RES_PASSTHRU;
+ const char mode = mh->GetModeChar();
std::string::size_type p = mlock_str->find(mode);
if (p != std::string::npos)
{
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 1de07ba07..edb752f67 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -275,9 +275,9 @@ public:
}
}
- ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt) CXX11_OVERRIDE
+ ModResult OnRawMode(User* user, Channel* chan, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE
{
- if (chan && (chan->IsModeSet(p) || mode == p.GetModeChar()))
+ if (chan && (chan->IsModeSet(p) || mh == &p))
dirty = true;
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index b35ee3487..26453020f 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -64,7 +64,7 @@ class ModuleServProtectMode : public Module
}
}
- ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt) CXX11_OVERRIDE
+ ModResult OnRawMode(User* user, Channel* chan, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE
{
/* Check that the mode is not a server mode, it is being removed, the user making the change is local, there is a parameter,
* and the user making the change is not a uline
@@ -81,7 +81,7 @@ class ModuleServProtectMode : public Module
* 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->modes.find(mode) != std::string::npos)
+ if (u->IsModeSet(bm) && memb && memb->hasMode(mh->GetModeChar()))
{
/* BZZZT, Denied! */
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You are not permitted to remove privileges from %s services", chan->name.c_str(), ServerInstance->Config->Network.c_str());