aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-08 20:00:46 +0100
committerGravatar Sadie Powell2021-04-08 20:00:46 +0100
commit77802d96ca043ba567ae9b32409862e85dff8e5f (patch)
tree3ca506dea38f060aaef9cda3f60f4c4a51881221 /src/modules
parentTake a string_view in irc::equals. (diff)
Use string_view in IsCTCP.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_anticaps.cpp4
-rw-r--r--src/modules/m_blockcolor.cpp6
-rw-r--r--src/modules/m_chanhistory.cpp2
-rw-r--r--src/modules/m_dccallow.cpp8
-rw-r--r--src/modules/m_noctcp.cpp2
-rw-r--r--src/modules/m_silence.cpp2
6 files changed, 12 insertions, 12 deletions
diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp
index 078784482..57c144d37 100644
--- a/src/modules/m_anticaps.cpp
+++ b/src/modules/m_anticaps.cpp
@@ -218,8 +218,8 @@ class ModuleAntiCaps : public Module
// If the message is a CTCP then we skip it unless it is
// an ACTION in which case we just check against the body.
- std::string ctcpname;
- std::string msgbody(details.text);
+ std::string_view ctcpname;
+ std::string_view msgbody(details.text);
if (details.IsCTCP(ctcpname, msgbody))
{
// If the CTCP is not an action then skip it.
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 0e1475f5c..06b466ffd 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -60,10 +60,10 @@ class ModuleBlockColor : public Module
bool modeset = c->IsModeSet(bc);
if (!extban.GetStatus(user, c).check(!modeset))
{
- std::string ctcpname; // Unused.
- std::string message;
+ std::string_view ctcpname; // Unused.
+ std::string_view message;
if (!details.IsCTCP(ctcpname, message))
- message.assign(details.text);
+ message = details.text;
for (const auto& chr : message)
{
diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp
index 93d7e2f7d..4254710d7 100644
--- a/src/modules/m_chanhistory.cpp
+++ b/src/modules/m_chanhistory.cpp
@@ -223,7 +223,7 @@ class ModuleChanHistory
if (target.type != MessageTarget::TYPE_CHANNEL || target.status)
return;
- std::string ctcpname;
+ std::string_view ctcpname;
if (details.IsCTCP(ctcpname) && !irc::equals(ctcpname, "ACTION"))
return;
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 14032a9a9..fa3390e6f 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -417,8 +417,8 @@ class ModuleDCCAllow : public Module
if (user == u)
return MOD_RES_PASSTHRU;
- std::string ctcpname;
- std::string ctcpbody;
+ std::string_view ctcpname;
+ std::string_view ctcpbody;
if (details.IsCTCP(ctcpname, ctcpbody))
{
Expire();
@@ -442,13 +442,13 @@ class ModuleDCCAllow : public Module
if (s == std::string::npos)
return MOD_RES_PASSTHRU;
- const std::string type = ctcpbody.substr(0, s);
+ const std::string_view type = std::string(ctcpbody).substr(0, s);
if (irc::equals(type, "SEND"))
{
size_t first;
- std::string buf = ctcpbody.substr(s + 1);
+ std::string buf = std::string(ctcpbody).substr(s + 1);
if (!buf.empty() && buf[0] == '"')
{
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 33e5c9246..177d70181 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -53,7 +53,7 @@ class ModuleNoCTCP : public Module
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
- std::string ctcpname;
+ std::string_view ctcpname;
if (!details.IsCTCP(ctcpname) || irc::equals(ctcpname, "ACTION"))
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 9ea9b1535..fa312d192 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -461,7 +461,7 @@ class ModuleSilence
ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) override
{
- std::string ctcpname;
+ std::string_view ctcpname;
bool is_ctcp = details.IsCTCP(ctcpname) && !irc::equals(ctcpname, "ACTION");
SilenceEntry::SilenceFlags flag = SilenceEntry::SF_NONE;