aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_disable.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-03-30 17:52:02 +0100
committerGravatar Sadie Powell2021-03-30 18:25:55 +0100
commit49702c621eed54caee6a45c0518d68a33bca8f92 (patch)
tree94623f04b8635fbff3f1a90117c32d44fce11075 /src/modules/m_disable.cpp
parentRemove multi-line FJOIN and FMODE logic. (diff)
Convert various mode methods to take Mode::Change.
- AccessCheck - AfterMode - BeforeMode - OnModeChange - OnRawMode
Diffstat (limited to 'src/modules/m_disable.cpp')
-rw-r--r--src/modules/m_disable.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp
index 531b99925..72e0a9145 100644
--- a/src/modules/m_disable.cpp
+++ b/src/modules/m_disable.cpp
@@ -155,35 +155,35 @@ class ModuleDisable : public Module
return MOD_RES_DENY;
}
- ModResult OnRawMode(User* user, Channel* chan, ModeHandler* mh, const std::string& param, bool adding) override
+ ModResult OnRawMode(User* user, Channel* chan, const Modes::Change& change) override
{
// If a mode change is remote or the source is not registered we do nothing.
if (!IS_LOCAL(user) || user->registered != REG_ALL)
return MOD_RES_PASSTHRU;
// If the mode is not disabled or the user has the servers/use-disabled-modes priv we do nothing.
- const std::bitset<64>& disabled = (mh->GetModeType() == MODETYPE_CHANNEL) ? chanmodes : usermodes;
- if (!disabled.test(mh->GetModeChar() - 'A') || user->HasPrivPermission("servers/use-disabled-modes"))
+ const std::bitset<64>& disabled = (change.mh->GetModeType() == MODETYPE_CHANNEL) ? chanmodes : usermodes;
+ if (!disabled.test(change.mh->GetModeChar() - 'A') || user->HasPrivPermission("servers/use-disabled-modes"))
return MOD_RES_PASSTHRU;
// The user has tried to change a disabled mode!
- const char* what = mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user";
+ const char* what = change.mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user";
WriteLog("%s was blocked from %ssetting the disabled %s mode %c (%s)",
- user->GetFullRealHost().c_str(), adding ? "" : "un",
- what, mh->GetModeChar(), mh->name.c_str());
+ user->GetFullRealHost().c_str(), change.adding ? "" : "un",
+ what, change.mh->GetModeChar(), change.mh->name.c_str());
if (fakenonexistent)
{
// The server administrator has specified that disabled modes should be
// treated as if they do not exist.
- user->WriteNumeric(mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK,
- mh->GetModeChar(), "is an unknown mode character");
+ user->WriteNumeric(change.mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK,
+ change.mh->GetModeChar(), "is an unknown mode character");
return MOD_RES_DENY;
}
// Inform the user that the mode they changed has been disabled.
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - %s mode %c (%s) is disabled",
- what, mh->GetModeChar(), mh->name.c_str()));
+ what, change.mh->GetModeChar(), change.mh->name.c_str()));
return MOD_RES_DENY;
}
};