From 76710ee4c6193c2c0f702c67ccb6ec68f0a1f315 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:39:08 +0200 Subject: m_timedbans Remove one irc::string usage --- src/modules/m_timedbans.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 8a627b9a6..9a6824793 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -148,12 +148,13 @@ class BanWatcher : public ModeWatcher return; irc::string listitem = banmask.c_str(); - irc::string thischan = chan->name.c_str(); for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end(); ++i) { + if (i->chan != chan) + continue; + irc::string target = i->mask.c_str(); - irc::string tchan = i->channel.c_str(); - if ((listitem == target) && (tchan == thischan)) + if (listitem == target) { TimedBanList.erase(i); break; -- cgit v1.2.3 From 0562561425f133874685789269c8ab1aa053c95f Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:39:53 +0200 Subject: m_services_account Detect nickname case changes by using FindNickOnly() Gets rid of assign() --- src/modules/m_services_account.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 559f28ea8..e97e1b02f 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -181,7 +181,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener void OnUserPostNick(User* user, const std::string &oldnick) CXX11_OVERRIDE { /* On nickchange, if they have +r, remove it */ - if (user->IsModeSet(m5) && assign(user->nick) != oldnick) + if ((user->IsModeSet(m5)) && (ServerInstance->FindNickOnly(oldnick) != user)) m5.RemoveMode(user); } -- cgit v1.2.3 From 90ea1b01b78a94486b8142808c06aacff543ca64 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:46:44 +0200 Subject: Add stdalgo::string::equalsci and use it instead of irc::string for case-insensitive comparison --- include/stdalgo.h | 32 ++++++++++++++++++++++++++++++++ src/configreader.cpp | 4 ++-- src/modules/m_dccallow.cpp | 6 +++--- src/modules/m_filter.cpp | 12 +++++------- src/modules/m_knock.cpp | 6 ++---- 5 files changed, 44 insertions(+), 16 deletions(-) (limited to 'src/modules') diff --git a/include/stdalgo.h b/include/stdalgo.h index 3e00a4cdc..12ec76275 100644 --- a/include/stdalgo.h +++ b/include/stdalgo.h @@ -64,6 +64,38 @@ namespace stdalgo } } + namespace string + { + /** Get underlying C string of the string passed as parameter. Useful in template functions. + * @param str C string + * @return Same as input + */ + inline const char* tocstr(const char* str) + { + return str; + } + + /** Get underlying C string of the string passed as parameter. Useful in template functions. + * @param str std::string object + * @return str.c_str() + */ + inline const char* tocstr(const std::string& str) + { + return str.c_str(); + } + + /** Check if two strings are equal case insensitively. + * @param str1 First string to compare. + * @param str2 Second string to compare. + * @return True if the strings are equal case-insensitively, false otherwise. + */ + template + inline bool equalsci(const S1& str1, const S2& str2) + { + return (!strcasecmp(tocstr(str1), tocstr(str2))); + } + } + /** * Deleter that uses operator delete to delete the item */ diff --git a/src/configreader.cpp b/src/configreader.cpp index 8a432e82f..0299b326a 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -433,11 +433,11 @@ void ServerConfig::Fill() throw CoreException(Network + " is not a valid network name. A network name must not contain spaces."); std::string defbind = options->getString("defaultbind"); - if (assign(defbind) == "ipv4") + if (stdalgo::string::equalsci(defbind, "ipv4")) { WildcardIPv6 = false; } - else if (assign(defbind) == "ipv6") + else if (stdalgo::string::equalsci(defbind, "ipv6")) { WildcardIPv6 = true; } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index d8fbef69a..edf9d012f 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -328,12 +328,12 @@ class ModuleDCCAllow : public Module if (s == std::string::npos) return MOD_RES_PASSTHRU; - irc::string type = assign(buf.substr(0, s)); + const std::string type = buf.substr(0, s); ConfigTag* conftag = ServerInstance->Config->ConfValue("dccallow"); bool blockchat = conftag->getBool("blockchat"); - if (type == "SEND") + if (stdalgo::string::equalsci(type, "SEND")) { size_t first; @@ -386,7 +386,7 @@ class ModuleDCCAllow : public Module u->WriteNotice("If you trust " + user->nick + " and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system."); return MOD_RES_DENY; } - else if ((type == "CHAT") && (blockchat)) + else if ((blockchat) && (stdalgo::string::equalsci(type, "CHAT"))) { user->WriteNotice("The user " + u->nick + " is not accepting DCC CHAT requests from you."); u->WriteNotice(user->nick + " (" + user->ident + "@" + user->dhost + ") attempted to initiate a DCC CHAT session, which was blocked."); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index a3e30ecb4..bd19a60ba 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -632,17 +632,15 @@ std::pair ModuleFilter::AddFilter(const std::string &freeform bool ModuleFilter::StringToFilterAction(const std::string& str, FilterAction& fa) { - irc::string s(str.c_str()); - - if (s == "gline") + if (stdalgo::string::equalsci(str, "gline")) fa = FA_GLINE; - else if (s == "block") + else if (stdalgo::string::equalsci(str, "block")) fa = FA_BLOCK; - else if (s == "silent") + else if (stdalgo::string::equalsci(str, "silent")) fa = FA_SILENT; - else if (s == "kill") + else if (stdalgo::string::equalsci(str, "kill")) fa = FA_KILL; - else if (s == "none") + else if (stdalgo::string::equalsci(str, "none")) fa = FA_NONE; else return false; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index a6352749f..cf623c4ab 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -98,14 +98,12 @@ class ModuleKnock : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { std::string knocknotify = ServerInstance->Config->ConfValue("knock")->getString("notify"); - irc::string notify(knocknotify.c_str()); - - if (notify == "numeric") + if (stdalgo::string::equalsci(knocknotify, "numeric")) { cmd.sendnotice = false; cmd.sendnumeric = true; } - else if (notify == "both") + else if (stdalgo::string::equalsci(knocknotify, "both")) { cmd.sendnotice = true; cmd.sendnumeric = true; -- cgit v1.2.3 From 40f09daa15e4ca163c4222de293b11dc5ae57a23 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:54:25 +0200 Subject: Switch to irc::equals() from irc::string in modules that use it for comparing names of IRC objects --- src/modules/m_banredirect.cpp | 5 ++--- src/modules/m_blockamsg.cpp | 8 ++++---- src/modules/m_cban.cpp | 8 +++----- src/modules/m_silence.cpp | 8 ++++---- src/modules/m_timedbans.cpp | 5 ++--- 5 files changed, 15 insertions(+), 19 deletions(-) (limited to 'src/modules') 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; -- cgit v1.2.3 From dfea56312886797f3e611cf3f1b72e43a8a365fa Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:55:07 +0200 Subject: m_cban Remove now unnecessary field CBan::displaytext --- src/modules/m_cban.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 7985affd4..42cff2850 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -28,7 +28,6 @@ class CBan : public XLine { private: - std::string displaytext; std::string matchtext; public: @@ -36,7 +35,6 @@ public: : XLine(s_time, d, src, re, "CBAN") , matchtext(ch) { - this->displaytext = ch; } // XXX I shouldn't have to define this @@ -52,7 +50,7 @@ public: const std::string& Displayable() { - return displaytext; + return matchtext; } }; -- cgit v1.2.3 From 4e0b32e67e27235162f41b362ac62b86c9e0af18 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 16:57:57 +0200 Subject: m_timedbans Remove TimedBan::channel --- src/modules/m_timedbans.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index f3fe38a3c..874e6440f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -28,7 +28,6 @@ class TimedBan { public: - std::string channel; std::string mask; time_t expire; Channel* chan; @@ -83,7 +82,6 @@ class CommandTban : public Command } TimedBan T; - std::string channelname = parameters[0]; unsigned long duration = InspIRCd::Duration(parameters[1]); unsigned long expire = duration + ServerInstance->Time(); if (duration < 1) @@ -114,7 +112,6 @@ class CommandTban : public Command } CUList tmp; - T.channel = channelname; T.mask = mask; T.expire = expire + (IS_REMOTE(user) ? 5 : 0); T.chan = channel; @@ -206,13 +203,11 @@ class ModuleTimedBans : public Module for (timedbans::iterator i = expired.begin(); i != expired.end(); i++) { - std::string chan = i->channel; std::string mask = i->mask; - Channel* cr = ServerInstance->FindChan(chan); - if (cr) + Channel* cr = i->chan; { CUList empty; - std::string expiry = "*** Timed ban on " + chan + " expired."; + std::string expiry = "*** Timed ban on " + cr->name + " expired."; cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); ServerInstance->PI->SendChannelNotice(cr, '@', expiry); -- cgit v1.2.3 From fea425704f1ab72dc7dbadb556958e71144c3765 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 17:02:34 +0200 Subject: m_spanningtree Change type of Link::Name to std::string Switch to stdalgo::string::equalsci() --- src/modules/m_spanningtree/link.h | 2 +- src/modules/m_spanningtree/main.cpp | 4 ++-- src/modules/m_spanningtree/server.cpp | 3 +-- src/modules/m_spanningtree/treesocket1.cpp | 2 +- src/modules/m_spanningtree/utils.cpp | 16 ++++++++-------- 5 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/link.h b/src/modules/m_spanningtree/link.h index 21213fb3e..632982623 100644 --- a/src/modules/m_spanningtree/link.h +++ b/src/modules/m_spanningtree/link.h @@ -24,7 +24,7 @@ class Link : public refcountbase { public: reference tag; - irc::string Name; + std::string Name; std::string IPAddr; int Port; std::string SendPass; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 81543b0da..67c1afdac 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -194,7 +194,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) { bool ipvalid = true; - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map)) { ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself."); return; @@ -320,7 +320,7 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector& para Link* x = *i; if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map)) { - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map)) { user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str())); return MOD_RES_DENY; diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 3000dd391..50f63e117 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -98,7 +98,6 @@ Link* TreeSocket::AuthRemote(const parameterlist& params) return NULL; } - irc::string servername = params[0].c_str(); const std::string& sname = params[0]; const std::string& password = params[1]; const std::string& sid = params[3]; @@ -115,7 +114,7 @@ Link* TreeSocket::AuthRemote(const parameterlist& params) for (std::vector >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { Link* x = *i; - if (x->Name != servername && x->Name != "*") // open link allowance + if ((!stdalgo::string::equalsci(x->Name, sname)) && (x->Name != "*")) // open link allowance continue; if (!ComparePass(*x, password)) diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index e1642a086..a96c4a90c 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -37,7 +37,7 @@ * and only do minor initialization tasks ourselves. */ TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr) - : linkID(assign(link->Name)), LinkState(CONNECTING), MyRoot(NULL), proto_version(0) + : linkID(link->Name), LinkState(CONNECTING), MyRoot(NULL), proto_version(0) , burstsent(false), age(ServerInstance->Time()) { capab = new CapabData; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 6de47de94..7ef20d202 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -267,31 +267,31 @@ void SpanningTreeUtilities::ReadConfiguration() throw ModuleException("Invalid configuration, found a link tag without a name!" + (!L->IPAddr.empty() ? " IP address: "+L->IPAddr : "")); if (L->Name.find('.') == std::string::npos) - throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it must contain at least one '.' character"); + throw ModuleException("The link name '"+L->Name+"' is invalid as it must contain at least one '.' character"); if (L->Name.length() > ServerInstance->Config->Limits.MaxHost) - throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters"); + throw ModuleException("The link name '"+L->Name+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters"); if (L->RecvPass.empty()) - throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', recvpass not defined"); + throw ModuleException("Invalid configuration for server '"+L->Name+"', recvpass not defined"); if (L->SendPass.empty()) - throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', sendpass not defined"); + throw ModuleException("Invalid configuration for server '"+L->Name+"', sendpass not defined"); if ((L->SendPass.find(' ') != std::string::npos) || (L->RecvPass.find(' ') != std::string::npos)) - throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that contains a space character which is invalid"); + throw ModuleException("Link block '" + L->Name + "' has a password set that contains a space character which is invalid"); if ((L->SendPass[0] == ':') || (L->RecvPass[0] == ':')) - throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that begins with a colon (:) which is invalid"); + throw ModuleException("Link block '" + L->Name + "' has a password set that begins with a colon (:) which is invalid"); if (L->IPAddr.empty()) { L->IPAddr = "*"; - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + assign(L->Name) + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); } if (!L->Port) - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + assign(L->Name) + "' has no port defined, you will not be able to /connect it."); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no port defined, you will not be able to /connect it."); L->Fingerprint.erase(std::remove(L->Fingerprint.begin(), L->Fingerprint.end(), ':'), L->Fingerprint.end()); LinkBlocks.push_back(L); -- cgit v1.2.3 From dde2739382ddb9c512232c0d62bafa84cb0f75ab Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 17:03:14 +0200 Subject: m_spanningtree Use ASCII case insensitive map for matching server names --- src/modules/m_spanningtree/main.cpp | 6 +++--- src/modules/m_spanningtree/utils.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 67c1afdac..f26b3c828 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -194,7 +194,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) { bool ipvalid = true; - if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map)) { ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself."); return; @@ -318,9 +318,9 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector& para for (std::vector >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { Link* x = *i; - if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map)) + if (InspIRCd::Match(x->Name, parameters[0], ascii_case_insensitive_map)) { - if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map)) { user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str())); return MOD_RES_DENY; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 7ef20d202..c1c32e80a 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -331,7 +331,7 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name) for (std::vector >::iterator i = LinkBlocks.begin(); i != LinkBlocks.end(); ++i) { Link* x = *i; - if (InspIRCd::Match(x->Name.c_str(), name.c_str(), rfc_case_insensitive_map)) + if (InspIRCd::Match(x->Name, name, ascii_case_insensitive_map)) { return x; } -- cgit v1.2.3 From 541af0b0a2158a2ca22fa923ff9143800477d2fc Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 17:11:03 +0200 Subject: m_censor Switch to stdalgo::string::replace_all() --- src/modules/m_censor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index c8b6b73a8..11a69df9f 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -83,7 +83,7 @@ class ModuleCensor : public Module return MOD_RES_DENY; } - SearchAndReplace(text2, index->first, index->second); + stdalgo::string::replace_all(text2, index->first, index->second); } } text = text2.c_str(); -- cgit v1.2.3 From 7a1ca5baf2fcc6884042680c423ca614c41051c2 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 22 Aug 2016 17:12:42 +0200 Subject: m_censor Pass irc::string as C string to WriteNumeric() Avoids a call to the templated ConvToStr() which uses std::stringstream for conversion --- src/modules/m_censor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 11a69df9f..d2a60275a 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -79,7 +79,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteNumeric(ERR_WORDFILTERED, ((target_type == TYPE_CHANNEL) ? ((Channel*)dest)->name : ((User*)dest)->nick), index->first, "Your message contained a censored word, and was blocked"); + user->WriteNumeric(ERR_WORDFILTERED, ((target_type == TYPE_CHANNEL) ? ((Channel*)dest)->name : ((User*)dest)->nick), index->first.c_str(), "Your message contained a censored word, and was blocked"); return MOD_RES_DENY; } -- cgit v1.2.3