aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_cloak.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-22 22:01:25 +0000
committerGravatar Sadie Powell2023-01-22 22:52:30 +0000
commit8389fbba6d92dec84745e5b8db4739f97561585e (patch)
treea1ef829a156d002639035acec8bab8a4e8d1bdfd /src/modules/m_cloak.cpp
parentConvert various enums to strongly typed scoped enums. (diff)
Replace ModeAction with bool.
This enum is functionally the same as bool but with weird semantics.
Diffstat (limited to 'src/modules/m_cloak.cpp')
-rw-r--r--src/modules/m_cloak.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp
index 50bb95ec4..8c02ffc1e 100644
--- a/src/modules/m_cloak.cpp
+++ b/src/modules/m_cloak.cpp
@@ -146,7 +146,7 @@ public:
return cloaks->empty() ? nullptr : cloaks;
}
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change) override
+ bool OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change) override
{
// For remote users blindly allow this
LocalUser* user = IS_LOCAL(dest);
@@ -155,12 +155,12 @@ public:
// Remote setters broadcast mode before host while local setters do the opposite.
active = IS_LOCAL(source) ? change.adding : !change.adding;
dest->SetMode(this, change.adding);
- return MODEACTION_ALLOW;
+ return true;
}
// Don't allow the mode change if its a no-op or a spam change.
if (change.adding == user->IsModeSet(this) || CheckSpam(user))
- return MODEACTION_DENY;
+ return false;
// Penalise changing the mode to avoid spam.
if (source == dest)
@@ -171,7 +171,7 @@ public:
// Remove the mode and restore their real host.
user->SetMode(this, false);
user->ChangeDisplayedHost(user->GetRealHost());
- return MODEACTION_ALLOW;
+ return true;
}
// If a user is not fully connected and their displayed hostname is
@@ -179,7 +179,7 @@ public:
// them by services. We should avoid automatically setting cloak on
// them in this case.
if (!user->IsFullyConnected() && user->GetRealHost() != user->GetDisplayedHost())
- return MODEACTION_DENY;
+ return false;
auto* cloaks = GetCloaks(user);
if (cloaks)
@@ -187,9 +187,9 @@ public:
// We were able to generate cloaks for this user.
user->ChangeDisplayedHost(cloaks->front());
user->SetMode(this, true);
- return MODEACTION_ALLOW;
+ return true;
}
- return MODEACTION_DENY;
+ return false;
}
};