diff options
Diffstat (limited to 'src/modules')
55 files changed, 128 insertions, 131 deletions
diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp index 57e2d895d..e972939fe 100644 --- a/src/modules/extra/m_argon2.cpp +++ b/src/modules/extra/m_argon2.cpp @@ -137,9 +137,9 @@ public: data.length(), salt.c_str(), salt.length(), - &raw_data[0], + raw_data.data(), raw_data.size(), - &encoded_data[0], + encoded_data.data(), encoded_data.size(), argon2Type, config.version); @@ -152,7 +152,7 @@ public: // to do anything useful with them if we don't encode them. // So we pretend this is the raw version, and instead make // ToPrintable return its input. - return std::string(&encoded_data[0], encoded_data.size()); + return std::string(encoded_data.data(), encoded_data.size()); } std::string ToPrintable(const std::string& raw) override diff --git a/src/modules/extra/m_log_syslog.cpp b/src/modules/extra/m_log_syslog.cpp index a3cf23ec6..62d08e45e 100644 --- a/src/modules/extra/m_log_syslog.cpp +++ b/src/modules/extra/m_log_syslog.cpp @@ -26,7 +26,7 @@ class SyslogMethod final { private: // Converts an InspIRCd log level to syslog priority. - int LevelToPriority(Log::Level level) + static int LevelToPriority(Log::Level level) { switch (level) { diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index c76034cc1..51fdef06c 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -269,7 +269,7 @@ class SQLConnection final : public SQL::Provider { private: - bool EscapeString(SQL::Query* query, const std::string& in, std::string& out) + bool EscapeString(SQL::Query* query, const std::string& in, std::string& out) const { // In the worst case each character may need to be encoded as using two bytes and one // byte is the NUL terminator. @@ -281,7 +281,7 @@ private: // Unfortunately, someone genius decided that mysql_escape_string should return an // unsigned type even though -1 is returned on error so checking whether an error // happened is a bit cursed. - unsigned long escapedsize = mysql_escape_string(&buffer[0], in.c_str(), in.length()); + unsigned long escapedsize = mysql_escape_string(buffer.data(), in.c_str(), in.length()); if (escapedsize == static_cast<unsigned long>(-1)) { SQL::Error err(SQL::QSEND_FAIL, InspIRCd::Format("%u: %s", mysql_errno(connection), mysql_error(connection))); @@ -289,7 +289,7 @@ private: return false; } - out.append(&buffer[0], escapedsize); + out.append(buffer.data(), escapedsize); return true; } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index ad3743ad9..e388f377f 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -446,10 +446,10 @@ restart: std::string parm = p[param++]; std::vector<char> buffer(parm.length() * 2 + 1); int error; - size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); + size_t escapedsize = PQescapeStringConn(sql, buffer.data(), parm.data(), parm.length(), &error); if (error) ServerInstance->Logs.Debug(MODNAME, "BUG: Apparently PQescapeStringConn() failed"); - res.append(&buffer[0], escapedsize); + res.append(buffer.data(), escapedsize); } } } @@ -477,10 +477,10 @@ restart: std::string parm = it->second; std::vector<char> buffer(parm.length() * 2 + 1); int error; - size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); + size_t escapedsize = PQescapeStringConn(sql, buffer.data(), parm.data(), parm.length(), &error); if (error) ServerInstance->Logs.Debug(MODNAME, "BUG: Apparently PQescapeStringConn() failed"); - res.append(&buffer[0], escapedsize); + res.append(buffer.data(), escapedsize); } } } diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 819046e2b..7476039cd 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -51,10 +51,10 @@ public: std::vector<char> errormsg(errorsize); // Retrieve the error message and free the buffer. - regerror(error, ®ex, &errormsg[0], errormsg.size()); + regerror(error, ®ex, errormsg.data(), errormsg.size()); regfree(®ex); - throw Regex::Exception(mod, pattern, std::string(&errormsg[0], errormsg.size() - 1)); + throw Regex::Exception(mod, pattern, std::string(errormsg.data(), errormsg.size() - 1)); } ~POSIXPattern() override @@ -70,7 +70,7 @@ public: std::optional<Regex::MatchCollection> Matches(const std::string& text) override { std::vector<regmatch_t> matches(32); - int result = regexec(®ex, text.c_str(), matches.size(), &matches[0], 0); + int result = regexec(®ex, text.c_str(), matches.size(), matches.data(), 0); if (result) return std::nullopt; diff --git a/src/modules/extra/m_regex_re2.cpp b/src/modules/extra/m_regex_re2.cpp index 068be5049..7874564cc 100644 --- a/src/modules/extra/m_regex_re2.cpp +++ b/src/modules/extra/m_regex_re2.cpp @@ -37,7 +37,7 @@ class RE2Pattern final private: RE2 regex; - RE2::Options BuildOptions(uint8_t options) + static RE2::Options BuildOptions(uint8_t options) { RE2::Options re2options; re2options.set_case_sensitive(!(options & Regex::OPT_CASE_INSENSITIVE)); @@ -62,7 +62,7 @@ public: std::optional<Regex::MatchCollection> Matches(const std::string& text) override { std::vector<re2::StringPiece> re2captures(regex.NumberOfCapturingGroups() + 1); - bool result = regex.Match(text, 0, text.length(), RE2::ANCHOR_BOTH, &re2captures[0], static_cast<int>(re2captures.size())); + bool result = regex.Match(text, 0, text.length(), RE2::ANCHOR_BOTH, re2captures.data(), static_cast<int>(re2captures.size())); if (!result) return std::nullopt; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index b21ce982f..d1f31817c 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -229,7 +229,7 @@ namespace GnuTLS gnutls_x509_crt_deinit(cert); } - gnutls_x509_crt_t* raw() { return &certs[0]; } + gnutls_x509_crt_t* raw() { return certs.data(); } size_t size() const { return certs.size(); } }; @@ -983,15 +983,15 @@ public: unsigned int nameType = GNUTLS_NAME_DNS; // First, determine the size of the hostname. - if (gnutls_server_name_get(sess, &nameBuffer[0], &nameLength, &nameType, 0) != GNUTLS_E_SHORT_MEMORY_BUFFER) + if (gnutls_server_name_get(sess, nameBuffer.data(), &nameLength, &nameType, 0) != GNUTLS_E_SHORT_MEMORY_BUFFER) return false; // Then retrieve the hostname. nameBuffer.resize(nameLength); - if (gnutls_server_name_get(sess, &nameBuffer[0], &nameLength, &nameType, 0) != GNUTLS_E_SUCCESS) + if (gnutls_server_name_get(sess, nameBuffer.data(), &nameLength, &nameType, 0) != GNUTLS_E_SUCCESS) return false; - out.append(&nameBuffer[0]); + out.append(nameBuffer.data()); return true; } diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index dfed73020..4517e6a45 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -51,7 +51,8 @@ public: /* Look for any command that starts with the same characters, if it does, replace the command string with it */ size_t clen = command.length() - 1; - std::string foundcommand, matchlist; + std::string foundcommand; + std::string matchlist; bool foundmatch = false; for (const auto& [cmdname, _] : ServerInstance->Parser.GetCommands()) { diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 621fa4f04..ea8be2c41 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -119,7 +119,7 @@ public: { } - std::string GetVar(std::string varname, const std::string &original_line) + static std::string GetVar(std::string varname, const std::string &original_line) { irc::spacesepstream ss(original_line); varname.erase(varname.begin()); @@ -144,7 +144,7 @@ public: return word; } - std::string CreateRFCMessage(const std::string& command, CommandBase::Params& parameters) + static std::string CreateRFCMessage(const std::string& command, CommandBase::Params& parameters) { std::string message(command); for (CommandBase::Params::const_iterator iter = parameters.begin(); iter != parameters.end();) @@ -377,7 +377,8 @@ public: irc::tokenstream ss(result); CommandBase::Params pars; - std::string command, token; + std::string command; + std::string token; ss.GetMiddle(command); while (ss.GetTrailing(token)) diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp index e9bd3d45e..beb29f2ec 100644 --- a/src/modules/m_anticaps.cpp +++ b/src/modules/m_anticaps.cpp @@ -52,7 +52,7 @@ class AntiCapsMode final : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettings>> { private: - bool ParseMethod(irc::sepstream& stream, AntiCapsMethod& method) + static bool ParseMethod(irc::sepstream& stream, AntiCapsMethod& method) { std::string methodstr; if (!stream.GetToken(methodstr)) @@ -74,7 +74,7 @@ private: return true; } - bool ParseMinimumLength(irc::sepstream& stream, uint16_t& minlen) + static bool ParseMinimumLength(irc::sepstream& stream, uint16_t& minlen) { std::string minlenstr; if (!stream.GetToken(minlenstr)) @@ -88,7 +88,7 @@ private: return true; } - bool ParsePercent(irc::sepstream& stream, uint8_t& percent) + static bool ParsePercent(irc::sepstream& stream, uint8_t& percent) { std::string percentstr; if (!stream.GetToken(percentstr)) @@ -176,7 +176,7 @@ private: ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, nullptr, changelist); } - void InformUser(Channel* channel, User* user, const std::string& message) + static void InformUser(Channel* channel, User* user, const std::string& message) { user->WriteNumeric(Numerics::CannotSendTo(channel, message + " and was blocked.")); } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index a7b3d0804..566171fe5 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -118,10 +118,7 @@ public: // Can you see the list by permission? ModResult res = CheckExemption::Call(exemptionprov, issuer, memb->chan, "auditorium-see"); - if (res.check(OpsCanSee && memb->chan->GetPrefixValue(issuer) >= OP_VALUE)) - return true; - - return false; + return res.check(OpsCanSee && memb->chan->GetPrefixValue(issuer) >= OP_VALUE); } ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) override diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index dca983b3e..dc03eddb2 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -42,7 +42,7 @@ public: syntax = "<prefix>:<mask>"; } - PrefixMode* FindMode(const std::string& mid) + static PrefixMode* FindMode(const std::string& mid) { if (mid.length() == 1) return ServerInstance->Modes.FindPrefixMode(mid[0]); diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 9234c1b6f..b9bfab626 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -89,7 +89,8 @@ public: for (const ListModeBase::ListItem& ban : *list) { bool inverted; - std::string name, value; + std::string name; + std::string value; if (!ExtBan::Parse(ban.mask, name, value, inverted)) continue; diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp index 0e464081c..62e50db07 100644 --- a/src/modules/m_bcrypt.cpp +++ b/src/modules/m_bcrypt.cpp @@ -43,7 +43,7 @@ private: public: unsigned long rounds = 10; - std::string Generate(const std::string& data, const std::string& salt) + static std::string Generate(const std::string& data, const std::string& salt) { char hash[64]; _crypt_blowfish_rn(data.c_str(), salt.c_str(), hash, sizeof(hash)); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index e810aed2c..57099b257 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -127,7 +127,7 @@ public: return CmdResult::FAILURE; } const char *reason = (parameters.size() > 2) ? parameters[2].c_str() : "No reason supplied"; - CBan* r = new CBan(ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); + CBan* r = new CBan(ServerInstance->Time(), duration, user->nick, reason, parameters[0]); if (ServerInstance->XLines->AddLine(r, user)) { diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index ede792d42..ea3243272 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -41,7 +41,7 @@ private: User* const user; const std::string& target; - std::string FormatTime(time_t ts) + static std::string FormatTime(time_t ts) { std::string timestr(InspIRCd::TimeString(ts, "%Y-%m-%d %H:%M:%S UTC (", true)); timestr.append(ConvToStr(ts)); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index c8a8cfaa2..c8766478f 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -241,7 +241,7 @@ public: * @param domainparts The number of domain labels that should be visible. * @return The visible segment of the hostname. */ - std::string VisibleDomainParts(const std::string& host, unsigned int domainparts) + static std::string VisibleDomainParts(const std::string& host, unsigned int domainparts) { // The position at which we found the last dot. std::string::const_reverse_iterator dotpos; @@ -302,8 +302,11 @@ public: std::string SegmentIP(const CloakInfo& info, const irc::sockets::sockaddrs& ip, bool full) { std::string bindata; - size_t hop1, hop2, hop3; - size_t len1, len2; + size_t hop1; + size_t hop2; + size_t hop3; + size_t len1; + size_t len2; std::string rv; if (ip.family() == AF_INET6) { diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index f72907bcf..e6ff7a919 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -198,7 +198,7 @@ private: hashmap.swap(newhash); } - void CheckDuplicateNick() + static void CheckDuplicateNick() { insp::flat_set<std::string, irc::insensitive_swo> duplicates; for (auto* user : ServerInstance->Users.GetLocalUsers()) @@ -211,7 +211,7 @@ private: } } - void CheckInvalidNick() + static void CheckInvalidNick() { for (auto* user : ServerInstance->Users.GetLocalUsers()) { diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index cf11e299e..535702101 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -47,7 +47,7 @@ private: time_t ignoreuntil = 0; std::string banmessage; - unsigned char GetRange(LocalUser* user) + unsigned char GetRange(LocalUser* user) const { int family = user->client_sa.family(); switch (family) diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index f113215f7..3384741f3 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -194,6 +194,7 @@ public: : Command(parent, "DCCALLOW", 0) , ext(Ext) { + allow_empty_last_param = false; syntax = { "[(+|-)<nick> [<time>]]", "LIST", "HELP" }; /* XXX we need to fix this so it can work with translation stuff (i.e. move +- into a seperate param */ } @@ -201,15 +202,15 @@ public: CmdResult Handle(User* user, const Params& parameters) override { /* syntax: DCCALLOW [(+|-)<nick> [<time>]]|[LIST|HELP] */ - if (!parameters.size()) + if (parameters.empty()) { // display current DCCALLOW list DisplayDCCAllowList(user); return CmdResult::FAILURE; } - else if (parameters.size() > 0) + else { - char action = *parameters[0].c_str(); + char action = parameters[0][0]; // if they didn't specify an action, this is probably a command if (action != '+' && action != '-') @@ -344,7 +345,7 @@ public: return ROUTE_BROADCAST; } - void DisplayHelp(User* user) + static void DisplayHelp(User* user) { user->WriteNumeric(RPL_HELPSTART, "*", "DCCALLOW [(+|-)<nick> [<time>]]|[LIST|HELP]"); for (const auto& helpline : helptext) @@ -436,7 +437,7 @@ public: if (irc::equals(ctcpname, "DCC") && !ctcpbody.empty()) { dl = ext.Get(u); - if (dl && dl->size()) + if (dl && !dl->empty()) { for (const auto& dccallow : *dl) { @@ -524,7 +525,7 @@ public: dl = ext.Get(u); if (dl) { - if (dl->size()) + if (!dl->empty()) { dccallowlist::iterator iter2 = dl->begin(); while (iter2 != dl->end()) @@ -559,7 +560,7 @@ public: dl = ext.Get(u); if (dl) { - if (dl->size()) + if (!dl->empty()) { for (dccallowlist::iterator i = dl->begin(); i != dl->end(); ++i) { @@ -582,7 +583,7 @@ public: } } - void RemoveFromUserlist(User *user) + static void RemoveFromUserlist(User *user) { // remove user from userlist for (userlist::iterator j = ul.begin(); j != ul.end(); ++j) diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index 774ecb278..57f471d13 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -64,7 +64,7 @@ private: } } - void WriteLog(const char* message, ...) ATTR_PRINTF(2, 3) + void WriteLog(const char* message, ...) const ATTR_PRINTF(2, 3) { std::string buffer; VAFORMAT(buffer, message, message); @@ -127,7 +127,7 @@ public: ModResult OnNumeric(User* user, const Numeric::Numeric& numeric) override { - if (numeric.GetNumeric() != RPL_COMMANDS || numeric.GetParams().size() < 1) + if (numeric.GetNumeric() != RPL_COMMANDS || numeric.GetParams().empty()) return MOD_RES_PASSTHRU; // The numeric isn't the one we care about. if (!fakenonexistent || !IS_LOCAL(user)) diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 5530f0fde..d1e55238f 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -411,11 +411,10 @@ public: std::string reversedip; if (user->client_sa.family() == AF_INET) { - unsigned int a, b, c, d; - d = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 24) & 0xFF; - c = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 16) & 0xFF; - b = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 8) & 0xFF; - a = (unsigned int) user->client_sa.in4.sin_addr.s_addr & 0xFF; + unsigned int a = (unsigned int) user->client_sa.in4.sin_addr.s_addr & 0xFF; + unsigned int b = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 8) & 0xFF; + unsigned int c = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 16) & 0xFF; + unsigned int d = (unsigned int) (user->client_sa.in4.sin_addr.s_addr >> 24) & 0xFF; reversedip = ConvToStr(d) + "." + ConvToStr(c) + "." + ConvToStr(b) + "." + ConvToStr(a); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 51c13c07a..cb1d6a893 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -229,7 +229,7 @@ public: std::pair<bool, std::string> AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags, bool config = false); void ReadConfig(ConfigStatus& status) override; void GetLinkData(LinkData& data, std::string& compatdata) override; - std::string EncodeFilter(const FilterResult& filter); + static std::string EncodeFilter(const FilterResult& filter); FilterResult DecodeFilter(const std::string &data); void OnSyncNetwork(ProtocolInterface::Server& server) override; void OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata) override; @@ -465,7 +465,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { - Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); + Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their message to %s matched %s (%s)", user->nick.c_str(), sh->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), @@ -479,7 +479,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_GLINE) { - GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their message to %s matched %s (%s)", user->nick.c_str(), gl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), @@ -493,7 +493,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_ZLINE) { - ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); + ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their message to %s matched %s (%s)", user->nick.c_str(), zl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), @@ -522,7 +522,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& if (command == "QUIT") { /* QUIT with no reason: nothing to do */ - if (parameters.size() < 1) + if (parameters.empty()) return MOD_RES_PASSTHRU; parting = false; @@ -570,7 +570,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& if (f->action == FA_GLINE) { /* Note: We G-line *@IP so that if their host doesn't resolve the G-line still applies. */ - GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their %s message matched %s (%s)", user->nick.c_str(), gl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), @@ -586,7 +586,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& } if (f->action == FA_ZLINE) { - ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); + ZLine* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their %s message matched %s (%s)", user->nick.c_str(), zl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), @@ -603,7 +603,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { /* Note: We shun *!*@IP so that if their host doesnt resolve the shun still applies. */ - Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), user->GetIPString()); + Shun* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their %s message matched %s (%s)", user->nick.c_str(), sh->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(), diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 6e9a0f861..e1f5e7292 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -42,9 +42,9 @@ public: { std::string servername = parameters.size() > 1 ? parameters[1] : "*"; - if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, servername)) { - if (ServerInstance->Modules.Load(parameters[0].c_str())) + if (ServerInstance->Modules.Load(parameters[0])) { ServerInstance->SNO.WriteToSnoMask('a', "NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0].c_str(), user->nick.c_str()); user->WriteRemoteNumeric(RPL_LOADEDMODULE, parameters[0], "Module successfully loaded."); @@ -88,7 +88,7 @@ public: std::string servername = parameters.size() > 1 ? parameters[1] : "*"; - if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, servername)) { Module* m = ServerInstance->Modules.Find(parameters[0]); if (m) @@ -134,7 +134,7 @@ public: { std::string servername = parameters.size() > 1 ? parameters[1] : "*"; - if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername)) + if (InspIRCd::Match(ServerInstance->Config->ServerName, servername)) { Module* m = ServerInstance->Modules.Find(parameters[0]); if (m) diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 17b5c4c24..b923e6371 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -192,7 +192,7 @@ public: } } - bool HasResult() + bool HasResult() const { return done; } diff --git a/src/modules/m_ircv3_capnotify.cpp b/src/modules/m_ircv3_capnotify.cpp index 9a06189fa..0706ba88b 100644 --- a/src/modules/m_ircv3_capnotify.cpp +++ b/src/modules/m_ircv3_capnotify.cpp @@ -28,9 +28,7 @@ class CapNotify final bool OnRequest(LocalUser* user, bool add) override { // Users using the negotiation protocol v3.2 or newer may not turn off cap-notify - if ((!add) && (GetProtocol(user) != Cap::CAP_LEGACY)) - return false; - return true; + return add || GetProtocol(user) == Cap::CAP_LEGACY; } bool OnList(LocalUser* user) override diff --git a/src/modules/m_ircv3_sts.cpp b/src/modules/m_ircv3_sts.cpp index d2823f895..2f5287248 100644 --- a/src/modules/m_ircv3_sts.cpp +++ b/src/modules/m_ircv3_sts.cpp @@ -132,7 +132,7 @@ private: STSCap cap; // The IRCv3 STS specification requires that the server is listening using TLS using a valid certificate. - bool HasValidSSLPort(unsigned int port) + static bool HasValidSSLPort(unsigned int port) { for (const auto& ls : ServerInstance->ports) { diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index f7e4aaa1d..4aca441e1 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -59,7 +59,7 @@ public: counter++; } - bool shouldlock() + bool shouldlock() const { return (counter >= this->joins); } diff --git a/src/modules/m_log_sql.cpp b/src/modules/m_log_sql.cpp index 4ffe6784a..7e02d43f9 100644 --- a/src/modules/m_log_sql.cpp +++ b/src/modules/m_log_sql.cpp @@ -87,7 +87,6 @@ public: { } -public: Log::MethodPtr Create(std::shared_ptr<ConfigTag> tag) override { dynamic_reference<SQL::Provider> sql(creator, "SQL"); diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 7386041c4..8a1c9eb3b 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -43,8 +43,8 @@ public: MD5_Update(&context, reinterpret_cast<const unsigned char*>(data.data()), data.length()); std::vector<unsigned char> bytes(16); - MD5_Final(&bytes[0], &context); - return std::string(reinterpret_cast<const char*>(&bytes[0]), bytes.size()); + MD5_Final(bytes.data(), &context); + return std::string(reinterpret_cast<const char*>(bytes.data()), bytes.size()); } MD5Provider(Module* parent) diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index e2970e073..9e13975d1 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -58,7 +58,7 @@ public: counter++; } - bool shouldlock() + bool shouldlock() const { return ((ServerInstance->Time() <= reset) && (counter == this->nicks)); } diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 72fa45817..fa9ae2fe5 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -109,7 +109,7 @@ private: return false; } - ModResult HandleJoinOverride(LocalUser* user, Channel* chan, const std::string& keygiven, const char* bypasswhat, const char* mode) + ModResult HandleJoinOverride(LocalUser* user, Channel* chan, const std::string& keygiven, const char* bypasswhat, const char* mode) const { if (RequireKey && keygiven != "override") { diff --git a/src/modules/m_pbkdf2.cpp b/src/modules/m_pbkdf2.cpp index 3811ccff8..259f326ad 100644 --- a/src/modules/m_pbkdf2.cpp +++ b/src/modules/m_pbkdf2.cpp @@ -66,11 +66,9 @@ public: return ConvToStr(this->iterations) + ":" + Base64::Encode(this->hash) + ":" + Base64::Encode(this->salt); } - bool IsValid() + bool IsValid() const { - if (!this->iterations || !this->length || this->salt.empty() || this->hash.empty()) - return false; - return true; + return this->iterations && this->length && !this->salt.empty() && !this->hash.empty(); } }; @@ -82,7 +80,7 @@ public: unsigned long iterations; size_t dkey_length; - std::string PBKDF2(const std::string& pass, const std::string& salt, unsigned long itr = 0, size_t dkl = 0) + std::string PBKDF2(const std::string& pass, const std::string& salt, unsigned long itr = 0, size_t dkl = 0) const { size_t blocks = std::ceil((double)dkl / provider->out_size); diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index 9120cde9a..33bcf731a 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -262,7 +262,7 @@ public: } private: - bool ParseSettings(User* source, std::string& parameter, ChannelSettings& settings) + static bool ParseSettings(User* source, std::string& parameter, ChannelSettings& settings) { irc::sepstream stream(parameter, ':'); std::string item; diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 073ab6a80..acbff05ae 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -32,7 +32,7 @@ class ModuleRestrictMsg final , public CTCTags::EventListener { private: - ModResult HandleMessage(User* user, const MessageTarget& target) + static ModResult HandleMessage(User* user, const MessageTarget& target) { if ((target.type == MessageTarget::TYPE_USER) && (IS_LOCAL(user))) { diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index daf59ff7e..0d1d01f91 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -68,7 +68,7 @@ public: { if (ZlineOnMatch) { - ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString()); + ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason, u->GetIPString()); if (ServerInstance->XLines->AddLine(zl, nullptr)) { if (!duration) @@ -161,7 +161,7 @@ public: try { - r = factory.Generate(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + r = factory.Generate(ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]); } catch (const ModuleException& e) { diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 7bca715db..48cd996f2 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -210,7 +210,7 @@ public: SendSASL(user, "*", 'S', params); } - SaslResult GetSaslResult(const std::string &result_) + static SaslResult GetSaslResult(const std::string &result_) { if (result_ == "F") return SASL_FAIL; @@ -351,7 +351,7 @@ public: SaslAuthenticator *sasl = authExt.Get(user); if (!sasl) authExt.SetFwd(user, user, parameters[0], sslapi); - else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod + else if (!sasl->SendClientMessage(parameters)) { sasl->AnnounceState(); authExt.Unset(user); diff --git a/src/modules/m_sha2.cpp b/src/modules/m_sha2.cpp index 7d85d5a8e..44f92c17c 100644 --- a/src/modules/m_sha2.cpp +++ b/src/modules/m_sha2.cpp @@ -52,8 +52,8 @@ public: std::string GenerateRaw(const std::string& data) override { std::vector<char> bytes(out_size); - SHA(reinterpret_cast<const unsigned char*>(data.data()), static_cast<unsigned int>(data.size()), reinterpret_cast<unsigned char*>(&bytes[0])); - return std::string(&bytes[0], bytes.size()); + SHA(reinterpret_cast<const unsigned char*>(data.data()), static_cast<unsigned int>(data.size()), reinterpret_cast<unsigned char*>(bytes.data())); + return std::string(bytes.data(), bytes.size()); } }; diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 56147c5a4..7656e2c3c 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -52,7 +52,7 @@ public: access_needed = CmdAccess::SERVER; } - void HandleFast(User* dest, User* src) + static void HandleFast(User* dest, User* src) { dest->WriteNotice("*** " + src->nick + " (" + src->ident + "@" + src->GetHost(dest->HasPrivPermission("users/auspex")) + diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index e28043da6..07a3119dc 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -113,7 +113,7 @@ public: expr = parameters[1]; } - Shun* r = new Shun(ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str()); + Shun* r = new Shun(ServerInstance->Time(), duration, user->nick, expr, target); if (ServerInstance->XLines->AddLine(r, user)) { if (!duration) @@ -152,7 +152,7 @@ private: TokenList enabledcommands; bool notifyuser; - bool IsShunned(LocalUser* user) + bool IsShunned(LocalUser* user) const { // Exempt the user if they are not fully connected and allowconnect is enabled. if (allowconnect && user->registered != REG_ALL) diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index bd9e3138d..08533f5a8 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -201,7 +201,9 @@ namespace return true; bool okay; - std::ostringstream diffconfig, localmissing, remotemissing; + std::ostringstream diffconfig; + std::ostringstream localmissing; + std::ostringstream remotemissing; if (protocol <= PROTO_INSPIRCD_3) okay = CompareModulesOld(property, *remote, diffconfig, localmissing, remotemissing); else @@ -418,7 +420,7 @@ void TreeSocket::ListDifference(const std::string &one, const std::string &two, bool TreeSocket::Capab(const CommandBase::Params& params) { - if (params.size() < 1) + if (params.empty()) { this->SendError("Invalid number of parameters for CAPAB - Mismatched version"); return false; @@ -471,7 +473,8 @@ bool TreeSocket::Capab(const CommandBase::Params& params) { if (capab->ChanModes != BuildModeList(MODETYPE_CHANNEL)) { - std::string diffIneed, diffUneed; + std::string diffIneed; + std::string diffUneed; ListDifference(capab->ChanModes, BuildModeList(MODETYPE_CHANNEL), ' ', diffIneed, diffUneed); if (diffIneed.length() || diffUneed.length()) { @@ -489,7 +492,8 @@ bool TreeSocket::Capab(const CommandBase::Params& params) { if (capab->UserModes != BuildModeList(MODETYPE_USER)) { - std::string diffIneed, diffUneed; + std::string diffIneed; + std::string diffUneed; ListDifference(capab->UserModes, BuildModeList(MODETYPE_USER), ' ', diffIneed, diffUneed); if (diffIneed.length() || diffUneed.length()) { diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h index cf3e1590d..8e8e31f94 100644 --- a/src/modules/m_spanningtree/commands.h +++ b/src/modules/m_spanningtree/commands.h @@ -161,7 +161,7 @@ class CommandFJoin final * @param newname The new name of the channel; must be the same or a case change of the current name */ static void LowerTS(Channel* chan, time_t TS, const std::string& newname); - void ProcessModeUUIDPair(const std::string& item, TreeServer* sourceserver, Channel* chan, Modes::ChangeList* modechangelist, FwdFJoinBuilder& fwdfjoin); + static void ProcessModeUUIDPair(const std::string& item, TreeServer* sourceserver, Channel* chan, Modes::ChangeList* modechangelist, FwdFJoinBuilder& fwdfjoin); public: CommandFJoin(Module* Creator) : ServerCommand(Creator, "FJOIN", 3) { } CmdResult Handle(User* user, Params& params) override; diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 7e3c6fcd5..3e0e654f6 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -60,5 +60,4 @@ void TreeSocket::WriteLine(const std::string& original_line) } WriteLineInternal(line); - return; } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index abbb21efd..4b14352b9 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -146,11 +146,11 @@ public: /** Handle SQUIT */ - ModResult HandleSquit(const CommandBase::Params& parameters, User* user); + static ModResult HandleSquit(const CommandBase::Params& parameters, User* user); /** Handle remote WHOIS */ - ModResult HandleRemoteWhois(const CommandBase::Params& parameters, User* user); + static ModResult HandleRemoteWhois(const CommandBase::Params& parameters, User* user); /** Connect a server locally */ @@ -166,11 +166,11 @@ public: /** Check if any connecting servers should timeout */ - void DoConnectTimeout(time_t curtime); + static void DoConnectTimeout(time_t curtime); /** Handle remote VERSION */ - ModResult HandleVersion(const CommandBase::Params& parameters, User* user); + static ModResult HandleVersion(const CommandBase::Params& parameters, User* user); /** Handle CONNECT */ diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index b686b4c69..0abd3634c 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -179,7 +179,7 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, size_t m CmdResult CommandMap::Handle(User* user, const Params& parameters) { - if (parameters.size() > 0) + if (!parameters.empty()) { // Remote MAP, the target server is the 1st parameter TreeServer* s = Utils->FindServerMask(parameters[0]); diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp index 0ed22845e..452cfde64 100644 --- a/src/modules/m_spanningtree/ping.cpp +++ b/src/modules/m_spanningtree/ping.cpp @@ -27,7 +27,6 @@ #include "utils.h" #include "treeserver.h" #include "commands.h" -#include "utils.h" CmdResult CommandPing::Handle(User* user, Params& params) { diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp index 342ca9a7a..fca5e3d85 100644 --- a/src/modules/m_spanningtree/pong.cpp +++ b/src/modules/m_spanningtree/pong.cpp @@ -27,7 +27,6 @@ #include "utils.h" #include "treeserver.h" #include "commands.h" -#include "utils.h" CmdResult CommandPong::HandleServer(TreeServer* server, CommandBase::Params& params) { diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index a37d0d52a..b9f745deb 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -52,7 +52,7 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, CommandBase::Pa return this->HandleRemoteWhois(parameters,user); } } - else if ((command == "VERSION") && (parameters.size() > 0)) + else if ((command == "VERSION") && (!parameters.empty())) { return this->HandleVersion(parameters,user); } diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 535299e72..cddcd03b4 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -111,7 +111,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) this->SendCapabilities(2); - if (!ServerInstance->IsSID(sid)) + if (!InspIRCd::IsSID(sid)) { this->SendError("Invalid format server ID: "+sid+"!"); return nullptr; diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 85e5de440..914123bf5 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -232,7 +232,7 @@ public: /** Construct a password, optionally hashed with the other side's * challenge string */ - std::string MakePass(const std::string &password, const std::string &challenge); + static std::string MakePass(const std::string &password, const std::string &challenge); /** When an outbound connection finishes connecting, we receive * this event, and must send our SERVER string to the other @@ -260,20 +260,20 @@ public: /** Returns mode list as a string, filtered by type. * @param type The type of modes to return. */ - std::string BuildModeList(ModeType type); + static std::string BuildModeList(ModeType type); /** If the extban manager exists then build an extban list. * @param out The buffer to put the extban list in. * @return True if the extban manager exists; otherwise, false. */ - bool BuildExtBanList(std::string& out); + static bool BuildExtBanList(std::string& out); /** Send my capabilities to the remote side */ void SendCapabilities(int phase); /* Isolate and return the elements that are different between two lists */ - void ListDifference(const std::string &one, const std::string &two, char sep, + static void ListDifference(const std::string &one, const std::string &two, char sep, std::string& mleft, std::string& mright); bool Capab(const CommandBase::Params& params); @@ -326,7 +326,7 @@ public: void ProcessLine(std::string &line); /** Process message tags received from a remote server. */ - void ProcessTag(User* source, const std::string& tag, ClientProtocol::TagMap& tags); + static void ProcessTag(User* source, const std::string& tag, ClientProtocol::TagMap& tags); /** Process a message for a fully connected server. */ void ProcessConnectedLine(std::string& tags, std::string& prefix, std::string& command, CommandBase::Params& params); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 602c0dde4..cacccf544 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -37,7 +37,7 @@ /* Handle ERROR command */ void TreeSocket::Error(CommandBase::Params& params) { - std::string msg = params.size() ? params[0] : ""; + const std::string msg = params.empty() ? "" : params[0]; SetError("received ERROR " + msg); } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 1d90053b1..616b7c199 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -135,7 +135,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } // Returns a list of DIRECT servers for a specific channel -void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet& list, char status, const CUList& exempt_list) +void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet& list, char status, const CUList& exempt_list) const { ModeHandler::Rank minrank = 0; if (status) @@ -175,7 +175,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet } } -void SpanningTreeUtilities::DoOneToAllButSender(const CmdBuilder& params, TreeServer* omitroute) +void SpanningTreeUtilities::DoOneToAllButSender(const CmdBuilder& params, TreeServer* omitroute) const { const std::string& FullLine = params.str(); diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 074c1c993..dcf5b73c2 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -127,11 +127,11 @@ public: /** Send a message from this server to one other local or remote */ - void DoOneToOne(const CmdBuilder& params, Server* target); + static void DoOneToOne(const CmdBuilder& params, Server* target); /** Send a message from this server to all but one other, local or remote */ - void DoOneToAllButSender(const CmdBuilder& params, TreeServer* omit); + void DoOneToAllButSender(const CmdBuilder& params, TreeServer* omit) const; /** Read the spanningtree module's tags from the config file */ @@ -139,11 +139,11 @@ public: /** Handle nick collision */ - bool DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd); + static bool DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd); /** Compile a list of servers which contain members of channel c */ - void GetListOfServersForChannel(Channel* c, TreeSocketSet& list, char status, const CUList& exempt_list); + void GetListOfServersForChannel(Channel* c, TreeSocketSet& list, char status, const CUList& exempt_list) const; /** Find a server by name or SID */ @@ -175,9 +175,9 @@ public: void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = nullptr); // Builds link data to be sent to another server. - std::string BuildLinkString(uint16_t protocol, Module* mod); + static std::string BuildLinkString(uint16_t protocol, Module* mod); /** Send the channel list mode limits to either the specified server or all servers if nullptr. */ - void SendListLimits(Channel* chan, TreeSocket* sock = nullptr); + static void SendListLimits(Channel* chan, TreeSocket* sock = nullptr); }; diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 7a4601289..511efe21f 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -278,7 +278,7 @@ private: CommandSSLInfo cmd; std::string hash; - bool MatchFP(ssl_cert* const cert, const std::string& fp) const + static bool MatchFP(ssl_cert* const cert, const std::string& fp) { return irc::spacesepstream(fp).Contains(cert->GetFingerprint()); } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 469130fcb..287c83563 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -51,9 +51,7 @@ public: bool Matches(User* u) override { - if (u->nick == nickname) - return true; - return false; + return u->nick == nickname; } bool Matches(const std::string& s) override @@ -138,7 +136,7 @@ public: user->WriteNotice("*** Invalid duration for SVSHOLD."); return CmdResult::FAILURE; } - SVSHold* r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + SVSHold* r = new SVSHold(ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]); if (ServerInstance->XLines->AddLine(r, user)) { |
