aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-05-08 16:31:38 +0100
committerGravatar Sadie Powell2021-05-08 17:16:11 +0100
commit6a2f6331eddd5a89ff02643f72e93151dab15547 (patch)
tree0c8a672e4a461fe0d743a6d181b01c961d992df6 /src/modules
parentConstify ChannelManager::Find. (diff)
Add ChannelManager::IsPrefix.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_blockamsg.cpp4
-rw-r--r--src/modules/m_channames.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_ircv3_ctctags.cpp2
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_samode.cpp2
-rw-r--r--src/modules/m_spanningtree/metadata.cpp2
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp2
-rw-r--r--src/modules/m_sslinfo.cpp2
9 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 2d929b15d..f76f211bc 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -85,12 +85,12 @@ class ModuleBlockAmsg : public Module
// parameters[0] is the target list, count how many channels are there
unsigned int targets = 0;
// Is the first target a channel?
- if (*parameters[0].c_str() == '#')
+ if (ServerInstance->Channels.IsPrefix(parameters[0][0]))
targets = 1;
for (const char* c = parameters[0].c_str(); *c; c++)
{
- if ((*c == ',') && (*(c+1) == '#'))
+ if (*c == ',' && ServerInstance->Channels.IsPrefix(*(c + 1)))
targets++;
}
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 353b50873..71c5efbb8 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -34,7 +34,7 @@ class NewIsChannelHandler
bool NewIsChannelHandler::Call(const std::string& channame)
{
- if (channame.empty() || channame.length() > ServerInstance->Config->Limits.MaxChannel || channame[0] != '#')
+ if (channame.empty() || channame.length() > ServerInstance->Config->Limits.MaxChannel || !ServerInstance->Channels.IsPrefix(channame[0]))
return false;
for (const auto& chr : channame)
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index a2be4a628..4759f42a1 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -625,7 +625,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status)
const std::string target = tag->getString("target");
if (!target.empty())
{
- if (target[0] == '#')
+ if (ServerInstance->Channels.IsPrefix(target[0]))
exemptedchans.insert(target);
else
exemptednicks.insert(target);
diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp
index b4cf560d9..358c2c7f3 100644
--- a/src/modules/m_ircv3_ctctags.cpp
+++ b/src/modules/m_ircv3_ctctags.cpp
@@ -249,7 +249,7 @@ class CommandTagMsg : public Command
}
// The target is a channel name.
- if (*target == '#')
+ if (ServerInstance->Channels.IsPrefix(*target))
return HandleChannelTarget(user, parameters, target, targetpfx);
// The target is a nickname.
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index ef9cdb789..5a570b3ad 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -61,7 +61,7 @@ class RemoveBase : public Command
std::string reason;
// If the command is a /REMOVE then detect the parameter order
- bool neworder = ((fpart) || (parameters[0][0] == '#'));
+ bool neworder = (fpart || ServerInstance->Channels.IsPrefix(parameters[0][0]));
/* Set these to the parameters needed, the new version of this module switches it's parameters around
* supplying a new command with the new order while keeping the old /remove with the older order.
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index c9a42b56f..fc65b083a 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -44,7 +44,7 @@ class CommandSamode : public Command
CmdResult Handle(User* user, const Params& parameters) override
{
- if (parameters[0].c_str()[0] != '#')
+ if (!ServerInstance->Channels.IsPrefix(parameters[0][0]))
{
User* target = ServerInstance->Users.FindNick(parameters[0]);
if ((!target) || (target->registered != REG_ALL))
diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp
index f3bc66f77..f4c6c6beb 100644
--- a/src/modules/m_spanningtree/metadata.cpp
+++ b/src/modules/m_spanningtree/metadata.cpp
@@ -70,7 +70,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, Params& params)
FOREACH_MOD(OnDecodeMetaData, (m, params[5], value));
}
- if (params[0][0] == '#')
+ if (ServerInstance->Channels.IsPrefix(params[0][0]))
{
// Channel METADATA has an additional parameter: the channel TS
// :22D METADATA #channel 12345 extname :extdata
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index dc75d054c..195a8b558 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -95,7 +95,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
pfx = dest[0];
dest.erase(dest.begin());
}
- if (dest[0] == '#')
+ if (ServerInstance->Channels.IsPrefix(dest[0]))
{
Channel* c = ServerInstance->Channels.Find(dest);
if (!c)
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index d4db45d51..5985ca95e 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -259,7 +259,7 @@ class CommandSSLInfo : public SplitCommand
CmdResult HandleLocal(LocalUser* user, const Params& parameters) override
{
- if (ServerInstance->Channels.IsChannel(parameters[0]))
+ if (ServerInstance->Channels.IsPrefix(parameters[0][0]))
return HandleChannel(user, parameters[0]);
else
return HandleUser(user, parameters[0]);