diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-02-21 14:18:49 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-02-21 14:18:49 +0100 |
commit | 9e123ad1218e8c3ff29cee2a8a6e1b4b6f56b33b (patch) | |
tree | 5863fec6e189f27b9a9771d8ddaf6f4727bc4a79 /src | |
parent | 5303501b930d3d6c765c24ff69edb722d8a6b5f1 (diff) |
Replace mode letter parameter of OnRawMode() with a ModeHandler*, remove pcnt
Diffstat (limited to 'src')
-rw-r--r-- | src/mode.cpp | 4 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_mlock.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_permchannels.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_servprotect.cpp | 4 |
6 files changed, 11 insertions, 10 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 17379b620..053a10ba1 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -251,7 +251,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool parameter = parameter.substr(0, 250); ModResult MOD_RESULT; - FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, modechar, parameter, adding, pcnt)); + FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mh, parameter, adding)); if (IS_LOCAL(user) && (MOD_RESULT == MOD_RES_DENY)) return MODEACTION_DENY; @@ -535,7 +535,7 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_s return; ModResult MOD_RESULT; - FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mletter, "", true, 0)); + FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mh, "", true)); if (MOD_RESULT == MOD_RES_DENY) continue; diff --git a/src/modules.cpp b/src/modules.cpp index 3baf4bc4e..cbb8661ae 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -114,7 +114,7 @@ ModResult Module::OnCheckReady(LocalUser*) { DetachEvent(I_OnCheckReady); return ModResult Module::OnUserRegister(LocalUser*) { DetachEvent(I_OnUserRegister); return MOD_RES_PASSTHRU; } ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { DetachEvent(I_OnUserPreKick); return MOD_RES_PASSTHRU; } void Module::OnUserKick(User*, Membership*, const std::string&, CUList&) { DetachEvent(I_OnUserKick); } -ModResult Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { DetachEvent(I_OnRawMode); return MOD_RES_PASSTHRU; } +ModResult Module::OnRawMode(User*, Channel*, ModeHandler*, const std::string&, bool) { DetachEvent(I_OnRawMode); return MOD_RES_PASSTHRU; } ModResult Module::OnCheckInvite(User*, Channel*) { DetachEvent(I_OnCheckInvite); return MOD_RES_PASSTHRU; } ModResult Module::OnCheckKey(User*, Channel*, const std::string&) { DetachEvent(I_OnCheckKey); return MOD_RES_PASSTHRU; } ModResult Module::OnCheckLimit(User*, Channel*) { DetachEvent(I_OnCheckLimit); return MOD_RES_PASSTHRU; } 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 ¶m, 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 ¶meter, 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 ¶m, 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 ¶m, 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 ¶m, 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()); |