summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-22 16:54:25 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-22 16:54:25 +0200
commit40f09daa15e4ca163c4222de293b11dc5ae57a23 (patch)
treeb79e8313c26f07ab75c66ad2c254e7699b5b6995 /src/modules
parentecef36edcab5219ce1a759eb0d2d24e061b4e886 (diff)
Switch to irc::equals() from irc::string in modules that use it for comparing names of IRC objects
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_banredirect.cpp5
-rw-r--r--src/modules/m_blockamsg.cpp8
-rw-r--r--src/modules/m_cban.cpp8
-rw-r--r--src/modules/m_silence.cpp8
-rw-r--r--src/modules/m_timedbans.cpp5
5 files changed, 15 insertions, 19 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index c44a10f05..f98cbd420 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -166,7 +166,7 @@ class BanRedirect : public ModeWatcher
return false;
}
- if (assign(channel->name) == mask[CHAN])
+ if (irc::equals(channel->name, mask[CHAN]))
{
source->WriteNumeric(690, channel->name, "You cannot set a ban redirection to the channel the ban is on");
return false;
@@ -199,8 +199,7 @@ class BanRedirect : public ModeWatcher
for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++)
{
- /* Ugly as fuck */
- if((irc::string(redir->targetchan.c_str()) == irc::string(mask[CHAN].c_str())) && (irc::string(redir->banmask.c_str()) == irc::string(param.c_str())))
+ if ((irc::equals(redir->targetchan, mask[CHAN])) && (irc::equals(redir->banmask, param)))
{
redirects->erase(redir);
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 9614203c3..266497b90 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -37,11 +37,11 @@ class BlockedMessage
{
public:
std::string message;
- irc::string target;
+ std::string target;
time_t sent;
BlockedMessage(const std::string& msg, const std::string& tgt, time_t when)
- : message(msg), target(tgt.c_str()), sent(when)
+ : message(msg), target(tgt), sent(when)
{
}
};
@@ -116,7 +116,7 @@ class ModuleBlockAmsg : public Module
// OR
// The number of target channels is equal to the number of channels the sender is on..a little suspicious.
// Check it's more than 1 too, or else users on one channel would have fun.
- if ((m && (m->message == parameters[1]) && (m->target != parameters[0]) && (ForgetDelay != -1) && (m->sent >= ServerInstance->Time()-ForgetDelay)) || ((targets > 1) && (targets == user->chans.size())))
+ if ((m && (m->message == parameters[1]) && (!irc::equals(m->target, parameters[0])) && (ForgetDelay != -1) && (m->sent >= ServerInstance->Time()-ForgetDelay)) || ((targets > 1) && (targets == user->chans.size())))
{
// Block it...
if (action == IBLOCK_KILLOPERS || action == IBLOCK_NOTICEOPERS)
@@ -134,7 +134,7 @@ class ModuleBlockAmsg : public Module
{
// If there's already a BlockedMessage allocated, use it.
m->message = parameters[1];
- m->target = parameters[0].c_str();
+ m->target = parameters[0];
m->sent = ServerInstance->Time();
}
else
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 2a969bec7..7985affd4 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -29,14 +29,14 @@ class CBan : public XLine
{
private:
std::string displaytext;
- irc::string matchtext;
+ std::string matchtext;
public:
CBan(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& ch)
: XLine(s_time, d, src, re, "CBAN")
+ , matchtext(ch)
{
this->displaytext = ch;
- this->matchtext = ch.c_str();
}
// XXX I shouldn't have to define this
@@ -47,9 +47,7 @@ public:
bool Matches(const std::string &s)
{
- if (matchtext == s)
- return true;
- return false;
+ return irc::equals(matchtext, s);
}
const std::string& Displayable()
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 0ec40a92f..cb065d2fc 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -167,8 +167,8 @@ class CommandSilence : public Command
for (silencelist::iterator i = sl->begin(); i != sl->end(); i++)
{
// search through for the item
- irc::string listitem = i->first.c_str();
- if (listitem == mask && i->second == pattern)
+ const std::string& listitem = i->first;
+ if ((irc::equals(listitem, mask)) && (i->second == pattern))
{
sl->erase(i);
user->WriteNumeric(950, user->nick, InspIRCd::Format("Removed %s %s from silence list", mask.c_str(), decomppattern.c_str()));
@@ -200,8 +200,8 @@ class CommandSilence : public Command
std::string decomppattern = DecompPattern(pattern);
for (silencelist::iterator n = sl->begin(); n != sl->end(); n++)
{
- irc::string listitem = n->first.c_str();
- if (listitem == mask && n->second == pattern)
+ const std::string& listitem = n->first;
+ if ((irc::equals(listitem, mask)) && (n->second == pattern))
{
user->WriteNumeric(952, user->nick, InspIRCd::Format("%s %s is already on your silence list", mask.c_str(), decomppattern.c_str()));
return CMD_FAILURE;
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 9a6824793..f3fe38a3c 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -147,14 +147,13 @@ class BanWatcher : public ModeWatcher
if (adding)
return;
- irc::string listitem = banmask.c_str();
for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end(); ++i)
{
if (i->chan != chan)
continue;
- irc::string target = i->mask.c_str();
- if (listitem == target)
+ const std::string& target = i->mask;
+ if (irc::equals(banmask, target))
{
TimedBanList.erase(i);
break;