diff options
70 files changed, 303 insertions, 299 deletions
diff --git a/include/snomasks.h b/include/snomasks.h index db8dbf59e..c9f8feb3f 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -104,7 +104,7 @@ public: template <typename... Args> void WriteToSnoMask(char letter, const char* text, Args&&... args) { - WriteToSnoMask(letter, fmt::sprintf(text, std::forward<Args>(args)...)); + WriteToSnoMask(letter, fmt::format(text, std::forward<Args>(args)...)); } /** Write to all users with a given snomask (sent globally) @@ -121,7 +121,7 @@ public: template <typename... Args> void WriteGlobalSno(char letter, const char* text, Args&&... args) { - WriteGlobalSno(letter, fmt::sprintf(text, std::forward<Args>(args)...)); + WriteGlobalSno(letter, fmt::format(text, std::forward<Args>(args)...)); } /** Called once per 5 seconds from the mainloop, this flushes any cached diff --git a/src/coremods/core_loadmodule.cpp b/src/coremods/core_loadmodule.cpp index 2ddec3dd0..2e5da5915 100644 --- a/src/coremods/core_loadmodule.cpp +++ b/src/coremods/core_loadmodule.cpp @@ -44,7 +44,7 @@ CmdResult CommandLoadmodule::Handle(User* user, const Params& parameters) { if (ServerInstance->Modules.Load(parameters[0])) { - ServerInstance->SNO.WriteGlobalSno('a', "NEW MODULE: %s loaded %s", user->nick.c_str(), parameters[0].c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "NEW MODULE: {} loaded {}", user->nick, parameters[0]); user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "Module successfully loaded."); return CmdResult::SUCCESS; } @@ -86,7 +86,7 @@ CmdResult CommandUnloadmodule::Handle(User* user, const Params& parameters) if (m && ServerInstance->Modules.Unload(m)) { - ServerInstance->SNO.WriteGlobalSno('a', "MODULE UNLOADED: %s unloaded %s", user->nick.c_str(), parameters[0].c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "MODULE UNLOADED: {} unloaded {}", user->nick, parameters[0]); user->WriteNumeric(RPL_UNLOADEDMODULE, parameters[0], "Module successfully unloaded."); } else diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp index d1ab8c1c0..dbc4d2034 100644 --- a/src/coremods/core_oper/cmd_die.cpp +++ b/src/coremods/core_oper/cmd_die.cpp @@ -70,7 +70,7 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters) else { ServerInstance->Logs.Error(MODNAME, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); - ServerInstance->SNO.WriteGlobalSno('a', "Failed DIE command from %s.", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Failed DIE command from {}.", user->GetFullRealHost()); return CmdResult::FAILURE; } } diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp index cd9dee907..04d416c06 100644 --- a/src/coremods/core_oper/cmd_kill.cpp +++ b/src/coremods/core_oper/cmd_kill.cpp @@ -115,9 +115,9 @@ CmdResult CommandKill::Handle(User* user, const Params& parameters) if ((!hideservicekills) || (!user->server->IsService())) { if (IS_LOCAL(user) && IS_LOCAL(target)) - ServerInstance->SNO.WriteGlobalSno('k', "Local kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); + ServerInstance->SNO.WriteGlobalSno('k', "Local kill by {}: {} ({})", user->nick, target->GetFullRealHost(), parameters[1]); else - ServerInstance->SNO.WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), target->GetFullRealHost().c_str(), parameters[1].c_str()); + ServerInstance->SNO.WriteToSnoMask('K', "Remote kill by {}: {} ({})", user->nick, target->GetFullRealHost(), parameters[1]); } if (IS_LOCAL(target)) diff --git a/src/coremods/core_oper/cmd_oper.cpp b/src/coremods/core_oper/cmd_oper.cpp index 10e098019..6cfe14ccd 100644 --- a/src/coremods/core_oper/cmd_oper.cpp +++ b/src/coremods/core_oper/cmd_oper.cpp @@ -49,8 +49,8 @@ CmdResult CommandOper::HandleLocal(LocalUser* user, const Params& parameters) auto it = ServerInstance->Config->OperAccounts.find(parameters[0]); if (it == ServerInstance->Config->OperAccounts.end()) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because no account with that name exists.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), parameters[0].c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because no account with that name exists.", + user->nick, user->MakeHost(), user->GetIPString(), parameters[0]); return FailedOper(user, parameters[0]); } @@ -58,8 +58,8 @@ CmdResult CommandOper::HandleLocal(LocalUser* user, const Params& parameters) auto account = it->second; if (!account->CheckPassword(parameters[1])) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because they specified the wrong password.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), parameters[0].c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they specified the wrong password.", + user->nick, user->MakeHost(), user->GetIPString(), parameters[0]); return FailedOper(user, parameters[0]); } diff --git a/src/coremods/core_oper/cmd_rehash.cpp b/src/coremods/core_oper/cmd_rehash.cpp index 7809f968f..b90e3cd48 100644 --- a/src/coremods/core_oper/cmd_rehash.cpp +++ b/src/coremods/core_oper/cmd_rehash.cpp @@ -79,8 +79,8 @@ CmdResult CommandRehash::Handle(User* user, const Params& parameters) { const std::string configfile = std::filesystem::path(ServerInstance->ConfigFileName).filename().string(); user->WriteRemoteNumeric(RPL_REHASHING, configfile, "Rehashing " + ServerInstance->Config->ServerName); - ServerInstance->SNO.WriteGlobalSno('r', "%s is rehashing %s on %s", user->nick.c_str(), - configfile.c_str(), ServerInstance->Config->ServerName.c_str()); + ServerInstance->SNO.WriteGlobalSno('r', "{} is rehashing {} on {}", user->nick, + configfile, ServerInstance->Config->ServerName); /* Don't do anything with the logs here -- logs are restarted * after the config thread has completed. diff --git a/src/coremods/core_oper/cmd_restart.cpp b/src/coremods/core_oper/cmd_restart.cpp index 72bcd1620..3ae3a8e2e 100644 --- a/src/coremods/core_oper/cmd_restart.cpp +++ b/src/coremods/core_oper/cmd_restart.cpp @@ -47,7 +47,7 @@ CmdResult CommandRestart::Handle(User* user, const Params& parameters) ServerInstance->Logs.Normal(MODNAME, "Restart: %s", user->nick.c_str()); if (irc::equals(parameters[0], ServerInstance->Config->ServerName)) { - ServerInstance->SNO.WriteGlobalSno('a', "RESTART command from %s, restarting server.", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "RESTART command from {}, restarting server.", user->GetFullRealHost()); DieRestart::SendError("Server restarting."); @@ -67,12 +67,12 @@ CmdResult CommandRestart::Handle(User* user, const Params& parameters) #endif execvp(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv); - ServerInstance->SNO.WriteGlobalSno('a', "Failed RESTART - could not execute '%s' (%s)", + ServerInstance->SNO.WriteGlobalSno('a', "Failed RESTART - could not execute '{}' ({})", ServerInstance->Config->cmdline.argv[0], strerror(errno)); } else { - ServerInstance->SNO.WriteGlobalSno('a', "Failed RESTART Command from %s.", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Failed RESTART Command from {}.", user->GetFullRealHost()); } return CmdResult::FAILURE; } diff --git a/src/coremods/core_oper/core_oper.cpp b/src/coremods/core_oper/core_oper.cpp index 1a8d40925..17a32bd4c 100644 --- a/src/coremods/core_oper/core_oper.cpp +++ b/src/coremods/core_oper/core_oper.cpp @@ -89,8 +89,8 @@ public: if (!automatic) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because they are connecting from the wrong user@host.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), oper->GetName().c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are connecting from the wrong user@host.", + user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); } return MOD_RES_DENY; // Host does not match. } @@ -104,9 +104,9 @@ public: luser->WriteNumeric(RPL_YOUAREOPER, INSP_FORMAT("You are now {} {}", strchr("AEIOUaeiou", user->oper->GetType()[0]) ? "an" : "a", user->oper->GetType())); - ServerInstance->SNO.WriteToSnoMask('o', "%s (%s) [%s] is now a server operator of type \x02%s\x02 (%susing account \x02%s\x02).", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), user->oper->GetType().c_str(), - automatic ? "automatically " : "", user->oper->GetName().c_str()); + ServerInstance->SNO.WriteToSnoMask('o', "{} ({}) [{}] is now a server operator of type \x02{}\x02 ({}using account \x02{}\x02).", + user->nick, user->MakeHost(), user->GetIPString(), user->oper->GetType(), + automatic ? "automatically " : "", user->oper->GetName()); const std::string vhost = luser->oper->GetConfig()->getString("vhost"); if (!vhost.empty()) diff --git a/src/coremods/core_oper/umode_o.cpp b/src/coremods/core_oper/umode_o.cpp index f0373e7b0..c2810479f 100644 --- a/src/coremods/core_oper/umode_o.cpp +++ b/src/coremods/core_oper/umode_o.cpp @@ -48,7 +48,7 @@ bool ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, Modes::C * to your User! */ char snomask = IS_LOCAL(dest) ? 'o' : 'O'; - ServerInstance->SNO.WriteToSnoMask(snomask, "User %s de-opered (by %s)", dest->nick.c_str(), source->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask(snomask, "User {} de-opered (by {})", dest->nick, source->nick); dest->OperLogout(); return true; diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index 8ebabc7be..61f094c8d 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -698,12 +698,12 @@ public: { Module* newmod = ServerInstance->Modules.Find(name); datakeeper.Restore(newmod); - ServerInstance->SNO.WriteGlobalSno('a', "The %s module was reloaded.", passedname.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "The {} module was reloaded.", passedname); } else { datakeeper.Fail(); - ServerInstance->SNO.WriteGlobalSno('a', "Failed to reload the %s module.", passedname.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Failed to reload the {} module.", passedname); } auto* user = ServerInstance->Users.FindUUID(uuid); diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index db86ab542..4b732d7b1 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -109,7 +109,7 @@ void CommandStats::DoStats(Stats::Context& stats) if (!isPublic && !isRemoteOper && !isLocalOperWithPrivs) { const char* what = IS_LOCAL(user) ? "Stats" : "Remote stats"; - ServerInstance->SNO.WriteToSnoMask('t', "%s '%c' denied for %s (%s)", what, statschar, user->nick.c_str(), user->MakeHost().c_str()); + ServerInstance->SNO.WriteToSnoMask('t', "{} '{}' denied for {} ({})", what, statschar, user->nick, user->MakeHost()); stats.AddRow(481, (std::string("Permission Denied - STATS ") + statschar + " requires the servers/auspex priv.")); return; } @@ -118,7 +118,7 @@ void CommandStats::DoStats(Stats::Context& stats) if (res == MOD_RES_DENY) { const char* what = IS_LOCAL(user) ? "Stats" : "Remote stats"; - ServerInstance->SNO.WriteToSnoMask('t', "%s '%c' denied for %s (%s)", what, statschar, user->nick.c_str(), user->MakeHost().c_str()); + ServerInstance->SNO.WriteToSnoMask('t', "{} '{}' denied for {} ({})", what, statschar, user->nick, user->MakeHost()); stats.AddRow(219, statschar, "End of /STATS report"); return; } @@ -357,8 +357,8 @@ void CommandStats::DoStats(Stats::Context& stats) } stats.AddRow(219, statschar, "End of /STATS report"); - ServerInstance->SNO.WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)", - (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->GetRealHost().c_str()); + ServerInstance->SNO.WriteToSnoMask('t', "{} '{}' requested by {} ({}@{})", (IS_LOCAL(user) ? "Stats" : "Remote stats"), + statschar, user->nick, user->ident, user->GetRealHost()); } CmdResult CommandStats::Handle(User* user, const Params& parameters) diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp index 2f4203f3c..9c9a6613d 100644 --- a/src/coremods/core_user/core_user.cpp +++ b/src/coremods/core_user/core_user.cpp @@ -238,8 +238,8 @@ public: ServerInstance->Users.QuitUser(user, "No more local connections allowed from your host via this connect class."); if (klass->maxconnwarn) { - ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum local connections for the %s class (%ld) exceeded by %s", - klass->GetName().c_str(), klass->maxlocal, user->GetIPString().c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum local connections for the {} class ({}) exceeded by {}", + klass->GetName(), klass->maxlocal, user->GetIPString()); } return; } @@ -249,8 +249,8 @@ public: ServerInstance->Users.QuitUser(user, "No more global connections allowed from your host via this connect class."); if (klass->maxconnwarn) { - ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum global connections for the %s class (%ld) exceeded by %s", - klass->name.c_str(), klass->maxglobal, user->GetIPString().c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "WARNING: maximum global connections for the {} class ({}) exceeded by {}", + klass->GetName(), klass->maxglobal, user->GetIPString()); } return; } diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 2467c3f44..92f847f56 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -77,13 +77,13 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent E-line on %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent E-line on {}: {}", user->nick, target, parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed E-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), target.c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed E-line on {}, expires in {} (on {}): {}", + user->nick, target, Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } } else @@ -98,7 +98,7 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters) if (ServerInstance->XLines->DelLine(target.c_str(), "E", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed E-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed E-line on {}: {}", user->nick, target, reason); } else { diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index 54cc506cb..4737170d3 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -84,13 +84,13 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent G-line on %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent G-line on {}: {}", user->nick, target, parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed G-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), target.c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed G-line on {}, expires in {} (on {}): {}", + user->nick, target, Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } ServerInstance->XLines->ApplyLines(); @@ -108,7 +108,7 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters) if (ServerInstance->XLines->DelLine(target.c_str(), "G", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed G-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed G-line on {}: {}", user->nick, target, reason); } else { diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index ad185124f..7560557d3 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -84,13 +84,13 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent K-line on %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent K-line on {}: {}", user->nick, target, parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed K-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), target.c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed K-line on {}, expires in {} (on {}): {}", + user->nick, target, Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } ServerInstance->XLines->ApplyLines(); @@ -107,7 +107,7 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters) if (ServerInstance->XLines->DelLine(target.c_str(), "K", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed K-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed K-line on {}: {}", user->nick, target, reason); } else { diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index 21713f669..cd075ea53 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -66,13 +66,13 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent Q-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Q-line on {}: {}", user->nick, parameters[0], parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed Q-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), parameters[0].c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Q-line on {}, expires in {} (on {}): {}", + user->nick, parameters[0], Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } ServerInstance->XLines->ApplyLines(); } @@ -88,7 +88,7 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters) if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed Q-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed Q-line on {}: {}", user->nick, parameters[0], reason); } else { diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp index 02f71cb7f..a4de0adc3 100644 --- a/src/coremods/core_xline/cmd_zline.cpp +++ b/src/coremods/core_xline/cmd_zline.cpp @@ -83,13 +83,13 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters) { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent Z-line on %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Z-line on {}: {}", user->nick, ipaddr, parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed Z-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), ipaddr, Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", + user->nick, ipaddr, Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } ServerInstance->XLines->ApplyLines(); } @@ -105,7 +105,7 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters) if (ServerInstance->XLines->DelLine(target.c_str(), "Z", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed Z-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed Z-line on {}: {}", user->nick, target, reason); } else { diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp index c99eeb577..6f0617176 100644 --- a/src/coremods/core_xline/core_xline.cpp +++ b/src/coremods/core_xline/core_xline.cpp @@ -43,8 +43,8 @@ bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User if (percent > itrigger) { const char* article = strchr("AEIOUaeiou", bantype) ? "an" : "a"; - ServerInstance->SNO.WriteToSnoMask('x', "\002WARNING\002: %s tried to set add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!", - user->nick.c_str(), article, bantype, mask.c_str(), percent, itrigger); + ServerInstance->SNO.WriteToSnoMask('x', "\002WARNING\002: {} tried to set add {} {}-line on {} which covers {:.2}% of the network which is more than the maximum of {:.2}%!", + user->nick.c_str(), article, bantype, mask, percent, itrigger); user->WriteNotice(INSP_FORMAT("*** Unable to add {} {}-line on {} which covers {:.2}% of the network which is more than the maximum of {:.2}%!", article, bantype, mask, percent, itrigger)); return true; @@ -152,8 +152,8 @@ public: // A Q-line matched the new nick, tell opers if the user is fully connected if (user->IsFullyConnected()) { - ServerInstance->SNO.WriteGlobalSno('x', "Q-lined nickname %s from %s: %s", - newnick.c_str(), user->GetFullRealHost().c_str(), xline->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('x', "Q-lined nickname {} from {}: {}", + newnick, user->GetFullRealHost(), xline->reason); } // Send a numeric because if we deny then the core doesn't reply anything diff --git a/src/cull.cpp b/src/cull.cpp index c4bb4ab84..cb1989f7c 100644 --- a/src/cull.cpp +++ b/src/cull.cpp @@ -70,8 +70,8 @@ void CullList::Apply() working.swap(SQlist); for (auto* u : working) { - ServerInstance->SNO.WriteGlobalSno('a', "User %s SendQ exceeds connect class maximum of %lu", - u->nick.c_str(), u->GetClass()->hardsendqmax); + ServerInstance->SNO.WriteGlobalSno('a', "User {} SendQ exceeds connect class maximum of {}", + u->nick, u->GetClass()->hardsendqmax); ServerInstance->Users.QuitUser(u, "SendQ exceeded"); } working.clear(); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5a15bd6da..fa5cc860f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -131,10 +131,10 @@ namespace time_t timediff = newtime - oldtime; if (timediff > ServerInstance->Config->TimeSkipWarn) - ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by %lu seconds!", timediff); + ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by {} seconds!", timediff); else if (timediff < -ServerInstance->Config->TimeSkipWarn) - ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by %lu seconds!", labs(timediff)); + ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by {} seconds!", labs(timediff)); } // Drops to the unprivileged user/group specified in <security:runas{user,group}>. diff --git a/src/modules/m_account.cpp b/src/modules/m_account.cpp index a9850ba51..12e6eae8a 100644 --- a/src/modules/m_account.cpp +++ b/src/modules/m_account.cpp @@ -318,8 +318,8 @@ public: if (!automatic) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because they are not logged into the correct user account.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), oper->GetName().c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not logged into the correct user account.", + user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); } return MOD_RES_DENY; // Account required but it does not match. } @@ -340,8 +340,8 @@ public: if (error) { - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into %s.", - klass->GetName().c_str(), error); + ServerInstance->Logs.Debug("CONNECTCLASS", "The {} connect class is not suitable as it requires the user to be logged into {}.", + klass->GetName(), error); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index f3cbfd37a..016ede478 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -124,7 +124,7 @@ public: { // Block it... if (action == IBLOCK_KILLOPERS || action == IBLOCK_NOTICEOPERS) - ServerInstance->SNO.WriteToSnoMask('a', "%s had an /amsg or /ame blocked", user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "{} had an /amsg or /ame blocked", user->nick); if (action == IBLOCK_KILL || action == IBLOCK_KILLOPERS) ServerInstance->Users.QuitUser(user, "Attempted to global message (/amsg or /ame)"); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 74f884760..cba873525 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -114,7 +114,7 @@ public: if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed CBan on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed CBan on {}: {}", user->nick, parameters[0], reason); } else { @@ -138,13 +138,13 @@ public: { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent CBan on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent CBan on {}: {}", user->nick, parameters[0], reason); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed CBan on %s, expires in %s (on %s): %s", - user->nick.c_str(), parameters[0].c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), reason); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed CBan on {}, expires in {} (on {}): {}", + user->nick, parameters[0], Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), reason); } } else @@ -203,8 +203,8 @@ public: { // Channel is banned. user->WriteNumeric(ERR_BADCHANNEL, cname, INSP_FORMAT("Channel {} is CBANed: {}", cname, rl->reason)); - ServerInstance->SNO.WriteGlobalSno('a', "%s tried to join %s which is CBANed (%s)", - user->nick.c_str(), cname.c_str(), rl->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} tried to join {} which is CBANed ({})", + user->nick, cname, rl->reason); return MOD_RES_DENY; } diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index cccc6c0f0..f2cf6e2db 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -42,7 +42,7 @@ public: { if ((created) && (IS_LOCAL(memb->user))) { - ServerInstance->SNO.WriteGlobalSno('j', "Channel %s created by %s", memb->chan->name.c_str(), memb->user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('j', "Channel {} created by {}", memb->chan->name, memb->user->GetFullRealHost()); } } }; diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index dd1b8bcaf..52d409027 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -66,7 +66,7 @@ public: dest->ChangeIdent(parameters[1]); if (!user->server->IsService()) - ServerInstance->SNO.WriteGlobalSno('a', "%s used CHGIDENT to change %s's ident to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used CHGIDENT to change {}'s ident to '{}'", user->nick, dest->nick, dest->ident); } return CmdResult::SUCCESS; diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 0c45b5202..eb8248539 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -62,7 +62,7 @@ public: if (IS_LOCAL(dest)) { dest->ChangeRealName(parameters[1]); - ServerInstance->SNO.WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s\x0F'", user->nick.c_str(), dest->nick.c_str(), dest->GetRealName().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used CHGNAME to change {}'s real name to '{}\x0F'", user->nick, dest->nick, dest->GetRealName()); } return CmdResult::SUCCESS; diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp index 2949601c4..cc7bef81f 100644 --- a/src/modules/m_cloak.cpp +++ b/src/modules/m_cloak.cpp @@ -355,8 +355,8 @@ class ModuleCloakSHA256 final if (methods) { - ServerInstance->SNO.WriteGlobalSno('a', "The %s hash provider was unloaded; removing %zu cloak methods until the next rehash.", - service.name.substr(6).c_str(), methods); + ServerInstance->SNO.WriteGlobalSno('a', "The {} hash provider was unloaded; removing {} cloak methods until the next rehash.", + service.name.substr(6), methods); } } diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 1ca6e2b1a..9575b3383 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -154,10 +154,10 @@ public: return; } std::string maskstr = mask.str(); - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed Z-line on %s, expires in %s (on %s): %s", - zl->source.c_str(), maskstr.c_str(), Duration::ToString(zl->duration).c_str(), - InspIRCd::TimeString(zl->expiry).c_str(), zl->reason.c_str()); - ServerInstance->SNO.WriteGlobalSno('a', "Connect flooding from IP range %s (%lu)", maskstr.c_str(), threshold); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", + zl->source, maskstr, Duration::ToString(zl->duration), + InspIRCd::TimeString(zl->expiry), zl->reason); + ServerInstance->SNO.WriteGlobalSno('a', "Connect flooding from IP range {} ({})", maskstr, threshold); connects.erase(i); ServerInstance->XLines->ApplyLines(); } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index f28c277c6..f30b1e44c 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -232,9 +232,9 @@ private: return; } - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed %s on %s, expires in %s (on %s): %s", - line->source.c_str(), type, line->Displayable().c_str(), Duration::ToString(line->duration).c_str(), - InspIRCd::TimeString(line->expiry).c_str(), line->reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed {} on {}, expires in {} (on {}): {}", + line->source, type, line->Displayable(), Duration::ToString(line->duration), + InspIRCd::TimeString(line->expiry), line->reason); ServerInstance->XLines->ApplyLines(); } @@ -268,8 +268,8 @@ public: if (!ans_record) { config->stats_errors++; - ServerInstance->SNO.WriteGlobalSno('d', "%s returned an result with no IPv4 address.", - config->name.c_str()); + ServerInstance->SNO.WriteGlobalSno('d', "{} returned an result with no IPv4 address.", + config->name); return; } @@ -278,8 +278,8 @@ public: if (inet_pton(AF_INET, ans_record->rdata.c_str(), &resultip) != 1) { config->stats_errors++; - ServerInstance->SNO.WriteGlobalSno('d', "%s returned an invalid IPv4 address: %s", - config->name.c_str(), ans_record->rdata.c_str()); + ServerInstance->SNO.WriteGlobalSno('d', "{} returned an invalid IPv4 address: {}", + config->name, ans_record->rdata); return; } @@ -287,8 +287,8 @@ public: if ((resultip.s_addr & 0xFF) != 127) { config->stats_errors++; - ServerInstance->SNO.WriteGlobalSno('d', "%s returned an IPv4 address which is outside of the 127.0.0.0/8 subnet: %s", - config->name.c_str(), ans_record->rdata.c_str()); + ServerInstance->SNO.WriteGlobalSno('d', "{} returned an IPv4 address which is outside of the 127.0.0.0/8 subnet: {}", + config->name, ans_record->rdata); return; } @@ -359,8 +359,8 @@ public: } } - ServerInstance->SNO.WriteGlobalSno('d', "Connecting user %s (%s) detected as being on the '%s' DNS blacklist with result %d", - them->GetFullRealHost().c_str(), them->GetIPString().c_str(), config->name.c_str(), result); + ServerInstance->SNO.WriteGlobalSno('d', "Connecting user {} ({}) detected as being on the '{}' DNS blacklist with result {}", + them->GetFullRealHost(), them->GetIPString(), config->name, result); } else config->stats_misses++; @@ -393,8 +393,8 @@ public: if (is_miss) return; - ServerInstance->SNO.WriteGlobalSno('d', "An error occurred whilst checking whether %s (%s) is on the '%s' DNS blacklist: %s", - them->GetFullRealHost().c_str(), them->GetIPString().c_str(), config->name.c_str(), data.dns->GetErrorStr(q->error).c_str()); + ServerInstance->SNO.WriteGlobalSno('d', "An error occurred whilst checking whether {} ({}) is on the '{}' DNS blacklist: {}", + them->GetFullRealHost(), them->GetIPString(), config->name, data.dns->GetErrorStr(q->error)); } }; @@ -478,7 +478,7 @@ public: else return; - ServerInstance->Logs.Debug(MODNAME, "Reversed IP %s -> %s", user->GetIPString().c_str(), reversedip.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Reversed IP {} -> {}", user->GetIPString(), reversedip); data.countext.Set(user, dnsbls.size()); @@ -514,8 +514,8 @@ public: MarkExtItem::List* match = data.markext.Get(user); if (!match) { - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires a DNSBL mark.", - klass->GetName().c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "The {} connect class is not suitable as it requires a DNSBL mark.", + klass->GetName()); return MOD_RES_DENY; } @@ -526,8 +526,8 @@ public: } const std::string marks = stdalgo::string::join(dnsbl); - ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the DNSBL marks (%s) do not match %s.", - klass->GetName().c_str(), marks.c_str(), dnsbl.c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "The {} connect class is not suitable as the DNSBL marks ({}) do not match {}.", + klass->GetName(), marks, dnsbl); return MOD_RES_DENY; } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 4248b83f9..2147657fb 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -255,8 +255,8 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters) if (static_cast<ModuleFilter*>(me)->DeleteFilter(parameters[0], reason)) { user->WriteNotice("*** Removed filter '" + parameters[0] + "': " + reason); - ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "%s removed filter '%s': %s", - user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "{} removed filter '{}': {}", + user->nick, parameters[0], reason); return CmdResult::SUCCESS; } else @@ -316,8 +316,7 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters) flags, parameters[reasonindex]); user->WriteNotice("*** Added filter " + message); - ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', - "%s added filter %s", user->nick.c_str(), message.c_str()); + ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F', "{} added filter {}", user->nick, message); return CmdResult::SUCCESS; } @@ -420,20 +419,20 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar if (is_selfmsg && warnonselfmsg) { - ServerInstance->SNO.WriteGlobalSno('f', "WARNING: %s's self message matched %s (%s)", - user->nick.c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "WARNING: {}'s self message matched {} ({})", + user->nick, f->freeform, f->reason); return MOD_RES_PASSTHRU; } else if (f->action == FA_WARN) { - ServerInstance->SNO.WriteGlobalSno('f', "WARNING: %s's message to %s matched %s (%s)", - user->nick.c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "WARNING: {}'s message to {} matched {} ({})", + user->nick, msgtarget.GetName(), f->freeform, f->reason); return MOD_RES_PASSTHRU; } else if (f->action == FA_BLOCK) { - ServerInstance->SNO.WriteGlobalSno('f', "%s had their message to %s filtered as it matched %s (%s)", - user->nick.c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} had their message to {} filtered as it matched {} ({})", + user->nick, msgtarget.GetName(), f->freeform, f->reason); if (notifyuser) { if (msgtarget.type == MessageTarget::TYPE_CHANNEL) @@ -458,17 +457,17 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar } else if (f->action == FA_KILL) { - ServerInstance->SNO.WriteGlobalSno('f', "%s was killed because their message to %s matched %s (%s)", - user->nick.c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} was killed because their message to {} matched {} ({})", + user->nick, msgtarget.GetName(), f->freeform, f->reason); ServerInstance->Users.QuitUser(user, "Filtered: " + f->reason); } else if (f->action == FA_SHUN && (ServerInstance->XLines->GetFactory("SHUN"))) { auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%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(), Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their message to {} matched {} ({})", + user->nick, sh->Displayable(), Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(sh, nullptr)) { ServerInstance->XLines->ApplyLines(); @@ -479,10 +478,10 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar else if (f->action == FA_GLINE) { auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%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(), Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their message to {} matched {} ({})", + user->nick, gl->Displayable(), Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(gl, nullptr)) { ServerInstance->XLines->ApplyLines(); @@ -493,10 +492,10 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar else if (f->action == FA_ZLINE) { auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%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(), Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their message to {} matched {} ({})", + user->nick, zl->Displayable(), Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(zl, nullptr)) { ServerInstance->XLines->ApplyLines(); @@ -570,11 +569,11 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& { /* Note: We G-line *@IP so that if their host doesn't resolve the G-line still applies. */ auto* gl = new GLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, "*", user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%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(), - Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - command.c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their {} message matched {} ({})", + user->nick, gl->Displayable(), + Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + command, f->freeform, f->reason); if (ServerInstance->XLines->AddLine(gl, nullptr)) { @@ -586,11 +585,11 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& if (f->action == FA_ZLINE) { auto* zl = new ZLine(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%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(), - Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - command.c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their {} message matched {} ({})", + user->nick, zl->Displayable(), + Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + command, f->freeform, f->reason); if (ServerInstance->XLines->AddLine(zl, nullptr)) { @@ -603,11 +602,11 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& { /* Note: We shun *!*@IP so that if their host doesnt resolve the shun still applies. */ auto* sh = new Shun(ServerInstance->Time(), f->duration, ServerInstance->Config->ServerName, f->reason, user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('f', "%s (%s) was shunned for %s (expires on %s) because their %s message matched %s (%s)", - user->nick.c_str(), sh->Displayable().c_str(), - Duration::ToString(f->duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(), - command.c_str(), f->freeform.c_str(), f->reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their {} message matched {} ({})", + user->nick, sh->Displayable(), + Duration::ToString(f->duration), + InspIRCd::TimeString(ServerInstance->Time() + f->duration), + command, f->freeform, f->reason); if (ServerInstance->XLines->AddLine(sh, nullptr)) { @@ -656,7 +655,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status) if (newrxengine.empty()) ServerInstance->SNO.WriteGlobalSno('f', "WARNING: No regex engine loaded - Filter functionality disabled until this is corrected."); else - ServerInstance->SNO.WriteGlobalSno('f', "WARNING: Regex engine '%s' is not loaded - Filter functionality disabled until this is corrected.", newrxengine.c_str()); + ServerInstance->SNO.WriteGlobalSno('f', "WARNING: Regex engine '{}' is not loaded - Filter functionality disabled until this is corrected.", newrxengine); initing = false; FreeFilters(); @@ -948,8 +947,8 @@ bool ModuleFilter::Tick() std::ofstream stream(newfilterconf.c_str()); if (!stream.is_open()) // Filesystem probably not writable. { - ServerInstance->SNO.WriteToSnoMask('f', "Unable to save filters to \"%s\": %s (%d)", - newfilterconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('f', "Unable to save filters to \"{}\": {} ({})", + newfilterconf, strerror(errno), errno); return true; } @@ -976,8 +975,8 @@ bool ModuleFilter::Tick() if (stream.fail()) // Filesystem probably not writable. { - ServerInstance->SNO.WriteToSnoMask('f', "Unable to save filters to \"%s\": %s (%d)", - newfilterconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('f', "Unable to save filters to \"{}\": {} ({})", + newfilterconf, strerror(errno), errno); return true; } stream.close(); @@ -989,8 +988,8 @@ bool ModuleFilter::Tick() // Use rename to move temporary to new db - this is guaranteed not to fuck up, even in case of a crash. if (rename(newfilterconf.c_str(), filterconf.c_str()) < 0) { - ServerInstance->SNO.WriteToSnoMask('f', "Unable to replace old filter config \"%s\" with \"%s\": %s (%d)", - filterconf.c_str(), newfilterconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('f', "Unable to replace old filter config \"{}\" with \"{}\": {} ({})", + filterconf, newfilterconf, strerror(errno), errno); return true; } diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index bb6b23abe..7a6faa8a1 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -264,8 +264,8 @@ public: irc::sockets::sockaddrs ipaddr(false); if (!ipaddr.from_ip_port(parameters[3], user->client_sa.port())) { - ServerInstance->SNO.WriteGlobalSno('w', "Connecting user %s (%s) tried to use WEBIRC but gave an invalid IP address.", - user->uuid.c_str(), user->GetIPString().c_str()); + ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} ({}) tried to use WEBIRC but gave an invalid IP address.", + user->uuid, user->GetIPString()); ServerInstance->Users.QuitUser(user, "WEBIRC: IP address is invalid: " + parameters[3]); return CmdResult::FAILURE; } @@ -275,9 +275,8 @@ public: realhost.Set(user, user->GetRealHost()); realip.Set(user, user->GetIPString()); - ServerInstance->SNO.WriteGlobalSno('w', "Connecting user %s is using the %s WebIRC gateway; changing their IP from %s to %s.", - user->uuid.c_str(), parameters[1].c_str(), - user->GetIPString().c_str(), parameters[3].c_str()); + ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} is using the {} WebIRC gateway; changing their IP from {} to {}.", + user->uuid, parameters[1], user->GetIPString(), parameters[3]); // If we have custom flags then deal with them. WebIRC::FlagMap flags; @@ -320,8 +319,8 @@ public: return CmdResult::SUCCESS; } - ServerInstance->SNO.WriteGlobalSno('w', "Connecting user %s (%s) tried to use WEBIRC but didn't match any configured WebIRC hosts.", - user->uuid.c_str(), user->GetIPString().c_str()); + ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} ({}) tried to use WEBIRC but didn't match any configured WebIRC hosts.", + user->uuid, user->GetIPString()); ServerInstance->Users.QuitUser(user, "WEBIRC: you don't match any configured WebIRC hosts."); return CmdResult::FAILURE; } @@ -459,8 +458,8 @@ public: cmdwebirc.realip.Set(user, user->GetIPString()); const std::string& newident = host.GetIdent(); - ServerInstance->SNO.WriteGlobalSno('w', "Connecting user %s is using an ident gateway; changing their IP from %s to %s and their ident from %s to %s.", - user->uuid.c_str(), user->GetIPString().c_str(), address.addr().c_str(), user->ident.c_str(), newident.c_str()); + ServerInstance->SNO.WriteGlobalSno('w', "Connecting user {} is using an ident gateway; changing their IP from {} to {} and their ident from {} to {}.", + user->uuid, user->GetIPString(), address.addr(), user->ident, newident); user->ChangeIdent(newident); user->ChangeRemoteAddress(address); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 0148792cd..0bf3ce56a 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -45,7 +45,7 @@ public: { 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()); + ServerInstance->SNO.WriteToSnoMask('a', "NEW MODULE '{}' GLOBALLY LOADED BY '{}'", parameters[0], user->nick); user->WriteRemoteNumeric(RPL_LOADEDMODULE, parameters[0], "Module successfully loaded."); } else @@ -54,7 +54,7 @@ public: } } else - ServerInstance->SNO.WriteToSnoMask('a', "MODULE '%s' GLOBAL LOAD BY '%s' (not loaded here)", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "MODULE '{}' GLOBAL LOAD BY '{}' (not loaded here)", parameters[0], user->nick); return CmdResult::SUCCESS; } @@ -93,7 +93,7 @@ public: { if (ServerInstance->Modules.Unload(m)) { - ServerInstance->SNO.WriteToSnoMask('a', "MODULE '%s' GLOBALLY UNLOADED BY '%s'", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "MODULE '{}' GLOBALLY UNLOADED BY '{}'", parameters[0], user->nick); user->WriteRemoteNumeric(RPL_UNLOADEDMODULE, parameters[0], "Module successfully unloaded."); } else @@ -105,7 +105,7 @@ public: user->WriteRemoteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "No such module"); } else - ServerInstance->SNO.WriteToSnoMask('a', "MODULE '%s' GLOBAL UNLOAD BY '%s' (not unloaded here)", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "MODULE '{}' GLOBAL UNLOAD BY '{}' (not unloaded here)", parameters[0], user->nick); return CmdResult::SUCCESS; } @@ -136,7 +136,7 @@ public: Module* m = ServerInstance->Modules.Find(parameters[0]); if (m) { - ServerInstance->SNO.WriteToSnoMask('a', "MODULE '%s' GLOBALLY RELOADED BY '%s'", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "MODULE '{}' GLOBALLY RELOADED BY '{}'", parameters[0], user->nick); ServerInstance->Parser.CallHandler("RELOADMODULE", parameters, user); } else @@ -146,7 +146,7 @@ public: } } else - ServerInstance->SNO.WriteToSnoMask('a', "MODULE '%s' GLOBAL RELOAD BY '%s' (not reloaded here)", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "MODULE '{}' GLOBAL RELOAD BY '{}' (not reloaded here)", parameters[0], user->nick); return CmdResult::SUCCESS; } diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index 792925c89..073802354 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -124,7 +124,7 @@ public: if (!checkingAttributes && requiredattributes.empty()) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from %s (dn=%s)", user->GetFullRealHost().c_str(), DN.c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetFullRealHost(), DN); // We're done, there are no attributes to check SetVHost(user, DN); @@ -143,7 +143,7 @@ public: passed = true; if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from %s (dn=%s)", user->GetFullRealHost().c_str(), DN.c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Successful connection from {} (dn={})", user->GetFullRealHost(), DN); SetVHost(user, DN); authed->Set(user); @@ -171,7 +171,7 @@ public: catch (const LDAPException& ex) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Unable to compare attributes %s=%s: %s", attr.c_str(), val.c_str(), ex.GetReason().c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Unable to compare attributes {}={}: {}", attr, val, ex.GetReason()); } } @@ -179,7 +179,10 @@ public: if (!attrCount) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from %s (dn=%s) (unable to validate attributes)", user->GetFullRealHost().c_str(), DN.c_str()); + { + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (dn={}) (unable to validate attributes)", + user->GetFullRealHost(), DN); + } ServerInstance->Users.QuitUser(user, killreason); delete this; } @@ -200,7 +203,10 @@ public: if (user) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from %s (%s)", user->GetFullRealHost().c_str(), err.getError().c_str()); + { + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} ({})", + user->GetFullRealHost(), err.getError()); + } ServerInstance->Users.QuitUser(user, killreason); } @@ -256,7 +262,7 @@ public: void OnError(const LDAPResult& err) override { - ServerInstance->SNO.WriteToSnoMask('a', "Error searching LDAP server: %s", err.getError().c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "Error searching LDAP server: {}", err.getError()); auto* user = ServerInstance->Users.FindUUID(uid); if (user) ServerInstance->Users.QuitUser(user, killreason); @@ -404,7 +410,7 @@ public: if (user->password.empty()) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from %s (no password provided)", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (no password provided)", user->GetFullRealHost()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_DENY; } @@ -412,7 +418,7 @@ public: if (!LDAP) { if (verbose) - ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from %s (unable to find LDAP provider)", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Forbidden connection from {} (unable to find LDAP provider)", user->GetFullRealHost()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_DENY; } diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp index 8b60bba00..342fbc3f3 100644 --- a/src/modules/m_ldapoper.cpp +++ b/src/modules/m_ldapoper.cpp @@ -69,7 +69,7 @@ public: void OnError(const LDAPResult& err) override { - ServerInstance->SNO.WriteToSnoMask('a', "Error searching LDAP server: %s", err.getError().c_str()); + ServerInstance->SNO.WriteToSnoMask('a', "Error searching LDAP server: {}", err.getError()); Fallback(); delete this; } diff --git a/src/modules/m_log_sql.cpp b/src/modules/m_log_sql.cpp index 9870d18de..249a45b43 100644 --- a/src/modules/m_log_sql.cpp +++ b/src/modules/m_log_sql.cpp @@ -41,7 +41,7 @@ public: void OnError(const SQL::Error& error) override { - ServerInstance->SNO.WriteGlobalSno('a', "Unable to write to SQL log (query error: %s).", error.ToString()); + ServerInstance->SNO.WriteGlobalSno('a', "Unable to write to SQL log (query error: {}).", error.ToString()); } }; @@ -68,7 +68,7 @@ public: if (ServerInstance->Time() - lastwarning > 300) { lastwarning = ServerInstance->Time(); - ServerInstance->SNO.WriteGlobalSno('a', "Unable to write to SQL log (database %s not available).", sql->GetId().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Unable to write to SQL log (database {} not available).", sql->GetId()); } return; } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index aa9efdd20..86ccddce0 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -47,8 +47,8 @@ public: { if (IS_LOCAL(source)) { - ServerInstance->SNO.WriteGlobalSno('a', "Oper %s (level %lu) attempted to /KILL a higher level oper: %s (level %lu), reason: %s", - source->nick.c_str(), source_level, dest->nick.c_str(), dest_level, reason.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Oper {} (level {}) attempted to /KILL a higher level oper: {} (level {}), reason: {}", + source->nick, source_level, dest->nick, dest_level, reason); } dest->WriteNotice("*** Oper " + source->nick + " attempted to /KILL you!"); source->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Oper {} is a higher level than you", dest->nick)); diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index c9beae1f1..bd0cf63ce 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -78,7 +78,7 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes) if (!stream.is_open()) { ServerInstance->Logs.Error(MODNAME, "Cannot create database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('a', "database: cannot create new permchan db \"%s\": %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('a', "database: cannot create new permchan db \"{}\": {} ({})", permchannelsnewconf, strerror(errno), errno); return false; } @@ -150,7 +150,7 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes) if (stream.fail()) { ServerInstance->Logs.Error(MODNAME, "Cannot write to new database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('a', "database: cannot write to new permchan db \"%s\": %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('a', "database: cannot write to new permchan db \"{}\": {} ({})", permchannelsnewconf, strerror(errno), errno); return false; } stream.close(); @@ -162,7 +162,7 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes) if (rename(permchannelsnewconf.c_str(), permchannelsconf.c_str()) < 0) { ServerInstance->Logs.Error(MODNAME, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", permchannelsconf.c_str(), permchannelsnewconf.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('a', "database: cannot replace old permchan db \"%s\" with new db \"%s\": %s (%d)", permchannelsconf.c_str(), permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('a', "database: cannot replace old permchan db \"{}\" with new db \"{}\": {} ({})", permchannelsconf, permchannelsnewconf, strerror(errno), errno); return false; } diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 87aaea2dd..0c694208f 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -73,14 +73,14 @@ public: { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent Z-line on %s: %s", - zl->source.c_str(), u->GetIPString().c_str(), zl->reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Z-line on {}: {}", + zl->source, u->GetIPString(), zl->reason); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed Z-line on %s, expires in %s (on %s): %s", - zl->source.c_str(), u->GetIPString().c_str(), Duration::ToString(zl->duration).c_str(), - InspIRCd::TimeString(zl->duration).c_str(), zl->reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", + zl->source, u->GetIPString(), Duration::ToString(zl->duration), + InspIRCd::TimeString(zl->duration), zl->reason); } added_zline = true; } @@ -176,13 +176,13 @@ public: { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent R-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent R-line on {}: {}", user->nick, parameters[0], parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed R-line on %s, expires in %s (on %s): %s", - user->nick.c_str(), parameters[0].c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed R-line on {}, expires in {} (on {}): {}", + user->nick, parameters[0], Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } ServerInstance->XLines->ApplyLines(); @@ -200,7 +200,7 @@ public: if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed R-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed R-line on {}: {}", user->nick, parameters[0], reason); } else { @@ -283,7 +283,7 @@ public: if (newrxengine.empty()) ServerInstance->SNO.WriteToSnoMask('r', "WARNING: No regex engine loaded - R-line functionality disabled until this is corrected."); else - ServerInstance->SNO.WriteToSnoMask('r', "WARNING: Regex engine '%s' is not loaded - R-line functionality disabled until this is corrected.", newrxengine.c_str()); + ServerInstance->SNO.WriteToSnoMask('r', "WARNING: Regex engine '{}' is not loaded - R-line functionality disabled until this is corrected.", newrxengine.c_str()); ServerInstance->XLines->DelAll(f.GetType()); } diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp index 11c7a4685..241daa5fa 100644 --- a/src/modules/m_seenicks.cpp +++ b/src/modules/m_seenicks.cpp @@ -39,7 +39,7 @@ public: void OnUserPostNick(User* user, const std::string& oldnick) override { - ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N', "User %s changed their nickname to %s", oldnick.c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N', "User {} changed their nickname to {}", oldnick, user->nick); } }; diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index a7e4e669e..f6f743a22 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -52,7 +52,7 @@ public: } user->ChangeIdent(parameters[0]); - ServerInstance->SNO.WriteGlobalSno('a', "%s used SETIDENT to change their ident to '%s'", user->nick.c_str(), user->ident.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used SETIDENT to change their ident to '{}'", user->nick, user->ident); return CmdResult::SUCCESS; } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 9b6fe501e..0d50b3882 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -62,8 +62,8 @@ public: } if (notifyopers) - ServerInstance->SNO.WriteGlobalSno('a', "%s used SETNAME to change their real name to '%s'", - user->nick.c_str(), parameters[0].c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used SETNAME to change their real name to '{}'", + user->nick, parameters[0]); return CmdResult::SUCCESS; } }; diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index d36e06c22..20bafbadb 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -85,11 +85,11 @@ public: if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed SHUN on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed SHUN on {}: {}", user->nick, parameters[0], reason); } else if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", reason, user)) { - ServerInstance->SNO.WriteToSnoMask('x', "%s removed SHUN on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed SHUN on {}: {}", user->nick, target, reason); } else { @@ -122,14 +122,14 @@ public: { if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added permanent SHUN for %s: %s", - user->nick.c_str(), target.c_str(), expr.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added permanent SHUN for {}: {}", + user->nick, target, expr); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed SHUN on %s, expires in %s (on %s): %s", - user->nick.c_str(), target.c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), expr.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed SHUN on {}, expires in {} (on {}): {}", + user->nick, target, Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), expr); } } else diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 92598fb69..0e8e8ab2d 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -39,7 +39,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) if (!xlf) { - ServerInstance->SNO.WriteToSnoMask('x', "%s sent me an unknown ADDLINE type (%s).", setter.c_str(), params[0].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} sent me an unknown ADDLINE type ({}).", setter, params[0]); return CmdResult::FAILURE; } @@ -50,7 +50,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) } catch (const ModuleException& e) { - ServerInstance->SNO.WriteToSnoMask('x', "Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason().c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "Unable to ADDLINE type {} from {}: {}", params[0], setter, e.GetReason()); return CmdResult::FAILURE; } xl->SetCreateTime(ServerCommand::ExtractTS(params[3])); @@ -58,16 +58,16 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) { if (xl->duration) { - ServerInstance->SNO.WriteToSnoMask('X', "%s added a timed %s%s on %s, expires in %s (on %s): %s", - setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "", - params[1].c_str(), Duration::ToString(xl->duration).c_str(), - InspIRCd::TimeString(xl->expiry).c_str(), params[5].c_str()); + ServerInstance->SNO.WriteToSnoMask('X', "{} added a timed {}{} on {}, expires in {} (on {}): {}", + setter, params[0], params[0].length() == 1 ? "-line" : "", + params[1], Duration::ToString(xl->duration), + InspIRCd::TimeString(xl->expiry), params[5]); } else { - ServerInstance->SNO.WriteToSnoMask('X', "%s added a permanent %s%s on %s: %s", - setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "", - params[1].c_str(), params[5].c_str()); + ServerInstance->SNO.WriteToSnoMask('X', "{} added a permanent {}{} on {}: {}", + setter, params[0], params[0].length() == 1 ? "-line" : "", + params[1], params[5]); } TreeServer* remoteserver = TreeServer::Get(usr); diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 5ae7f5ff0..a59a73a3b 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -528,9 +528,9 @@ bool TreeSocket::Capab(const CommandBase::Params& params) if (Utils->AllowOptCommon) { ServerInstance->SNO.WriteToSnoMask('l', - "ExtBan lists do not match, some bans/exemptions may not work globally.%s%s%s%s", - missing_here.length() ? " Not loaded here:" : "", missing_here.c_str(), - missing_there.length() ? " Not loaded there:" : "", missing_there.c_str()); + "ExtBan lists do not match, some bans/exemptions may not work globally.{}{}{}{}", + missing_here.length() ? " Not loaded here:" : "", missing_here, + missing_there.length() ? " Not loaded there:" : "", missing_there); } else { diff --git a/src/modules/m_spanningtree/delline.cpp b/src/modules/m_spanningtree/delline.cpp index 5de195ed8..d1ec8ac7f 100644 --- a/src/modules/m_spanningtree/delline.cpp +++ b/src/modules/m_spanningtree/delline.cpp @@ -36,8 +36,8 @@ CmdResult CommandDelLine::Handle(User* user, Params& params) // XLineManager::DelLine() returns true if the xline existed, false if it didn't if (ServerInstance->XLines->DelLine(params[1].c_str(), params[0], reason, user)) { - ServerInstance->SNO.WriteToSnoMask('X', "%s removed %s%s on %s: %s", setter.c_str(), - params[0].c_str(), params[0].length() == 1 ? "-line" : "", params[1].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('X', "{} removed {}{} on {}: {}", setter, + params[0], params[0].length() == 1 ? "-line" : "", params[1], reason); return CmdResult::SUCCESS; } return CmdResult::FAILURE; diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 2539a4f05..ce4e02e5c 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -79,8 +79,8 @@ bool TreeSocket::ComparePass(const Link& link, const std::string& theirs) /* Require fingerprint to exist and match */ if (link.Fingerprint != fp) { - ServerInstance->SNO.WriteToSnoMask('l', "Invalid TLS certificate fingerprint on link %s: need \"%s\" got \"%s\"", - link.Name.c_str(), link.Fingerprint.c_str(), fp.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "Invalid TLS certificate fingerprint on link {}: need \"{}\" got \"{}\"", + link.Name, link.Fingerprint, fp); SendError("Invalid TLS certificate fingerprint " + fp + " - expected " + link.Fingerprint); return false; } @@ -105,8 +105,8 @@ bool TreeSocket::ComparePass(const Link& link, const std::string& theirs) // this time if ((!capab->auth_fingerprint) && (!fp.empty())) { - ServerInstance->SNO.WriteToSnoMask('l', "TLS certificate fingerprint for link %s is \"%s\". " - "You can improve security by specifying this in <link:fingerprint>.", link.Name.c_str(), fp.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "TLS certificate fingerprint for link {} is \"{}\". " + "You can improve security by specifying this in <link:fingerprint>.", link.Name, fp); } return true; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 833e633df..76aed1476 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -201,7 +201,7 @@ void ModuleSpanningTree::ConnectServer(const std::shared_ptr<Autoconnect>& a, bo std::shared_ptr<Link> x = Utils->FindLink(a->servers[a->position]); if (x) { - ServerInstance->SNO.WriteToSnoMask('l', "AUTOCONNECT: Auto-connecting server \002%s\002", x->Name.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "AUTOCONNECT: Auto-connecting server \002{}\002", x->Name); ConnectServer(x, a); return; } @@ -227,8 +227,8 @@ void ModuleSpanningTree::ConnectServer(const std::shared_ptr<Link>& x, const std { // We don't use the family() != AF_UNSPEC check below for UNIX sockets as // that results in a DNS lookup. - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s is not a UNIX socket!", - x->Name.c_str(), x->IPAddr.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: {} is not a UNIX socket!", + x->Name, x->IPAddr); return; } } @@ -245,14 +245,14 @@ void ModuleSpanningTree::ConnectServer(const std::shared_ptr<Link>& x, const std auto* newsocket = new TreeSocket(x, y, sa); if (!newsocket->HasFd()) { - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.", - x->Name.c_str(), newsocket->GetError().c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: {}.", + x->Name, newsocket->GetError()); ServerInstance->GlobalCulls.AddItem(newsocket); } } else if (!DNS) { - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: Hostname given and core_dns is not loaded, unable to resolve.", x->Name.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: Hostname given and core_dns is not loaded, unable to resolve.", x->Name); } else { @@ -273,7 +273,7 @@ void ModuleSpanningTree::ConnectServer(const std::shared_ptr<Link>& x, const std catch (const DNS::Exception& e) { delete snr; - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.", x->Name.c_str(), e.GetReason().c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: {}.", x->Name, e.GetReason()); ConnectServer(y, false); } } @@ -307,7 +307,7 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime) } else if (curtime > s->age + (time_t)p.second) { - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002 (timeout of %u seconds)", p.first.c_str(), p.second); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002 (timeout of {} seconds)", p.first, p.second); Utils->timeoutlist.erase(me); s->Close(); } @@ -610,8 +610,8 @@ void ModuleSpanningTree::OnUserQuit(User* user, const std::string& reason, const bool hide = (((server->IsDead()) && (Utils->quiet_bursts)) || (server->IsSilentService())); if (!hide) { - ServerInstance->SNO.WriteToSnoMask('Q', "Client exiting on server %s: %s (%s) [%s]", - user->server->GetName().c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_message.c_str()); + ServerInstance->SNO.WriteToSnoMask('Q', "Client exiting on server {}: {} ({}) [{}]", user->server->GetName(), + user->GetFullRealHost(), user->GetIPString(), oper_message); } } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 9e9d66bb7..3f4d2defe 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -101,8 +101,8 @@ struct TreeSocket::BurstState final */ void TreeSocket::DoBurst(TreeServer* s) { - ServerInstance->SNO.WriteToSnoMask('l', "Bursting to \002%s\002 (Authentication: %s%s).", - s->GetName().c_str(), + ServerInstance->SNO.WriteToSnoMask('l', "Bursting to \002{}\002 (Authentication: {}{}).", + s->GetName(), capab->auth_fingerprint ? "TLS certificate fingerprint and " : "", capab->auth_challenge ? "challenge-response" : "plaintext password"); this->CleanNegotiationInfo(); diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index 36fedb94d..74892d4b3 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -109,9 +109,8 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para u->oper->GetName().c_str()); } - ServerInstance->SNO.WriteToSnoMask('O', "From %s: %s (%s) [%s] is now a server operator of type \x02%s\x02%s.", - u->server->GetName().c_str(), u->nick.c_str(), u->MakeHost().c_str(), u->GetIPString().c_str(), - u->oper->GetType().c_str(), extra.c_str()); + ServerInstance->SNO.WriteToSnoMask('O', "From {}: {} ({}) [{}] is now a server operator of type \x02{}\x02{}.", + u->server->GetName(), u->nick, u->MakeHost(), u->GetIPString(), u->oper->GetType(), extra); return CmdResult::SUCCESS; } diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 82644d3c0..95bd2fea3 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -44,7 +44,7 @@ ModResult ModuleSpanningTree::HandleSquit(const CommandBase::Params& parameters, if (s->IsLocal()) { - ServerInstance->SNO.WriteToSnoMask('l', "SQUIT: Server \002%s\002 removed from network by %s", parameters[0].c_str(), user->nick.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "SQUIT: Server \002{}\002 removed from network by {}", parameters[0], user->nick); s->SQuit("Server quit by " + user->GetFullRealHost()); } else diff --git a/src/modules/m_spanningtree/pingtimer.cpp b/src/modules/m_spanningtree/pingtimer.cpp index d42295eb7..6e2d498d5 100644 --- a/src/modules/m_spanningtree/pingtimer.cpp +++ b/src/modules/m_spanningtree/pingtimer.cpp @@ -48,7 +48,7 @@ PingTimer::State PingTimer::TickInternal() else if (state == PS_WARN) { // No pong arrived in PingWarnTime seconds, send a warning to opers - ServerInstance->SNO.WriteToSnoMask('l', "Server \002%s\002 has not responded to PING for %lu seconds, high latency.", server->GetName().c_str(), GetInterval()); + ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {} seconds, high latency.", server->GetName(), GetInterval()); return PS_TIMEOUT; } else // PS_TIMEOUT diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp index d3fc09634..7d137eef9 100644 --- a/src/modules/m_spanningtree/pong.cpp +++ b/src/modules/m_spanningtree/pong.cpp @@ -31,7 +31,7 @@ CmdResult CommandPong::HandleServer(TreeServer* server, CommandBase::Params& par { if (server->IsBursting()) { - ServerInstance->SNO.WriteGlobalSno('l', "Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", server->GetName().c_str()); + ServerInstance->SNO.WriteGlobalSno('l', "Server \002{}\002 has not finished burst, forcing end of burst (send ENDBURST!)", server->GetName()); server->FinishBurst(); } diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp index e8e145f25..7991f8924 100644 --- a/src/modules/m_spanningtree/rconnect.cpp +++ b/src/modules/m_spanningtree/rconnect.cpp @@ -50,8 +50,8 @@ CmdResult CommandRConnect::Handle(User* user, const Params& parameters) if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) { /* Yes, initiate the given connect */ - ServerInstance->SNO.WriteToSnoMask('l', "Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002", - user->nick.c_str(), parameters[0].c_str(), parameters[1].c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "Remote CONNECT from {} matching \002{}\002, connecting server \002{}\002", + user->nick, parameters[0], parameters[1]); CommandBase::Params para; para.push_back(parameters[1]); ((ModuleSpanningTree*)(Module*)creator)->HandleConnect(para, user); diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index e6dd2a54a..8bf2ab0f6 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -69,8 +69,8 @@ void ServerNameResolver::OnLookupComplete(const DNS::Query* r) if (!newsocket->HasFd()) { /* Something barfed, show the opers */ - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: %s.", - link->Name.c_str(), newsocket->GetError().c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: {}.", + link->Name, newsocket->GetError()); ServerInstance->GlobalCulls.AddItem(newsocket); } } @@ -98,8 +98,8 @@ void ServerNameResolver::OnError(const DNS::Query* r) } } - ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002%s\002: Unable to resolve hostname - %s", - link->Name.c_str(), this->manager->GetErrorStr(r->error).c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002: Unable to resolve hostname - {}", + link->Name, this->manager->GetErrorStr(r->error)); Utils->Creator->ConnectServer(autoconnect, false); } diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index d938a6225..d57510bb0 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -58,7 +58,7 @@ CmdResult CommandRSQuit::Handle(User* user, const Params& parameters) { // We have been asked to remove server_target. const char* reason = parameters.size() == 2 ? parameters[1].c_str() : "No reason"; - ServerInstance->SNO.WriteToSnoMask('l', "RSQUIT: Server \002%s\002 removed from network by %s (%s)", parameters[0].c_str(), user->nick.c_str(), reason); + ServerInstance->SNO.WriteToSnoMask('l', "RSQUIT: Server \002{}\002 removed from network by {} ({})", parameters[0], user->nick, reason); server_target->SQuit("Server quit by " + user->GetFullRealHost() + " (" + reason + ")"); } diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 162fd92ee..ab5111622 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -124,7 +124,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) if (!ComparePass(*x, password)) { - ServerInstance->SNO.WriteToSnoMask('l', "Invalid password on link: %s", x->Name.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "Invalid password on link: {}", x->Name); continue; } @@ -136,7 +136,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params) { std::string ciphersuite; ssliohook->GetCiphersuite(ciphersuite); - ServerInstance->SNO.WriteToSnoMask('l', "Negotiated ciphersuite %s on link %s", ciphersuite.c_str(), x->Name.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "Negotiated ciphersuite {} on link {}", ciphersuite, x->Name); } else if (!capab->remotesa.is_local()) { diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index ed84ca70f..75e857ba6 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -153,8 +153,8 @@ void TreeServer::FinishBurst() ServerInstance->XLines->ApplyLines(); uint64_t ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); unsigned long bursttime = ts - this->StartBurst; - ServerInstance->SNO.WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \002%s\002 (burst time: %lu %s)", - GetName().c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs")); + ServerInstance->SNO.WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \002{}\002 (burst time: {} {})", + GetName(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs")); Utils->Creator->linkeventprov.Call(&ServerProtocol::LinkEventListener::OnServerBurst, this); StartBurst = 0; @@ -182,7 +182,7 @@ void TreeServer::SQuitChild(TreeServer* server, const std::string& reason, bool const std::string quitreason = GetName() + " " + server->GetName(); size_t num_lost_users = QuitUsers(quitreason); - ServerInstance->SNO.WriteToSnoMask(IsRoot() ? 'l' : 'L', "Netsplit complete, lost \002%zu\002 user%s on \002%u\002 server%s.", + ServerInstance->SNO.WriteToSnoMask(IsRoot() ? 'l' : 'L', "Netsplit complete, lost \002{}\002 user{} on \002{}\002 server{}.", num_lost_users, num_lost_users != 1 ? "s" : "", num_lost_servers, num_lost_servers != 1 ? "s" : ""); // No-op if the socket is already closed (i.e. it called us) diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 2da154642..68caaa722 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -136,16 +136,16 @@ void TreeSocket::OnConnected() static_cast<IOHookProvider*>(prov)->OnConnect(this); } - ServerInstance->SNO.WriteGlobalSno('l', "Connection to \002%s\002[%s] started.", linkID.c_str(), - (capab->link->HiddenFromStats ? "<hidden>" : capab->link->IPAddr.c_str())); + ServerInstance->SNO.WriteGlobalSno('l', "Connection to \002{}\002[{}] started.", linkID, + (capab->link->HiddenFromStats ? "<hidden>" : capab->link->IPAddr)); this->SendCapabilities(1); } } void TreeSocket::OnError(BufferedSocketError e) { - ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002%s\002' failed with error: %s", - linkID.c_str(), GetError().c_str()); + ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002{}\002' failed with error: {}", + linkID, GetError()); LinkState = DYING; Close(); } @@ -236,7 +236,7 @@ static std::string newline("\n"); void TreeSocket::WriteLineInternal(const std::string& line) { - ServerInstance->Logs.RawIO(MODNAME, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs.RawIO(MODNAME, "S[{}] O {}", GetFd(), line); this->WriteData(line); this->WriteData(newline); } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 4c4e71fbd..5290bf498 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -165,13 +165,13 @@ void TreeSocket::ProcessLine(std::string& line) time_t delta = them - ServerInstance->Time(); if ((delta < -15) || (delta > 15)) { - ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by %ld seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", labs((long)delta)); + ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", labs((long)delta)); SendError("Your clocks are out by "+ConvToStr(labs((long)delta))+" seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!"); return; } else if ((delta < -5) || (delta > 5)) { - ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by %ld seconds. Please consider syncing your clocks.", labs((long)delta)); + ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {} seconds. Please consider syncing your clocks.", labs((long)delta)); } } @@ -395,7 +395,7 @@ void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix, void TreeSocket::OnTimeout() { - ServerInstance->SNO.WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", linkID.c_str()); + ServerInstance->SNO.WriteGlobalSno('l', "CONNECT: Connection to \002{}\002 timed out.", linkID); } void TreeSocket::Close() @@ -413,13 +413,13 @@ void TreeSocket::Close() if (MyRoot && !MyRoot->IsDead()) MyRoot->SQuit(GetError(), true); else - ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002%s\002' failed.", linkID.c_str()); + ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002{}\002' failed.", linkID); time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) { std::string timestr = Duration::ToString(server_uptime); - ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002%s\002' was established for %s", linkID.c_str(), timestr.c_str()); + ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002{}\002' was established for {}", linkID, timestr); } } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index e5e534d8c..96dfa9fff 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -136,8 +136,8 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params if (dosend) { - ServerInstance->SNO.WriteToSnoMask('C', "Client connecting at %s: %s (%s) [%s\x0F]", remoteserver->GetName().c_str(), - _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->GetRealName().c_str()); + ServerInstance->SNO.WriteToSnoMask('C', "Client connecting at {}: {} ({}) [{}\x0F]", remoteserver->GetName(), + _new->GetFullRealHost(), _new->GetIPString(), _new->GetRealName()); } FOREACH_MOD(OnPostConnect, (_new)); diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 42a331ab6..3a0ec1cfc 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -51,7 +51,7 @@ ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from return MOD_RES_ALLOW; } } - ServerInstance->SNO.WriteToSnoMask('l', "Server connection from %s denied (no link blocks with that IP address)", incomingip.c_str()); + ServerInstance->SNO.WriteToSnoMask('l', "Server connection from {} denied (no link blocks with that IP address)", incomingip); return MOD_RES_DENY; } diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp index d18617d46..3692c0373 100644 --- a/src/modules/m_sqlauth.cpp +++ b/src/modules/m_sqlauth.cpp @@ -70,7 +70,7 @@ public: if (!hashprov) { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (a provider for %s was not loaded)", user->GetFullRealHost().c_str(), kdf.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (a provider for {} was not loaded)", user->GetFullRealHost(), kdf); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -79,7 +79,7 @@ public: if (!pwcolumn.empty() && !res.HasColumn(pwcolumn, colindex)) { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (the column specified (%s) was not returned)", user->GetFullRealHost().c_str(), pwcolumn.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (the column specified ({}) was not returned)", user->GetFullRealHost(), pwcolumn); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -95,7 +95,7 @@ public: } if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (password from the SQL query did not match the user provided password)", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (password from the SQL query did not match the user provided password)", user->GetFullRealHost()); pendingExt.Set(user, AUTH_STATE_FAIL); return; } @@ -105,7 +105,7 @@ public: else { if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (SQL query returned no matches)", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query returned no matches)", user->GetFullRealHost()); pendingExt.Set(user, AUTH_STATE_FAIL); } } @@ -117,7 +117,7 @@ public: return; pendingExt.Set(user, AUTH_STATE_FAIL); if (verbose) - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (SQL query failed: %s)", user->GetFullRealHost().c_str(), error.ToString()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL query failed: {})", user->GetFullRealHost(), error.ToString()); } }; @@ -181,7 +181,7 @@ public: if (!SQL) { - ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from %s (SQL database not present)", user->GetFullRealHost().c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "Forbidden connection from {} (SQL database not present)", user->GetFullRealHost()); ServerInstance->Users.QuitUser(user, killreason); return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index 526a9bd11..013e8d88e 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -88,7 +88,7 @@ public: if (tblk == ServerInstance->Config->OperTypes.end()) { ServerInstance->Logs.Warning(MODNAME, "Sqloper block " + name + " has missing type " + type); - ServerInstance->SNO.WriteGlobalSno('a', "m_sqloper: Oper block %s has missing type %s", name.c_str(), type.c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "m_sqloper: Oper block {} has missing type {}", name, type); continue; } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 4b9817c23..7b60dedfe 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -341,8 +341,8 @@ public: { if (!automatic) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because they are not connected using TLS.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), oper->GetName().c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not connected using TLS.", + user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); } return MOD_RES_DENY; } @@ -352,8 +352,8 @@ public: { if (!automatic) { - ServerInstance->SNO.WriteGlobalSno('o', "%s (%s) [%s] failed to log into the \x02%s\x02 oper account because they are not using the correct TLS client certificate.", - user->nick.c_str(), user->MakeHost().c_str(), user->GetIPString().c_str(), oper->GetName().c_str()); + ServerInstance->SNO.WriteGlobalSno('o', "{} ({}) [{}] failed to log into the \x02{}\x02 oper account because they are not using the correct TLS client certificate.", + user->nick, user->MakeHost(), user->GetIPString(), oper->GetName()); } return MOD_RES_DENY; } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 291ded353..aa85bb0ff 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -123,7 +123,7 @@ public: if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SVSHOLD", reason, user)) { if (!silent) - ServerInstance->SNO.WriteToSnoMask('x', "%s removed SVSHOLD on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} removed SVSHOLD on {}: {}", user->nick, parameters[0], reason); } else { @@ -150,13 +150,13 @@ public: if (!duration) { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a permanent SVSHOLD on %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent SVSHOLD on {}: {}", user->nick, parameters[0], parameters[2]); } else { - ServerInstance->SNO.WriteToSnoMask('x', "%s added a timed SVSHOLD on %s, expires in %s (on %s): %s", - user->nick.c_str(), parameters[0].c_str(), Duration::ToString(duration).c_str(), - InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed SVSHOLD on {}, expires in {} (on {}): {}", + user->nick, parameters[0], Duration::ToString(duration), + InspIRCd::TimeString(ServerInstance->Time() + duration), parameters[2]); } } else diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 1b54ace49..52524ea7d 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -62,12 +62,12 @@ public: // We already had it set... if (!user->server->IsService()) // Ulines set SWHOISes silently - ServerInstance->SNO.WriteGlobalSno('a', "%s used SWHOIS to set %s's extra whois from '%s' to '%s'", user->nick.c_str(), dest->nick.c_str(), text->c_str(), parameters[1].c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used SWHOIS to set {}'s extra whois from '{}' to '{}'", user->nick, dest->nick, *text, parameters[1]); } else if (!user->server->IsService()) { // Ulines set SWHOISes silently - ServerInstance->SNO.WriteGlobalSno('a', "%s used SWHOIS to set %s's extra whois to '%s'", user->nick.c_str(), dest->nick.c_str(), parameters[1].c_str()); + ServerInstance->SNO.WriteGlobalSno('a', "{} used SWHOIS to set {}'s extra whois to '{}'", user->nick, dest->nick, parameters[1]); } operblock.Unset(user); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index ecdc0293e..4b5d0f723 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -110,7 +110,7 @@ public: if (!stream.is_open()) { ServerInstance->Logs.Error(MODNAME, "Cannot create database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('x', "database: cannot create new xline db \"%s\": %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('x', "database: cannot create new xline db \"{}\": {} ({})", xlinenewdbpath, strerror(errno), errno); return false; } @@ -148,7 +148,7 @@ public: if (stream.fail()) { ServerInstance->Logs.Error(MODNAME, "Cannot write to new database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('x', "database: cannot write to new xline db \"%s\": %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('x', "database: cannot write to new xline db \"{}\": {} ({})", xlinenewdbpath, strerror(errno), errno); return false; } stream.close(); @@ -160,7 +160,7 @@ public: if (rename(xlinenewdbpath.c_str(), xlinedbpath.c_str()) < 0) { ServerInstance->Logs.Error(MODNAME, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", xlinedbpath.c_str(), xlinenewdbpath.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('x', "database: cannot replace old xline db \"%s\" with new db \"%s\": %s (%d)", xlinedbpath.c_str(), xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('x', "database: cannot replace old xline db \"{}\" with new db \"{}\": {} ({})", xlinedbpath, xlinenewdbpath, strerror(errno), errno); return false; } @@ -178,7 +178,7 @@ public: if (!stream.is_open()) { ServerInstance->Logs.Error(MODNAME, "Cannot read database \"%s\"! %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); - ServerInstance->SNO.WriteToSnoMask('x', "database: cannot read xline db \"%s\": %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); + ServerInstance->SNO.WriteToSnoMask('x', "database: cannot read xline db \"{}\": {} ({})", xlinedbpath, strerror(errno), errno); return false; } @@ -205,7 +205,7 @@ public: { stream.close(); ServerInstance->Logs.Error(MODNAME, "I got database version %s - I don't understand it", command_p[1].c_str()); - ServerInstance->SNO.WriteToSnoMask('x', "database: I got a database version (%s) I don't understand", command_p[1].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "database: I got a database version ({}) I don't understand", command_p[1]); return false; } } @@ -216,7 +216,7 @@ public: if (!xlf) { - ServerInstance->SNO.WriteToSnoMask('x', "database: Unknown line type (%s).", command_p[1].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "database: Unknown line type ({}).", command_p[1]); continue; } @@ -225,7 +225,7 @@ public: if (ServerInstance->XLines->AddLine(xl, nullptr)) { - ServerInstance->SNO.WriteToSnoMask('x', "database: Added a line of type %s", command_p[1].c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "database: Added a line of type {}", command_p[1]); } else delete xl; diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 2977d20e7..43dc163fb 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -181,7 +181,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, const irc::sockets::soc if (this->local_users.size() > ServerInstance->Config->SoftLimit) { - ServerInstance->SNO.WriteToSnoMask('a', "Warning: softlimit value has been reached: %lu clients", ServerInstance->Config->SoftLimit); + ServerInstance->SNO.WriteToSnoMask('a', "Warning: softlimit value has been reached: {} clients", ServerInstance->Config->SoftLimit); this->QuitUser(New, "No more connections allowed"); return; } @@ -301,8 +301,8 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std if (lu->IsFullyConnected()) { - ServerInstance->SNO.WriteToSnoMask('q', "Client exiting: %s (%s) [%s]", user->GetFullRealHost().c_str(), - user->GetIPString().c_str(), operquitmsg.c_str()); + ServerInstance->SNO.WriteToSnoMask('q', "Client exiting: {} ({}) [{}]", user->GetFullRealHost(), + user->GetIPString(), operquitmsg); } local_users.erase(lu); if (lu->GetClass()) diff --git a/src/users.cpp b/src/users.cpp index 7ea98a2fd..7a92403ef 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -168,8 +168,8 @@ void UserIOHandler::OnDataReady() if (recvq.length() > user->GetClass()->recvqmax && !user->HasPrivPermission("users/flood/increased-buffers")) { ServerInstance->Users.QuitUser(user, "RecvQ exceeded"); - ServerInstance->SNO.WriteToSnoMask('a', "User %s RecvQ of %zu exceeds connect class maximum of %lu", - user->nick.c_str(), recvq.length(), user->GetClass()->recvqmax); + ServerInstance->SNO.WriteToSnoMask('a', "User {} RecvQ of {} exceeds connect class maximum of {}", + user->nick, recvq.length(), user->GetClass()->recvqmax); return; } @@ -430,9 +430,9 @@ void LocalUser::FullConnect() FOREACH_MOD(OnPostConnect, (this)); - ServerInstance->SNO.WriteToSnoMask('c', "Client connecting on port %hu (class %s): %s (%s) [%s\x0F]", - this->server_sa.port(), this->GetClass()->name.c_str(), GetFullRealHost().c_str(), - this->GetIPString().c_str(), this->GetRealName().c_str()); + ServerInstance->SNO.WriteToSnoMask('c', "Client connecting on port {} (class {}): {} ({}) [{}\x0F]", + server_sa.port(), GetClass()->GetName(), GetFullRealHost(), GetIPString(), GetRealName()); + ServerInstance->Logs.Debug("BANCACHE", "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); ServerInstance->BanCache.AddHit(this->GetIPString(), "", ""); // reset the flood penalty (which could have been raised due to things like auto +x) diff --git a/src/xline.cpp b/src/xline.cpp index 9b9214c7d..10ca2b95f 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -705,8 +705,9 @@ void ELine::OnAdd() void XLine::DisplayExpiry() { bool onechar = (type.length() == 1); - ServerInstance->SNO.WriteToSnoMask('x', "Removing an expired %s%s on %s (set by %s %s ago): %s", - type.c_str(), (onechar ? "-line" : ""), Displayable().c_str(), source.c_str(), Duration::ToString(ServerInstance->Time() - set_time).c_str(), reason.c_str()); + ServerInstance->SNO.WriteToSnoMask('x', "Removing an expired {}{} on {} (set by {} {} ago): {}", + type, (onechar ? "-line" : ""), Displayable(), source, + Duration::ToString(ServerInstance->Time() - set_time), reason); } const std::string& ELine::Displayable() |
