aboutsummaryrefslogtreecommitdiffstats
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-06-15 16:59:06 +0100
committerGravatar Sadie Powell2026-06-15 16:59:06 +0100
commit9c89a342c9dc2d535bed9410da41b6edb30b149b (patch)
tree7a88f7c9ef0205be94431cb305edf3400f52e808 /src/mode.cpp
parentMove the typedefs in ServerConfig to the top. (diff)
Add ModeHandler::IsSameMode.
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 4ae6edbda..c70fe05b7 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -133,6 +133,20 @@ const std::string& ModeHandler::GetName(bool old) const
return this->service_name;
}
+bool ModeHandler::IsSameMode(const std::string& mname) const
+{
+ switch (mname.length())
+ {
+ case 0:
+ return false; // Can never match.
+ case 1:
+ return this->GetModeChar() == mname[0]; // Match the mode character.
+ default:
+ return insp::ascii_equals(this->service_name, mname); // Match the mode name.
+ }
+}
+
+
bool SimpleUserMode::OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change)
{
/* We're either trying to add a mode we already have or