mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Replace InspIRCd::Format with fmt::format.
This commit is contained in:
parent
671b84ecf2
commit
5c4badf8ea
@ -374,7 +374,6 @@ public:
|
||||
* @param ... A variable number of format arguments.
|
||||
* @return The formatted string
|
||||
*/
|
||||
static std::string Format(const char* formatString, ...) ATTR_PRINTF(1, 2);
|
||||
static std::string Format(va_list& vaList, const char* formatString) ATTR_PRINTF(2, 0);
|
||||
|
||||
/** Determines whether a nickname is valid. */
|
||||
|
@ -67,9 +67,9 @@ private:
|
||||
void SendNoticeInternal(LocalUser* user, const Command* command, const std::string& description)
|
||||
{
|
||||
if (command)
|
||||
user->WriteNotice(InspIRCd::Format("*** %s: %s", command->name.c_str(), description.c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** {}: {}", command->name, description));
|
||||
else
|
||||
user->WriteNotice(InspIRCd::Format("*** %s", description.c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** {}", description));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -35,7 +35,7 @@ namespace IRCv3
|
||||
inline std::string FormatTime(time_t secs, long millisecs = 0)
|
||||
{
|
||||
std::string timestr = InspIRCd::TimeString(secs, "%Y-%m-%dT%H:%M:%S.Z", true);
|
||||
timestr.insert(20, InspIRCd::Format("%03ld", millisecs));
|
||||
timestr.insert(20, INSP_FORMAT("{:03}", millisecs));
|
||||
return timestr;
|
||||
}
|
||||
}
|
||||
|
@ -54,16 +54,16 @@ public:
|
||||
: Numeric(ERR_CANNOTSENDTOCHAN)
|
||||
{
|
||||
push(chan->name);
|
||||
push(InspIRCd::Format("You cannot send %s to this channel whilst the +%c (%s) mode is set.",
|
||||
what.c_str(), mh->GetModeChar(), mh->name.c_str()));
|
||||
push(INSP_FORMAT("You cannot send {} to this channel whilst the +{} ({}) mode is set.",
|
||||
what, mh->GetModeChar(), mh->name));
|
||||
}
|
||||
|
||||
CannotSendTo(Channel* chan, const std::string& what, char extban, const std::string& extbandesc)
|
||||
: Numeric(ERR_CANNOTSENDTOCHAN)
|
||||
{
|
||||
push(chan->name);
|
||||
push(InspIRCd::Format("You cannot send %s to this channel whilst %s %c: (%s) extban is set matching you.",
|
||||
what.c_str(), strchr("AEIOUaeiou", extban) ? "an" : "a", extban, extbandesc.c_str()));
|
||||
push(INSP_FORMAT("You cannot send {} to this channel whilst {} {}: ({}) extban is set matching you.",
|
||||
what, strchr("AEIOUaeiou", extban) ? "an" : "a", extban, extbandesc));
|
||||
}
|
||||
|
||||
CannotSendTo(User* user, const std::string& message)
|
||||
@ -77,8 +77,8 @@ public:
|
||||
: Numeric(ERR_CANNOTSENDTOUSER)
|
||||
{
|
||||
push(user->connected & User::CONN_NICK ? user->nick : "*");
|
||||
push(InspIRCd::Format("You cannot send %s to this user whilst %s have the +%c (%s) mode set.",
|
||||
what.c_str(), self ? "you" : "they", mh->GetModeChar(), mh->name.c_str()));
|
||||
push(INSP_FORMAT("You cannot send {} to this user whilst {} have the +{} ({}) mode set.",
|
||||
what, self ? "you" : "they", mh->GetModeChar(), mh->name));
|
||||
}
|
||||
};
|
||||
|
||||
@ -93,9 +93,9 @@ public:
|
||||
|
||||
const PrefixMode* pm = ServerInstance->Modes.FindNearestPrefixMode(rank);
|
||||
if (pm)
|
||||
push(InspIRCd::Format("You must be a channel %s or higher to %s.", pm->name.c_str(), message.c_str()));
|
||||
push(INSP_FORMAT("You must be a channel {} or higher to {}.", pm->name, message));
|
||||
else
|
||||
push(InspIRCd::Format("You do not have the required channel privileges to %s.", message.c_str()));
|
||||
push(INSP_FORMAT("You do not have the required channel privileges to {}.", message));
|
||||
}
|
||||
};
|
||||
|
||||
@ -117,12 +117,12 @@ private:
|
||||
if (!syntax.empty())
|
||||
{
|
||||
// If the mode has a syntax hint we include it in the message.
|
||||
push(InspIRCd::Format("Invalid %s mode parameter. Syntax: %s.", mode->name.c_str(), syntax.c_str()));
|
||||
push(INSP_FORMAT("Invalid {} mode parameter. Syntax: {}.", mode->name, syntax));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, send it without.
|
||||
push(InspIRCd::Format("Invalid %s mode parameter.", mode->name.c_str()));
|
||||
push(INSP_FORMAT("Invalid {} mode parameter.", mode->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,8 +280,8 @@ void CommandParser::ProcessCommand(LocalUser* user, std::string& command, Comman
|
||||
if (!user->HasCommandPermission(command))
|
||||
{
|
||||
user->CommandFloodPenalty += failpenalty;
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to command %s",
|
||||
user->oper->GetType().c_str(), command.c_str()));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Oper type {} does not have access to command {}",
|
||||
user->oper->GetType(), command));
|
||||
FOREACH_MOD(OnCommandBlocked, (command, command_p, user));
|
||||
return;
|
||||
}
|
||||
|
@ -457,10 +457,7 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int
|
||||
|
||||
auto file = DoOpenFile(path, exec);
|
||||
if (!file)
|
||||
{
|
||||
throw CoreException(InspIRCd::Format("Could not read \"%s\" for %s: %s",
|
||||
path.c_str(), key.c_str(), strerror(errno)));
|
||||
}
|
||||
throw CoreException(INSP_FORMAT("Could not read \"{}\" for {}: {}", path, key, strerror(errno)));
|
||||
|
||||
file_cache& cache = FilesOutput[key];
|
||||
cache.clear();
|
||||
@ -530,8 +527,7 @@ bool ParseStack::ParseFile(const std::string& path, int flags, const std::string
|
||||
if (flags & FLAG_MISSING_OKAY)
|
||||
return true;
|
||||
|
||||
throw CoreException(InspIRCd::Format("Could not read \"%s\" for include: %s",
|
||||
path.c_str(), strerror(errno)));
|
||||
throw CoreException(INSP_FORMAT("Could not read \"{}\" for include: {}", path, strerror(errno)));
|
||||
}
|
||||
|
||||
reading.push_back(path);
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@ -461,7 +460,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string& useruid)
|
||||
std::cout << line << std::endl;
|
||||
// If a user is rehashing, tell them directly
|
||||
if (user)
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** %s", line.c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** {}", line));
|
||||
// Also tell opers
|
||||
ServerInstance->SNO.WriteGlobalSno('r', line);
|
||||
}
|
||||
@ -514,7 +513,7 @@ void ServerConfig::ApplyModules(User* user) const
|
||||
|
||||
if (ServerInstance->Modules.Unload(mod))
|
||||
{
|
||||
const std::string message = InspIRCd::Format("The %s module was unloaded.", modname.c_str());
|
||||
const std::string message = INSP_FORMAT("The {} module was unloaded.", modname);
|
||||
if (user)
|
||||
user->WriteNumeric(RPL_UNLOADEDMODULE, modname, message);
|
||||
|
||||
@ -522,7 +521,7 @@ void ServerConfig::ApplyModules(User* user) const
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string message = InspIRCd::Format("Failed to unload the %s module: %s", modname.c_str(), ServerInstance->Modules.LastError().c_str());
|
||||
const std::string message = INSP_FORMAT("Failed to unload the {} module: {}", modname, ServerInstance->Modules.LastError());
|
||||
if (user)
|
||||
user->WriteNumeric(ERR_CANTUNLOADMODULE, modname, message);
|
||||
|
||||
@ -538,7 +537,7 @@ void ServerConfig::ApplyModules(User* user) const
|
||||
|
||||
if (ServerInstance->Modules.Load(modname))
|
||||
{
|
||||
const std::string message = InspIRCd::Format("The %s module was loaded.", modname.c_str());
|
||||
const std::string message = INSP_FORMAT("The {} module was loaded.", modname);
|
||||
if (user)
|
||||
user->WriteNumeric(RPL_LOADEDMODULE, modname, message);
|
||||
|
||||
@ -546,7 +545,7 @@ void ServerConfig::ApplyModules(User* user) const
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string message = InspIRCd::Format("Failed to load the %s module: %s", modname.c_str(), ServerInstance->Modules.LastError().c_str());
|
||||
const std::string message = INSP_FORMAT("Failed to load the {} module: {}", modname, ServerInstance->Modules.LastError());
|
||||
if (user)
|
||||
user->WriteNumeric(ERR_CANTLOADMODULE, modname, message);
|
||||
|
||||
|
@ -190,7 +190,7 @@ CmdResult CommandInvite::Handle(User* user, const Params& parameters)
|
||||
if (invapi.announceinvites != Invite::ANNOUNCE_NONE)
|
||||
{
|
||||
excepts.insert(user);
|
||||
ClientProtocol::Messages::Privmsg privmsg(ServerInstance->FakeClient, c, InspIRCd::Format("*** %s invited %s into the channel", user->nick.c_str(), u->nick.c_str()), MessageType::NOTICE);
|
||||
ClientProtocol::Messages::Privmsg privmsg(ServerInstance->FakeClient, c, INSP_FORMAT("*** {} invited {} into the channel", user->nick, u->nick), MessageType::NOTICE);
|
||||
c->Write(ServerInstance->GetRFCEvents().privmsg, privmsg, prefix, excepts);
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ public:
|
||||
std::string vlist;
|
||||
for (auto* lm : ServerInstance->Modes.GetListModes())
|
||||
{
|
||||
limits.push_back(InspIRCd::Format("%c:%lu", lm->GetModeChar(), lm->GetLowerLimit()));
|
||||
limits.push_back(INSP_FORMAT("{}:{}", lm->GetModeChar(), lm->GetLowerLimit()));
|
||||
if (lm->HasVariableLength())
|
||||
vlist.push_back(lm->GetModeChar());
|
||||
}
|
||||
@ -240,7 +240,7 @@ public:
|
||||
|
||||
void OnBuildClassISupport(const std::shared_ptr<ConnectClass>& klass, ISupport::TokenMap& tokens) override
|
||||
{
|
||||
tokens["CHANLIMIT"] = InspIRCd::Format("#:%lu", klass->maxchans);
|
||||
tokens["CHANLIMIT"] = INSP_FORMAT("#:{}", klass->maxchans);
|
||||
}
|
||||
|
||||
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven, bool override) override
|
||||
|
@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "modules/dns.h"
|
||||
#include "modules/stats.h"
|
||||
@ -233,7 +234,7 @@ private:
|
||||
if (!InspIRCd::IsHost(srv->host, true))
|
||||
throw Exception(creator, "Invalid name in SRV resource record");
|
||||
|
||||
record.rdata = InspIRCd::Format("%u %u %u %s", srv->priority, srv->weight, srv->port, srv->host.c_str());
|
||||
record.rdata = INSP_FORMAT("{} {} {} {}", srv->priority, srv->weight, srv->port, srv->host);
|
||||
record.rdataobj = srv;
|
||||
break;
|
||||
}
|
||||
@ -931,7 +932,7 @@ public:
|
||||
{
|
||||
if (stats.GetSymbol() == 'T')
|
||||
{
|
||||
stats.AddGenericRow(InspIRCd::Format("DNS requests: %zu (%zu succeeded, %zu failed)",
|
||||
stats.AddGenericRow(INSP_FORMAT("DNS requests: {} ({} succeeded, {} failed)",
|
||||
manager.stats_total, manager.stats_success, manager.stats_failure));
|
||||
}
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
@ -64,7 +64,7 @@ CmdResult CommandMotd::Handle(User* user, const Params& parameters)
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
||||
user->WriteRemoteNumeric(RPL_MOTDSTART, InspIRCd::Format("%s message of the day:", ServerInstance->Config->GetServerName().c_str()));
|
||||
user->WriteRemoteNumeric(RPL_MOTDSTART, INSP_FORMAT("{} message of the day:", ServerInstance->Config->GetServerName()));
|
||||
for (const auto& line : motd->second)
|
||||
user->WriteRemoteNumeric(RPL_MOTD, line);
|
||||
user->WriteRemoteNumeric(RPL_ENDOFMOTD, "End of message of the day.");
|
||||
|
@ -174,8 +174,8 @@ public:
|
||||
|
||||
void OnUserConnect(LocalUser* user) override
|
||||
{
|
||||
user->WriteNumeric(RPL_WELCOME, InspIRCd::Format("Welcome to the %s IRC Network %s", ServerInstance->Config->Network.c_str(), user->GetFullRealHost().c_str()));
|
||||
user->WriteNumeric(RPL_YOURHOST, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->GetServerName().c_str(), INSPIRCD_BRANCH));
|
||||
user->WriteNumeric(RPL_WELCOME, INSP_FORMAT("Welcome to the {} IRC Network {}", ServerInstance->Config->Network, user->GetFullRealHost()));
|
||||
user->WriteNumeric(RPL_YOURHOST, INSP_FORMAT("Your host is {}, running version {}", ServerInstance->Config->GetServerName(), INSPIRCD_BRANCH));
|
||||
user->WriteNumeric(RPL_CREATED, InspIRCd::TimeString(ServerInstance->startup_time, "This server was created %H:%M:%S %b %d %Y"));
|
||||
user->WriteNumeric(numeric004);
|
||||
isupport.SendTo(user);
|
||||
|
@ -65,7 +65,7 @@ void ISupportManager::AppendValue(std::string& buffer, const std::string& value)
|
||||
// (1) It is a banned character in an IRC <middle> parameter (NUL, LF, CR, SPACE).
|
||||
// (2) It has special meaning within an ISUPPORT token (EQUALS, BACKSLASH).
|
||||
if (chr == '\0' || chr == '\n' || chr == '\r' || chr == ' ' || chr == '=' || chr == '\\')
|
||||
buffer.append(InspIRCd::Format("\\x%X", chr));
|
||||
buffer.append(INSP_FORMAT("\\x{:02X}", chr));
|
||||
else
|
||||
buffer.push_back(chr);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ CmdResult CommandList::Handle(User* user, const Params& parameters)
|
||||
else if (showmodes)
|
||||
{
|
||||
// Show the list response with the modes and topic.
|
||||
user->WriteNumeric(RPL_LIST, chan->name, users, InspIRCd::Format("[+%s] %s", chan->ChanModes(n), chan->topic.c_str()));
|
||||
user->WriteNumeric(RPL_LIST, chan->name, users, INSP_FORMAT("[+{}] {}", chan->ChanModes(n), chan->topic));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ CmdResult CommandLusers::Handle(User* user, const Params& parameters)
|
||||
|
||||
counters.UpdateMaxUsers();
|
||||
|
||||
user->WriteNumeric(RPL_LUSERCLIENT, InspIRCd::Format("There are %zu users and %zu invisible on %zu servers",
|
||||
user->WriteNumeric(RPL_LUSERCLIENT, INSP_FORMAT("There are {} users and {} invisible on {} servers",
|
||||
n_users - counters.invisible, counters.invisible, n_serv));
|
||||
|
||||
size_t opercount = ServerInstance->Users.all_opers.size();
|
||||
@ -114,9 +114,9 @@ CmdResult CommandLusers::Handle(User* user, const Params& parameters)
|
||||
user->WriteNumeric(RPL_LUSERUNKNOWN, ServerInstance->Users.UnknownUserCount(), "unknown connections");
|
||||
|
||||
user->WriteNumeric(RPL_LUSERCHANNELS, ServerInstance->Channels.GetChans().size(), "channels formed");
|
||||
user->WriteNumeric(RPL_LUSERME, InspIRCd::Format("I have %zu clients and %zu servers", ServerInstance->Users.LocalUserCount(), n_local_servs));
|
||||
user->WriteNumeric(RPL_LOCALUSERS, InspIRCd::Format("Current local users: %zu Max: %zu", ServerInstance->Users.LocalUserCount(), counters.max_local));
|
||||
user->WriteNumeric(RPL_GLOBALUSERS, InspIRCd::Format("Current global users: %zu Max: %zu", n_users, counters.max_global));
|
||||
user->WriteNumeric(RPL_LUSERME, INSP_FORMAT("I have {} clients and {} servers", ServerInstance->Users.LocalUserCount(), n_local_servs));
|
||||
user->WriteNumeric(RPL_LOCALUSERS, INSP_FORMAT("Current local users: {} Max: {}", ServerInstance->Users.LocalUserCount(), counters.max_local));
|
||||
user->WriteNumeric(RPL_GLOBALUSERS, INSP_FORMAT("Current global users: {} Max: {}", n_users, counters.max_global));
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ private:
|
||||
std::sort(type3.begin(), type3.end());
|
||||
std::sort(type4.begin(), type4.end());
|
||||
|
||||
return InspIRCd::Format("%s,%s,%s,%s", type1.c_str(), type2.c_str(), type3.c_str(), type4.c_str());
|
||||
return INSP_FORMAT("{},{},{},{}", type1, type2, type3, type4);
|
||||
}
|
||||
|
||||
static std::string GeneratePrefixList(bool includemodechars)
|
||||
|
@ -31,8 +31,7 @@ namespace
|
||||
{
|
||||
CmdResult FailedOper(LocalUser* user, const std::string& name)
|
||||
{
|
||||
user->WriteNumeric(ERR_NOOPERHOST, InspIRCd::Format("Failed to log into the \x02%s\x02 oper account (check the server log for details).",
|
||||
name.c_str()));
|
||||
user->WriteNumeric(ERR_NOOPERHOST, INSP_FORMAT("Failed to log into the \x02{}\x02 oper account (check the server log for details).", name));
|
||||
user->CommandFloodPenalty += 10'000;
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
@ -101,9 +101,8 @@ public:
|
||||
if (!luser)
|
||||
return;
|
||||
|
||||
luser->WriteNumeric(RPL_YOUAREOPER, InspIRCd::Format("You are now %s %s",
|
||||
strchr("AEIOUaeiou", user->oper->GetType()[0]) ? "an" : "a",
|
||||
user->oper->GetType().c_str()));
|
||||
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(),
|
||||
@ -143,13 +142,12 @@ public:
|
||||
const std::string commands = account->GetCommands();
|
||||
const std::string privileges = account->GetPrivileges();
|
||||
|
||||
stats.AddGenericRow(InspIRCd::Format(
|
||||
"\x02%s\x02 (hosts: %s, type: %s, channel modes: %s, user modes: %s, snomasks: %s, commands: %s, privileges: %s)",
|
||||
account->GetName().c_str(), NoneIfEmpty(hosts).c_str(), account->GetType().c_str(),
|
||||
NoneIfEmpty(chanmodes).c_str(), NoneIfEmpty(usermodes).c_str(),
|
||||
NoneIfEmpty(snomasks).c_str(), NoneIfEmpty(commands).c_str(),
|
||||
NoneIfEmpty(privileges).c_str())
|
||||
).AddTags(stats, {
|
||||
stats.AddGenericRow(INSP_FORMAT(
|
||||
"\x02{}\x02 (hosts: {}, type: {}, channel modes: {}, user modes: {}, snomasks: {}, commands: {}, privileges: {})",
|
||||
account->GetName(), NoneIfEmpty(hosts), account->GetType(), NoneIfEmpty(chanmodes), NoneIfEmpty(usermodes),
|
||||
NoneIfEmpty(snomasks), NoneIfEmpty(commands), NoneIfEmpty(privileges)
|
||||
))
|
||||
.AddTags(stats, {
|
||||
{ "name", account->GetName() },
|
||||
{ "hosts", hosts },
|
||||
{ "chan-modes", chanmodes },
|
||||
@ -173,12 +171,12 @@ public:
|
||||
const std::string commands = type->GetCommands();
|
||||
const std::string privileges = type->GetPrivileges();
|
||||
|
||||
stats.AddGenericRow(InspIRCd::Format(
|
||||
"\x02%s\02 (channel modes: %s, user modes: %s, snomasks: %s, commands: %s, privileges: %s)",
|
||||
type->GetName().c_str(), NoneIfEmpty(chanmodes).c_str(),
|
||||
NoneIfEmpty(usermodes).c_str(), NoneIfEmpty(snomasks).c_str(),
|
||||
NoneIfEmpty(commands).c_str(), NoneIfEmpty(privileges).c_str())
|
||||
).AddTags(stats, {
|
||||
stats.AddGenericRow(INSP_FORMAT(
|
||||
"\x02{}\02 (channel modes: {}, user modes: {}, snomasks: {}, commands: {}, privileges: {})",
|
||||
type->GetName(), NoneIfEmpty(chanmodes), NoneIfEmpty(usermodes), NoneIfEmpty(snomasks),
|
||||
NoneIfEmpty(commands), NoneIfEmpty(privileges)
|
||||
))
|
||||
.AddTags(stats, {
|
||||
{ "name", type->GetName() },
|
||||
{ "chan-modes", chanmodes },
|
||||
{ "user-modes", usermodes },
|
||||
@ -205,8 +203,8 @@ public:
|
||||
{
|
||||
const std::string awayperiod = Duration::ToString(ServerInstance->Time() - oper->awaytime);
|
||||
const std::string awaytime = InspIRCd::TimeString(oper->awaytime);
|
||||
extra += InspIRCd::Format(": away for %s [since %s] (%s)", awayperiod.c_str(),
|
||||
awaytime.c_str(), oper->awaymsg.c_str());
|
||||
|
||||
extra = INSP_FORMAT(": away for {} [since {}] ({})", awayperiod, awaytime, oper->awaymsg);
|
||||
}
|
||||
|
||||
auto* loper = IS_LOCAL(oper);
|
||||
@ -214,14 +212,13 @@ public:
|
||||
{
|
||||
const std::string idleperiod = Duration::ToString(ServerInstance->Time() - loper->idle_lastmsg);
|
||||
const std::string idletime = InspIRCd::TimeString(loper->idle_lastmsg);
|
||||
extra += InspIRCd::Format("%c idle for %s [since %s]", extra.empty() ? ':' : ',',
|
||||
idleperiod.c_str(), idletime.c_str());
|
||||
|
||||
extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime);
|
||||
}
|
||||
|
||||
stats.AddGenericRow(InspIRCd::Format("\x02%s\x02 (%s)%s", oper->nick.c_str(),
|
||||
oper->MakeHost().c_str(), extra.c_str()));
|
||||
stats.AddGenericRow(INSP_FORMAT("\x02{}\x02 ({}){}", oper->nick, oper->MakeHost(), extra));
|
||||
}
|
||||
stats.AddGenericRow(InspIRCd::Format("%zu server operator%s total", opers, opers ? "s" : ""));
|
||||
stats.AddGenericRow(INSP_FORMAT("{} server operator{} total", opers, opers ? "s" : ""));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
|
@ -106,15 +106,15 @@ std::string ModeUserServerNoticeMask::ProcessNoticeMasks(User* user, const std::
|
||||
}
|
||||
else if (!user->IsOper())
|
||||
{
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Only operators may %sset snomask %c",
|
||||
adding ? "" : "un", snomask));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Only operators may {} snomask {}",
|
||||
adding ? "set" : "unset", snomask));
|
||||
continue;
|
||||
|
||||
}
|
||||
else if (!user->HasSnomaskPermission(snomask))
|
||||
{
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to snomask %c",
|
||||
user->oper->GetType().c_str(), snomask));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Oper type {} does not have access to snomask {}",
|
||||
user->oper->GetType(), snomask));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -710,9 +710,9 @@ public:
|
||||
if (user)
|
||||
{
|
||||
if (result)
|
||||
user->WriteNumeric(RPL_LOADEDMODULE, passedname, InspIRCd::Format("The %s module was reloaded.", passedname.c_str()));
|
||||
user->WriteNumeric(RPL_LOADEDMODULE, passedname, INSP_FORMAT("The {} module was reloaded.", passedname));
|
||||
else
|
||||
user->WriteNumeric(ERR_CANTUNLOADMODULE, passedname, InspIRCd::Format("Failed to reload the %s module.", passedname.c_str()));
|
||||
user->WriteNumeric(ERR_CANTUNLOADMODULE, passedname, INSP_FORMAT("Failed to reload the {} module.", passedname));
|
||||
}
|
||||
|
||||
ServerInstance->GlobalCulls.AddItem(this);
|
||||
|
@ -26,11 +26,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "xline.h"
|
||||
#include "modules/cap.h"
|
||||
#include "modules/stats.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <psapi.h>
|
||||
#else
|
||||
@ -38,6 +33,11 @@
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "modules/cap.h"
|
||||
#include "modules/stats.h"
|
||||
#include "xline.h"
|
||||
|
||||
class StatsTagsProvider
|
||||
: public ClientProtocol::MessageTagProvider
|
||||
{
|
||||
@ -91,7 +91,7 @@ public:
|
||||
|
||||
static void GenerateStatsLl(Stats::Context& stats)
|
||||
{
|
||||
stats.AddRow(211, InspIRCd::Format("nick[ident@%s] sendq cmds_out bytes_out cmds_in bytes_in time_open", (stats.GetSymbol() == 'l' ? "host" : "ip")));
|
||||
stats.AddRow(211, INSP_FORMAT("nick[ident@{}] sendq cmds_out bytes_out cmds_in bytes_in time_open", stats.GetSymbol() == 'l' ? "host" : "ip"));
|
||||
|
||||
for (auto* u : ServerInstance->Users.GetLocalUsers())
|
||||
stats.AddRow(211, u->nick+"["+u->ident+"@"+(stats.GetSymbol() == 'l' ? u->GetDisplayedHost() : u->GetIPString())+"] "+ConvToStr(u->eh.GetSendQSize())+" "+ConvToStr(u->cmds_out)+" "+ConvToStr(u->bytes_out)+" "+ConvToStr(u->cmds_in)+" "+ConvToStr(u->bytes_in)+" "+ConvToStr(ServerInstance->Time() - u->signon));
|
||||
@ -257,9 +257,9 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
float kbitpersec_total;
|
||||
SocketEngine::GetStats().GetBandwidth(kbitpersec_in, kbitpersec_out, kbitpersec_total);
|
||||
|
||||
stats.AddRow(249, InspIRCd::Format("Bandwidth total: %03.5f kilobits/sec", kbitpersec_total));
|
||||
stats.AddRow(249, InspIRCd::Format("Bandwidth out: %03.5f kilobits/sec", kbitpersec_out));
|
||||
stats.AddRow(249, InspIRCd::Format("Bandwidth in: %03.5f kilobits/sec", kbitpersec_in));
|
||||
stats.AddRow(249, INSP_FORMAT("Bandwidth total: {:03.5} kilobits/sec", kbitpersec_total));
|
||||
stats.AddRow(249, INSP_FORMAT("Bandwidth out: {:03.5} kilobits/sec", kbitpersec_out));
|
||||
stats.AddRow(249, INSP_FORMAT("Bandwidth in: {:03.5} kilobits/sec", kbitpersec_in));
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef.
|
||||
@ -282,13 +282,13 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
float n_eaten = ((R.ru_utime.tv_sec - ServerInstance->stats.LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - ServerInstance->stats.LastCPU.tv_usec);
|
||||
float per = (n_eaten / n_elapsed) * 100;
|
||||
|
||||
stats.AddRow(249, InspIRCd::Format("CPU Use (now): %03.5f%%", per));
|
||||
stats.AddRow(249, INSP_FORMAT("CPU Use (now): {:03.5}%", per));
|
||||
|
||||
n_elapsed = ServerInstance->Time() - ServerInstance->startup_time;
|
||||
n_eaten = (float)R.ru_utime.tv_sec + R.ru_utime.tv_usec / 100000.0;
|
||||
per = (n_eaten / n_elapsed) * 100;
|
||||
|
||||
stats.AddRow(249, InspIRCd::Format("CPU Use (total): %03.5f%%", per));
|
||||
stats.AddRow(249, INSP_FORMAT("CPU Use (total): {:03.5}%", per));
|
||||
}
|
||||
#else
|
||||
PROCESS_MEMORY_COUNTERS MemCounters;
|
||||
@ -313,13 +313,13 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
double n_elapsed = (double)(ThisSample.QuadPart - ServerInstance->stats.LastSampled.QuadPart) / ServerInstance->stats.QPFrequency.QuadPart;
|
||||
double per = (n_eaten/n_elapsed);
|
||||
|
||||
stats.AddRow(249, InspIRCd::Format("CPU Use (now): %03.5f%%", per));
|
||||
stats.AddRow(249, INSP_FORMAT("CPU Use (now): {:03.5}%", per));
|
||||
|
||||
n_elapsed = ServerInstance->Time() - ServerInstance->startup_time;
|
||||
n_eaten = (double)(( (uint64_t)(KernelTime.dwHighDateTime) << 32 ) + (uint64_t)(KernelTime.dwLowDateTime))/100000;
|
||||
per = (n_eaten / n_elapsed);
|
||||
|
||||
stats.AddRow(249, InspIRCd::Format("CPU Use (total): %03.5f%%", per));
|
||||
stats.AddRow(249, INSP_FORMAT("CPU Use (total): {:03.5}%", per));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -331,7 +331,7 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
stats.AddRow(249, "unknown commands "+ConvToStr(ServerInstance->stats.Unknown));
|
||||
stats.AddRow(249, "nick collisions "+ConvToStr(ServerInstance->stats.Collisions));
|
||||
stats.AddRow(249, "connection count "+ConvToStr(ServerInstance->stats.Connects));
|
||||
stats.AddRow(249, InspIRCd::Format("bytes sent %5.2fK recv %5.2fK",
|
||||
stats.AddRow(249, INSP_FORMAT("bytes sent {:5.2}K recv {:5.2}K",
|
||||
ServerInstance->stats.Sent / 1024.0, ServerInstance->stats.Recv / 1024.0));
|
||||
}
|
||||
break;
|
||||
@ -347,7 +347,7 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
case 'u':
|
||||
{
|
||||
unsigned int up = static_cast<unsigned int>(ServerInstance->Time() - ServerInstance->startup_time);
|
||||
stats.AddRow(242, InspIRCd::Format("Server up %u days, %.2u:%.2u:%.2u",
|
||||
stats.AddRow(242, INSP_FORMAT("Server up {} days, {:02}:{:02}:{:02}",
|
||||
up / 86400, (up / 3600) % 24, (up / 60) % 60, up % 60));
|
||||
}
|
||||
break;
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
|
||||
CmdResult Handle(User* user, const Params& parameters) override
|
||||
{
|
||||
user->WriteNumeric(RPL_LINKS, ServerInstance->Config->GetServerName(), ServerInstance->Config->GetServerName(), InspIRCd::Format("0 %s", ServerInstance->Config->GetServerDesc().c_str()));
|
||||
user->WriteNumeric(RPL_LINKS, ServerInstance->Config->GetServerName(), ServerInstance->Config->GetServerName(), INSP_FORMAT("0 {}", ServerInstance->Config->GetServerDesc()));
|
||||
user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
@ -81,8 +81,8 @@ CmdResult CommandNick::HandleLocal(LocalUser* user, const Params& parameters)
|
||||
if (memb->chan->GetPrefixValue(user) < VOICE_VALUE && memb->chan->IsBanned(user))
|
||||
{
|
||||
if (ServerInstance->Config->RestrictBannedUsers == ServerConfig::BUT_RESTRICT_NOTIFY)
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (you're banned)",
|
||||
memb->chan->name.c_str()));
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, INSP_FORMAT("Cannot change nickname while on {} (you're banned)",
|
||||
memb->chan->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "modules/whois.h"
|
||||
#include "numericbuilder.h"
|
||||
@ -227,18 +226,18 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned
|
||||
if (genericoper)
|
||||
whois.SendLine(RPL_WHOISOPERATOR, dest->server->IsService() ? "is a network service" : "is a server operator");
|
||||
else
|
||||
whois.SendLine(RPL_WHOISOPERATOR, InspIRCd::Format("is %s %s on %s", (strchr("AEIOUaeiou", dest->oper->GetType()[0]) ? "an" : "a"), dest->oper->GetType().c_str(), ServerInstance->Config->Network.c_str()));
|
||||
whois.SendLine(RPL_WHOISOPERATOR, INSP_FORMAT("is {} {} on {}", (strchr("AEIOUaeiou", dest->oper->GetType()[0]) ? "an" : "a"), dest->oper->GetType(), ServerInstance->Config->Network));
|
||||
}
|
||||
|
||||
if (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex"))
|
||||
{
|
||||
if (dest->IsModeSet(snomaskmode))
|
||||
{
|
||||
whois.SendLine(RPL_WHOISMODES, InspIRCd::Format("is using modes %s %s", dest->GetModeLetters().c_str(), snomaskmode->GetUserParameter(dest).c_str()));
|
||||
whois.SendLine(RPL_WHOISMODES, INSP_FORMAT("is using modes {} {}", dest->GetModeLetters(), snomaskmode->GetUserParameter(dest)));
|
||||
}
|
||||
else
|
||||
{
|
||||
whois.SendLine(RPL_WHOISMODES, InspIRCd::Format("is using modes %s", dest->GetModeLetters().c_str()));
|
||||
whois.SendLine(RPL_WHOISMODES, INSP_FORMAT("is using modes {}", dest->GetModeLetters()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ CmdResult CommandWhowas::Handle(User* user, const Params& parameters)
|
||||
user->WriteNumeric(RPL_WHOWASUSER, parameters[0], u->ident, u->dhost, '*', u->real);
|
||||
|
||||
if (user->HasPrivPermission("users/auspex"))
|
||||
user->WriteNumeric(RPL_WHOWASIP, parameters[0], InspIRCd::Format("was connecting from *@%s", u->host.c_str()));
|
||||
user->WriteNumeric(RPL_WHOWASIP, parameters[0], INSP_FORMAT("was connecting from *@{}", u->host));
|
||||
|
||||
std::string signon = InspIRCd::TimeString(u->signon);
|
||||
bool hide_server = (!ServerInstance->Config->HideServer.empty() && !user->HasPrivPermission("servers/auspex"));
|
||||
|
@ -45,7 +45,7 @@ bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User
|
||||
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);
|
||||
user->WriteNotice(InspIRCd::Format("*** Unable to add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!",
|
||||
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.c_str(), percent, itrigger));
|
||||
return true;
|
||||
}
|
||||
@ -157,7 +157,7 @@ public:
|
||||
}
|
||||
|
||||
// Send a numeric because if we deny then the core doesn't reply anything
|
||||
user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Invalid nickname: %s", xline->reason.c_str()));
|
||||
user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, INSP_FORMAT("Invalid nickname: {}", xline->reason));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,13 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "dynamic.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "dynamic.h"
|
||||
|
||||
DLLManager::DLLManager(const std::string& name)
|
||||
: libname(name)
|
||||
{
|
||||
@ -79,8 +78,8 @@ Module* DLLManager::CallInit()
|
||||
else if (*abi != MODULE_ABI)
|
||||
{
|
||||
const char* version = GetVersion();
|
||||
err.assign(InspIRCd::Format("%s was built against %s (%lu) which is too %s to use with %s (%lu).",
|
||||
libname.c_str(), version ? version : "an unknown version", *abi,
|
||||
err.assign(INSP_FORMAT("{} was built against {} ({}) which is too {} to use with {} ({}).",
|
||||
libname, version ? version : "an unknown version", *abi,
|
||||
*abi < MODULE_ABI ? "old" : "new", INSPIRCD_VERSION, MODULE_ABI));
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -410,13 +410,6 @@ std::string InspIRCd::Format(va_list& vaList, const char* formatString)
|
||||
return std::string(formatBuffer.data());
|
||||
}
|
||||
|
||||
std::string InspIRCd::Format(const char* formatString, ...)
|
||||
{
|
||||
std::string ret;
|
||||
VAFORMAT(ret, formatString, formatString);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string InspIRCd::TimeString(time_t curtime, const char* format, bool utc)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "listmode.h"
|
||||
|
||||
@ -50,12 +51,12 @@ void ListModeBase::DisplayList(User* user, Channel* channel)
|
||||
for (const auto& item : cd->list)
|
||||
user->WriteNumeric(listnumeric, channel->name, item.mask, item.setter, item.time);
|
||||
|
||||
user->WriteNumeric(endoflistnumeric, channel->name, InspIRCd::Format("End of channel %s list.", name.c_str()));
|
||||
user->WriteNumeric(endoflistnumeric, channel->name, INSP_FORMAT("End of channel {} list.", name));
|
||||
}
|
||||
|
||||
void ListModeBase::DisplayEmptyList(User* user, Channel* channel)
|
||||
{
|
||||
user->WriteNumeric(endoflistnumeric, channel->name, InspIRCd::Format("Channel %s list is empty.", name.c_str()));
|
||||
user->WriteNumeric(endoflistnumeric, channel->name, INSP_FORMAT("Channel {} list is empty.", name));
|
||||
}
|
||||
|
||||
void ListModeBase::RemoveMode(Channel* channel, Modes::ChangeList& changelist)
|
||||
@ -82,7 +83,7 @@ void ListModeBase::DoRehash()
|
||||
ListLimit limit(c->getString("chan", "*", 1), c->getUInt("limit", DEFAULT_LIST_SIZE));
|
||||
|
||||
if (limit.mask.empty())
|
||||
throw ModuleException(creator, InspIRCd::Format("<maxlist:chan> is empty, at %s", c->source.str().c_str()));
|
||||
throw ModuleException(creator, INSP_FORMAT("<maxlist:chan> is empty, at {}", c->source.str()));
|
||||
|
||||
if (limit.mask == "*" || limit.mask == "#*")
|
||||
seen_default = true;
|
||||
@ -232,15 +233,15 @@ void ListModeBase::OnParameterMissing(User* source, User* dest, Channel* channel
|
||||
|
||||
void ListModeBase::TellListTooLong(LocalUser* source, Channel* channel, const std::string& parameter)
|
||||
{
|
||||
source->WriteNumeric(ERR_BANLISTFULL, channel->name, parameter, mode, InspIRCd::Format("Channel %s list is full", name.c_str()));
|
||||
source->WriteNumeric(ERR_BANLISTFULL, channel->name, parameter, mode, INSP_FORMAT("Channel {} list is full", name));
|
||||
}
|
||||
|
||||
void ListModeBase::TellAlreadyOnList(LocalUser* source, Channel* channel, const std::string& parameter)
|
||||
{
|
||||
source->WriteNumeric(ERR_LISTMODEALREADYSET, channel->name, parameter, mode, InspIRCd::Format("Channel %s list already contains %s", name.c_str(), parameter.c_str()));
|
||||
source->WriteNumeric(ERR_LISTMODEALREADYSET, channel->name, parameter, mode, INSP_FORMAT("Channel {} list already contains {}", name, parameter));
|
||||
}
|
||||
|
||||
void ListModeBase::TellNotSet(LocalUser* source, Channel* channel, const std::string& parameter)
|
||||
{
|
||||
source->WriteNumeric(ERR_LISTMODENOTSET, channel->name, parameter, mode, InspIRCd::Format("Channel %s list does not contain %s", name.c_str(), parameter.c_str()));
|
||||
source->WriteNumeric(ERR_LISTMODENOTSET, channel->name, parameter, mode, INSP_FORMAT("Channel {} list does not contain {}", name, parameter));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void Log::FileMethod::OnLog(time_t time, Level level, const std::string& type, c
|
||||
fflush(file);
|
||||
|
||||
if (ferror(file))
|
||||
throw CoreException(InspIRCd::Format("Unable to write to %s: %s", name.c_str(), strerror(errno)));
|
||||
throw CoreException(INSP_FORMAT("Unable to write to {}: {}", name, strerror(errno)));
|
||||
}
|
||||
|
||||
bool Log::FileMethod::Tick()
|
||||
@ -127,8 +127,8 @@ Log::MethodPtr Log::FileEngine::Create(const std::shared_ptr<ConfigTag>& tag)
|
||||
auto* fh = fopen(fulltarget.c_str(), "a");
|
||||
if (!fh)
|
||||
{
|
||||
throw CoreException(InspIRCd::Format("Unable to open %s for file logger at %s: %s",
|
||||
fulltarget.c_str(), tag->source.str().c_str(), strerror(errno)));
|
||||
throw CoreException(INSP_FORMAT("Unable to open {} for file logger at {}: {}", fulltarget,
|
||||
tag->source.str(), strerror(errno)));
|
||||
}
|
||||
|
||||
const unsigned long flush = tag->getUInt("flush", 20, 1);
|
||||
|
40
src/mode.cpp
40
src/mode.cpp
@ -87,9 +87,9 @@ void ModeHandler::DisplayEmptyList(User*, Channel*)
|
||||
|
||||
void ModeHandler::OnParameterMissing(User* user, User* dest, Channel* channel)
|
||||
{
|
||||
std::string message = InspIRCd::Format("You must specify a parameter for the %s mode.", name.c_str());
|
||||
std::string message = INSP_FORMAT("You must specify a parameter for the {} mode.", name);
|
||||
if (!syntax.empty())
|
||||
message.append(InspIRCd::Format(" Syntax: %s.", syntax.c_str()));
|
||||
message.append(INSP_FORMAT(" Syntax: {}.", syntax));
|
||||
|
||||
if (channel)
|
||||
user->WriteNumeric(Numerics::InvalidModeParameter(channel, this, "*", message));
|
||||
@ -277,8 +277,8 @@ bool ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Modes::Cha
|
||||
ModeHandler::Rank ourrank = chan->GetPrefixValue(user);
|
||||
if (ourrank < neededrank)
|
||||
{
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, neededrank, InspIRCd::Format("%s channel mode %c (%s)",
|
||||
mcitem.adding ? "set" : "unset", mh->GetModeChar(), mh->name.c_str())));
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, neededrank, INSP_FORMAT("{} channel mode {} ({})",
|
||||
mcitem.adding ? "set" : "unset", mh->GetModeChar(), mh->name)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -303,13 +303,13 @@ bool ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Modes::Cha
|
||||
/* It's an oper only mode, and they don't have access to it. */
|
||||
if (user->IsOper())
|
||||
{
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to %sset %s mode %c",
|
||||
user->oper->GetType().c_str(), mcitem.adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modechar));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Oper type {} does not have access to {} {} mode {}",
|
||||
user->oper->GetType(), mcitem.adding ? "set" : "unset", type == MODETYPE_CHANNEL ? "channel" : "user", modechar));
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Only operators may %sset %s mode %c",
|
||||
mcitem.adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modechar));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Only operators may {} {} mode {}",
|
||||
mcitem.adding ? "set" : "unset", type == MODETYPE_CHANNEL ? "channel" : "user", modechar));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -352,7 +352,7 @@ void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::ve
|
||||
/* No mode handler? Unknown mode character then. */
|
||||
int numeric = (type == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK);
|
||||
const char* typestr = (type == MODETYPE_CHANNEL ? "channel" : "user");
|
||||
user->WriteNumeric(numeric, modechar, InspIRCd::Format("is not a recognised %s mode.", typestr));
|
||||
user->WriteNumeric(numeric, modechar, INSP_FORMAT("is not a recognised {} mode.", typestr));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -560,10 +560,7 @@ ModeHandler::Id ModeParser::AllocateModeId(ModeHandler* mh)
|
||||
void ModeParser::AddMode(ModeHandler* mh)
|
||||
{
|
||||
if (!ModeParser::IsModeChar(mh->GetModeChar()))
|
||||
{
|
||||
throw ModuleException(mh->creator, InspIRCd::Format("Mode letter for %s is invalid: %c",
|
||||
mh->name.c_str(), mh->GetModeChar()));
|
||||
}
|
||||
throw ModuleException(mh->creator, INSP_FORMAT("Mode letter for {} is invalid: {}", mh->name, mh->GetModeChar()));
|
||||
|
||||
/* A mode prefix of ',' is not acceptable, it would fuck up server to server.
|
||||
* A mode prefix of ':' will fuck up both server to server, and client to server.
|
||||
@ -573,24 +570,21 @@ void ModeParser::AddMode(ModeHandler* mh)
|
||||
if (pm)
|
||||
{
|
||||
if ((pm->GetPrefix() > 126) || (pm->GetPrefix() == ',') || (pm->GetPrefix() == ':') || ServerInstance->Channels.IsPrefix(pm->GetPrefix()))
|
||||
{
|
||||
throw ModuleException(mh->creator, InspIRCd::Format("Mode prefix for %s is invalid: %c",
|
||||
mh->name.c_str(), pm->GetPrefix()));
|
||||
}
|
||||
throw ModuleException(mh->creator, INSP_FORMAT("Mode prefix for {} is invalid: {}", mh->name, pm->GetPrefix()));
|
||||
|
||||
PrefixMode* otherpm = FindPrefix(pm->GetPrefix());
|
||||
if (otherpm)
|
||||
{
|
||||
throw ModuleException(mh->creator, InspIRCd::Format("Mode prefix for %s already used by %s from %s: %c",
|
||||
mh->name.c_str(), otherpm->name.c_str(), otherpm->creator->ModuleSourceFile.c_str(), pm->GetPrefix()));
|
||||
throw ModuleException(mh->creator, INSP_FORMAT("Mode prefix for {} already used by {} from {}: {}",
|
||||
mh->name, otherpm->name, otherpm->creator->ModuleSourceFile, pm->GetPrefix()));
|
||||
}
|
||||
}
|
||||
|
||||
ModeHandler*& slot = modehandlers[mh->GetModeType()][ModeParser::GetModeIndex(mh->GetModeChar())];
|
||||
if (slot)
|
||||
{
|
||||
throw ModuleException(mh->creator, InspIRCd::Format("Mode letter for %s already used by %s from %s: %c",
|
||||
mh->name.c_str(), slot->name.c_str(), slot->creator->ModuleSourceFile.c_str(), mh->GetModeChar()));
|
||||
throw ModuleException(mh->creator, INSP_FORMAT("Mode letter for {} already used by {} from {}: {}",
|
||||
mh->name, slot->name, slot->creator->ModuleSourceFile, mh->GetModeChar()));
|
||||
}
|
||||
|
||||
// The mode needs an id if it is either a user mode, a simple mode (flag) or a parameter mode.
|
||||
@ -603,8 +597,8 @@ void ModeParser::AddMode(ModeHandler* mh)
|
||||
if (!res.second)
|
||||
{
|
||||
ModeHandler* othermh = res.first->second;
|
||||
throw ModuleException(mh->creator, InspIRCd::Format("Mode name %s already used by %c from %s",
|
||||
mh->name.c_str(), othermh->GetModeChar(), othermh->creator->ModuleSourceFile.c_str()));
|
||||
throw ModuleException(mh->creator, INSP_FORMAT("Mode name {} already used by {} from {}",
|
||||
mh->name, othermh->GetModeChar(), othermh->creator->ModuleSourceFile));
|
||||
}
|
||||
|
||||
// Everything is fine, add the mode
|
||||
|
@ -180,8 +180,8 @@ public:
|
||||
MMDB_s mmdb;
|
||||
int result = MMDB_open(file.c_str(), MMDB_MODE_MMAP, &mmdb);
|
||||
if (result != MMDB_SUCCESS)
|
||||
throw ModuleException(this, InspIRCd::Format("Unable to load the MaxMind database (%s): %s",
|
||||
file.c_str(), MMDB_strerror(result)));
|
||||
throw ModuleException(this, INSP_FORMAT("Unable to load the MaxMind database ({}): {}",
|
||||
file, MMDB_strerror(result)));
|
||||
|
||||
// Swap the new database with the old database.
|
||||
std::swap(mmdb, geoapi.mmdb);
|
||||
|
@ -28,6 +28,7 @@
|
||||
/// $PackageInfo: require_system("debian") libldap2-dev
|
||||
/// $PackageInfo: require_system("ubuntu") libldap2-dev
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "threadsocket.h"
|
||||
#include "modules/ldap.h"
|
||||
@ -465,7 +466,7 @@ private:
|
||||
|
||||
if (res != req->success)
|
||||
{
|
||||
ldap_result->error = InspIRCd::Format("%s (%s)", ldap_err2string(res), req->info().c_str());
|
||||
ldap_result->error = INSP_FORMAT("{} ({})", ldap_err2string(res), req->info());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
||||
/// $CompilerFlags: find_compiler_flags("RapidJSON")
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <rapidjson/writer.h>
|
||||
|
||||
#include "inspircd.h"
|
||||
|
||||
class JSONMethod final
|
||||
: public Log::Method
|
||||
, public Timer
|
||||
@ -106,7 +106,7 @@ public:
|
||||
fflush(file);
|
||||
|
||||
if (ferror(file))
|
||||
throw CoreException(InspIRCd::Format("Unable to write to %s: %s", name.c_str(), strerror(errno)));
|
||||
throw CoreException(INSP_FORMAT("Unable to write to {}: {}", name, strerror(errno)));
|
||||
}
|
||||
|
||||
// RapidJSON API: Write a character to the file.
|
||||
@ -141,8 +141,8 @@ public:
|
||||
auto* fh = fopen(fulltarget.c_str(), "a");
|
||||
if (!fh)
|
||||
{
|
||||
throw CoreException(InspIRCd::Format("Unable to open %s for JSON logger at %s: %s",
|
||||
fulltarget.c_str(), tag->source.str().c_str(), strerror(errno)));
|
||||
throw CoreException(INSP_FORMAT("Unable to open {} for JSON logger at {}: {}",
|
||||
fulltarget, tag->source.str(), strerror(errno)));
|
||||
}
|
||||
|
||||
const unsigned long flush = tag->getUInt("flush", 20, 1);
|
||||
|
@ -42,8 +42,8 @@
|
||||
#include <mysql_version.h>
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "threadsocket.h"
|
||||
#include "modules/sql.h"
|
||||
#include "threadsocket.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# pragma comment(lib, "mysqlclient.lib")
|
||||
@ -288,7 +288,7 @@ private:
|
||||
unsigned long escapedsize = mysql_escape_string(buffer.data(), in.c_str(), in.length());
|
||||
if (escapedsize == static_cast<unsigned long>(-1))
|
||||
{
|
||||
SQL::Error err(SQL::QSEND_FAIL, InspIRCd::Format("%u: %s", mysql_errno(connection), mysql_error(connection)));
|
||||
SQL::Error err(SQL::QSEND_FAIL, INSP_FORMAT("{}: {}", mysql_errno(connection), mysql_error(connection)));
|
||||
query->OnError(err);
|
||||
return false;
|
||||
}
|
||||
@ -384,7 +384,7 @@ public:
|
||||
{
|
||||
/* XXX: See /usr/include/mysql/mysqld_error.h for a list of
|
||||
* possible error numbers and error messages */
|
||||
SQL::Error e(SQL::QREPLY_FAIL, InspIRCd::Format("%u: %s", mysql_errno(connection), mysql_error(connection)));
|
||||
SQL::Error e(SQL::QREPLY_FAIL, INSP_FORMAT("{}: {}", mysql_errno(connection), mysql_error(connection)));
|
||||
return new MySQLresult(e);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
/* Ambiguous command, list the matches */
|
||||
if (!matchlist.empty())
|
||||
{
|
||||
user->WriteNumeric(ERR_AMBIGUOUSCOMMAND, InspIRCd::Format("Ambiguous abbreviation, possible matches: %s%s", foundcommand.c_str(), matchlist.c_str()));
|
||||
user->WriteNumeric(ERR_AMBIGUOUSCOMMAND, INSP_FORMAT("Ambiguous abbreviation, possible matches: {}{}", foundcommand, matchlist));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Logged in.
|
||||
user->WriteNumeric(RPL_LOGGEDIN, user->GetFullHost(), value, InspIRCd::Format("You are now logged in as %s", value.c_str()));
|
||||
user->WriteNumeric(RPL_LOGGEDIN, user->GetFullHost(), value, INSP_FORMAT("You are now logged in as {}", value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,8 +270,8 @@ public:
|
||||
if (percent < config->percent)
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
||||
const std::string message = InspIRCd::Format("Your message exceeded the %d%% upper case character threshold for %s",
|
||||
config->percent, channel->name.c_str());
|
||||
const std::string message = INSP_FORMAT("Your message exceeded the {}% upper case character threshold for {}",
|
||||
config->percent, channel->name);
|
||||
|
||||
switch (config->method)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
if (change.adding && !mh)
|
||||
{
|
||||
source->WriteNumeric(ERR_UNKNOWNMODE, mid, InspIRCd::Format("Cannot find prefix mode '%s' for autoop", mid.c_str()));
|
||||
source->WriteNumeric(ERR_UNKNOWNMODE, mid, INSP_FORMAT("Cannot find prefix mode '{}' for autoop", mid));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
else if (!mh)
|
||||
@ -75,8 +75,8 @@ public:
|
||||
|
||||
if (mh->GetLevelRequired(change.adding) > mylevel)
|
||||
{
|
||||
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, InspIRCd::Format("You must be able to %s mode %c (%s) to %s an autoop containing it",
|
||||
change.adding ? "set" : "unset", mh->GetModeChar(), mh->name.c_str(), change.adding ? "add" : "remove"));
|
||||
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, INSP_FORMAT("You must be able to {} mode {} ({}) to {} an autoop containing it",
|
||||
change.adding ? "set" : "unset", mh->GetModeChar(), mh->name, change.adding ? "add" : "remove"));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
@ -96,7 +96,8 @@ public:
|
||||
ListModeBase::ModeList* list = banlm->GetList(channel);
|
||||
if (list && change.adding && maxbans <= list->size())
|
||||
{
|
||||
source->WriteNumeric(ERR_BANLISTFULL, channel->name, banlm->GetModeChar(), InspIRCd::Format("Channel ban list for %s is full (maximum entries for this channel is %lu)", channel->name.c_str(), maxbans));
|
||||
source->WriteNumeric(ERR_BANLISTFULL, channel->name, banlm->GetModeChar(), INSP_FORMAT("Channel ban list for {} is full (maximum entries for this channel is {})",
|
||||
channel->name, maxbans));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -164,19 +165,19 @@ public:
|
||||
{
|
||||
if (!ServerInstance->Channels.IsChannel(mask[CHAN]))
|
||||
{
|
||||
source->WriteNumeric(ERR_NOSUCHCHANNEL, channel->name, InspIRCd::Format("Invalid channel name in redirection (%s)", mask[CHAN].c_str()));
|
||||
source->WriteNumeric(ERR_NOSUCHCHANNEL, channel->name, INSP_FORMAT("Invalid channel name in redirection ({})", mask[CHAN]));
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* c = ServerInstance->Channels.Find(mask[CHAN]);
|
||||
if (!c)
|
||||
{
|
||||
source->WriteNumeric(690, InspIRCd::Format("Target channel %s must exist to be set as a redirect.", mask[CHAN].c_str()));
|
||||
source->WriteNumeric(690, INSP_FORMAT("Target channel {} must exist to be set as a redirect.", mask[CHAN]));
|
||||
return false;
|
||||
}
|
||||
else if (change.adding && c->GetPrefixValue(source) < OP_VALUE)
|
||||
{
|
||||
source->WriteNumeric(690, InspIRCd::Format("You must be opped on %s to set it as a redirect.", mask[CHAN].c_str()));
|
||||
source->WriteNumeric(690, INSP_FORMAT("You must be opped on {} to set it as a redirect.", mask[CHAN]));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ public:
|
||||
callerid_data* dat = extInfo.Get(user, true);
|
||||
if (dat->accepting.size() >= maxaccepts)
|
||||
{
|
||||
user->WriteNumeric(ERR_ACCEPTFULL, InspIRCd::Format("Accept list is full (limit is %lu)", maxaccepts));
|
||||
user->WriteNumeric(ERR_ACCEPTFULL, INSP_FORMAT("Accept list is full (limit is {})", maxaccepts));
|
||||
return false;
|
||||
}
|
||||
if (!dat->accepting.insert(whotoadd).second)
|
||||
@ -422,12 +422,14 @@ public:
|
||||
{
|
||||
time_t now = ServerInstance->Time();
|
||||
/* +g and *not* accepted */
|
||||
user->WriteNumeric(ERR_TARGUMODEG, dest->nick, InspIRCd::Format("is in +%c mode (server-side ignore).", myumode.GetModeChar()));
|
||||
user->WriteNumeric(ERR_TARGUMODEG, dest->nick, INSP_FORMAT("is in +{} mode (server-side ignore).", myumode.GetModeChar()));
|
||||
if (now > (dat->lastnotify + long(notify_cooldown)))
|
||||
{
|
||||
user->WriteNumeric(RPL_TARGNOTIFY, dest->nick, "has been informed that you messaged them.");
|
||||
dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, InspIRCd::Format("%s@%s", user->ident.c_str(), user->GetDisplayedHost().c_str()), InspIRCd::Format("is messaging you, and you have user mode +%c set. Use /ACCEPT +%s to allow.",
|
||||
myumode.GetModeChar(), user->nick.c_str()));
|
||||
dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick,
|
||||
INSP_FORMAT("{}@{}", user->ident, user->GetDisplayedHost()),
|
||||
INSP_FORMAT("is messaging you, and you have user mode +{} set. Use /ACCEPT +{} to allow.", myumode.GetModeChar(), user->nick)
|
||||
);
|
||||
dat->lastnotify = now;
|
||||
}
|
||||
return MOD_RES_DENY;
|
||||
|
@ -202,7 +202,7 @@ public:
|
||||
if (rl)
|
||||
{
|
||||
// Channel is banned.
|
||||
user->WriteNumeric(ERR_BADCHANNEL, cname, InspIRCd::Format("Channel %s is CBANed: %s", cname.c_str(), rl->reason.c_str()));
|
||||
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());
|
||||
return MOD_RES_DENY;
|
||||
|
@ -143,8 +143,10 @@ public:
|
||||
if (hidemask)
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, "Your part message contained a banned phrase and was blocked."));
|
||||
else
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, InspIRCd::Format("Your part message contained a banned phrase (%s) and was blocked.",
|
||||
match->mask.c_str())));
|
||||
{
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, INSP_FORMAT("Your part message contained a banned phrase ({}) and was blocked.",
|
||||
match->mask)));
|
||||
}
|
||||
}
|
||||
|
||||
ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) override
|
||||
@ -165,8 +167,10 @@ public:
|
||||
if (hidemask)
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, "Your message to this channel contained a banned phrase and was blocked."));
|
||||
else
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, InspIRCd::Format("Your message to this channel contained a banned phrase (%s) and was blocked.",
|
||||
match->mask.c_str())));
|
||||
{
|
||||
user->WriteNumeric(Numerics::CannotSendTo(chan, INSP_FORMAT("Your message to this channel contained a banned phrase ({}) and was blocked.",
|
||||
match->mask)));
|
||||
}
|
||||
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -243,9 +243,8 @@ public:
|
||||
* Unlike Asuka, I define a clone as coming from the same host. --w00t
|
||||
*/
|
||||
const UserManager::CloneCounts& clonecount = ServerInstance->Users.GetCloneCounts(u);
|
||||
context.Write("member", InspIRCd::Format("%u %s%s (%s\x0F)", clonecount.global,
|
||||
memb->GetAllPrefixChars().c_str(), u->GetFullHost().c_str(),
|
||||
u->GetRealName().c_str()));
|
||||
context.Write("member", INSP_FORMAT("{} {}{} ({}\x0F)", clonecount.global, memb->GetAllPrefixChars(),
|
||||
u->GetFullHost(), u->GetRealName()));
|
||||
}
|
||||
|
||||
for (auto* lm : ServerInstance->Modes.GetListModes())
|
||||
@ -285,9 +284,8 @@ public:
|
||||
if (!matches.empty())
|
||||
{
|
||||
const std::string whatmatch = stdalgo::string::join(matches, ',');
|
||||
context.Write("match", InspIRCd::Format("%ld %s %s %s %s %s %s :%s", ++x, whatmatch.c_str(),
|
||||
u->nick.c_str(), u->ident.c_str(), u->GetRealHost().c_str(), u->GetDisplayedHost().c_str(),
|
||||
u->GetIPString().c_str(), u->GetRealName().c_str()));
|
||||
context.Write("match", INSP_FORMAT("{} {} {} {} {} {} {} :{}", ++x, whatmatch, u->nick, u->ident,
|
||||
u->GetRealHost(), u->GetDisplayedHost(), u->GetIPString(), u->GetRealName()));
|
||||
matches.clear();
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
{
|
||||
// A hostname can not contain NUL, LF, CR, or SPACE.
|
||||
if (chr == 0x00 || chr == 0x0A || chr == 0x0D || chr == 0x20)
|
||||
throw ModuleException(this, InspIRCd::Format("<hostname:charmap> can not contain character 0x%02X (%c)", chr, chr));
|
||||
throw ModuleException(this, INSP_FORMAT("<hostname:charmap> can not contain character 0x{:02X} ({})", chr, chr));
|
||||
newhostmap.set(static_cast<unsigned char>(chr));
|
||||
}
|
||||
std::swap(newhostmap, cmd.hostmap);
|
||||
|
@ -62,14 +62,14 @@ public:
|
||||
if (cloak.empty())
|
||||
continue;
|
||||
|
||||
noterpl.SendIfCap(user, stdrplcap, this, "CLOAK_RESULT", parameters[0], cloak, InspIRCd::Format("Cloak #%zu for %s is %s (type: %s)",
|
||||
++count, parameters[0].c_str(), cloak.c_str(), cloakmethod->GetName()));
|
||||
noterpl.SendIfCap(user, stdrplcap, this, "CLOAK_RESULT", parameters[0], cloak, INSP_FORMAT("Cloak #{} for {} is {} (method: {})",
|
||||
++count, parameters[0], cloak, cloakmethod->GetName()));
|
||||
}
|
||||
|
||||
if (!count)
|
||||
{
|
||||
failrpl.SendIfCap(user, stdrplcap, this, "UNABLE_TO_CLOAK", parameters[0], InspIRCd::Format("There are no methods available for cloaking %s",
|
||||
parameters[0].c_str()));
|
||||
failrpl.SendIfCap(user, stdrplcap, this, "UNABLE_TO_CLOAK", parameters[0], INSP_FORMAT("There are no methods available for cloaking {}",
|
||||
parameters[0]));
|
||||
}
|
||||
|
||||
return CmdResult::SUCCESS;
|
||||
|
@ -169,14 +169,15 @@ struct CloakInfo final
|
||||
{
|
||||
if (ip.family() == AF_INET6)
|
||||
{
|
||||
rv.append(InspIRCd::Format(".%02x%02x.%02x%02x%s",
|
||||
rv.append(INSP_FORMAT(".{:02x}{:02x}.{:02x}{:02x}{}",
|
||||
ip.in6.sin6_addr.s6_addr[2], ip.in6.sin6_addr.s6_addr[3],
|
||||
ip.in6.sin6_addr.s6_addr[0], ip.in6.sin6_addr.s6_addr[1], suffix.c_str()));
|
||||
ip.in6.sin6_addr.s6_addr[0], ip.in6.sin6_addr.s6_addr[1],
|
||||
suffix));
|
||||
}
|
||||
else
|
||||
{
|
||||
const unsigned char* ip4 = (const unsigned char*)&ip.in4.sin_addr;
|
||||
rv.append(InspIRCd::Format(".%d.%d%s", ip4[1], ip4[0], suffix.c_str()));
|
||||
rv.append(INSP_FORMAT(".{}.{}{}", ip4[1], ip4[0], suffix));
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -109,11 +109,11 @@ private:
|
||||
unsigned int c = (unsigned int)(address >> 16) & 0xFF;
|
||||
unsigned int d = (unsigned int)(address >> 24) & 0xFF;
|
||||
|
||||
const std::string alpha = Hash(InspIRCd::Format("%u.%u.%u.%u", a, b, c, d));
|
||||
const std::string beta = Hash(InspIRCd::Format("%u.%u.%u", a, b, c));
|
||||
const std::string gamma = Hash(InspIRCd::Format("%u.%u", a, b));
|
||||
const std::string alpha = Hash(INSP_FORMAT("{}.{}.{}.{}", a, b, c, d));
|
||||
const std::string beta = Hash(INSP_FORMAT("{}.{}.{}", a, b, c));
|
||||
const std::string gamma = Hash(INSP_FORMAT("{}.{}", a, b));
|
||||
|
||||
return Wrap(InspIRCd::Format("%s.%s.%s", alpha.c_str(), beta.c_str(), gamma.c_str()), suffix, '.');
|
||||
return Wrap(INSP_FORMAT("{}.{}.{}", alpha, beta, gamma), suffix, '.');
|
||||
}
|
||||
|
||||
std::string CloakIPv6(const unsigned char* address)
|
||||
@ -133,11 +133,11 @@ private:
|
||||
unsigned int g = ntohs(address16[6]);
|
||||
unsigned int h = ntohs(address16[7]);
|
||||
|
||||
const std::string alpha = Hash(InspIRCd::Format("%x:%x:%x:%x:%x:%x:%x:%x", a, b, c, d, e, f, g, h));
|
||||
const std::string beta = Hash(InspIRCd::Format("%x:%x:%x:%x:%x:%x:%x", a, b, c, d, e, f, g));
|
||||
const std::string gamma = Hash(InspIRCd::Format("%x:%x:%x:%x", a, b, c, d));
|
||||
const std::string alpha = Hash(INSP_FORMAT("{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}", a, b, c, d, e, f, g, h));
|
||||
const std::string beta = Hash(INSP_FORMAT("{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}", a, b, c, d, e, f, g));
|
||||
const std::string gamma = Hash(INSP_FORMAT("{:x}:{:x}:{:x}:{:x}", a, b, c, d));
|
||||
|
||||
return Wrap(InspIRCd::Format("%s:%s:%s", alpha.c_str(), beta.c_str(), gamma.c_str()), suffix, ':');
|
||||
return Wrap(INSP_FORMAT("{}:{}:{}", alpha, beta, gamma), suffix, ':');
|
||||
}
|
||||
|
||||
std::string CloakHost(const std::string& host, char separator, unsigned long parts)
|
||||
|
@ -154,8 +154,7 @@ public:
|
||||
data["map"].push_back(',');
|
||||
}
|
||||
|
||||
compatdata = InspIRCd::Format("front=%s&middle=%s&map=%s", data["front"].c_str(),
|
||||
data["middle"].c_str(), data["map"].c_str());
|
||||
compatdata = INSP_FORMAT("front={}&middle={}&map={}", data["front"], data["middle"], data["map"]);
|
||||
}
|
||||
|
||||
bool Map(unsigned long upper, unsigned long lower) override
|
||||
@ -285,12 +284,12 @@ public:
|
||||
break;
|
||||
|
||||
case Codepage::AllowCharacterResult::NOT_VALID:
|
||||
throw ModuleException(this, InspIRCd::Format("<cpchars> tag contains a forbidden character: %lu at %s",
|
||||
pos, tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<cpchars> tag contains a forbidden character: {} at {}",
|
||||
pos, tag->source.str()));
|
||||
|
||||
case Codepage::AllowCharacterResult::NOT_VALID_AT_FRONT:
|
||||
throw ModuleException(this, InspIRCd::Format("<cpchars> tag contains a forbidden front character: %lu at %s",
|
||||
pos, tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<cpchars> tag contains a forbidden front character: {} at {}",
|
||||
pos, tag->source.str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public:
|
||||
if (i->nickname == target->nick)
|
||||
{
|
||||
dl->erase(i);
|
||||
user->WriteNumeric(RPL_DCCALLOWREMOVED, user->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", target->nick.c_str()));
|
||||
user->WriteNumeric(RPL_DCCALLOWREMOVED, user->nick, INSP_FORMAT("Removed {} from your DCCALLOW list", target->nick));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ public:
|
||||
{
|
||||
if (dccallow.nickname == target->nick)
|
||||
{
|
||||
user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str()));
|
||||
user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, INSP_FORMAT("{} is already on your DCCALLOW list", target->nick));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
}
|
||||
@ -304,7 +304,7 @@ public:
|
||||
}
|
||||
else if (!Duration::IsValid(parameters[1]))
|
||||
{
|
||||
user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, InspIRCd::Format("%s is not a valid DCCALLOW duration", parameters[1].c_str()));
|
||||
user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, INSP_FORMAT("{} is not a valid DCCALLOW duration", parameters[1]));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
else
|
||||
@ -325,11 +325,11 @@ public:
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %s", target->nick.c_str(), Duration::ToString(length).c_str()));
|
||||
user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, INSP_FORMAT("Added {} to DCCALLOW list for {}", target->nick, Duration::ToString(length)));
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNumeric(RPL_DCCALLOWPERMANENT, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for this session", target->nick.c_str()));
|
||||
user->WriteNumeric(RPL_DCCALLOWPERMANENT, user->nick, INSP_FORMAT("Added {} to DCCALLOW list for this session", target->nick));
|
||||
}
|
||||
|
||||
/* route it. */
|
||||
@ -373,8 +373,8 @@ public:
|
||||
{
|
||||
for (const auto& dccallow : *dl)
|
||||
{
|
||||
user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)",
|
||||
dccallow.nickname.c_str(), dccallow.hostmask.c_str()));
|
||||
user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, INSP_FORMAT("{} ({})",
|
||||
dccallow.nickname, dccallow.hostmask));
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,7 +539,7 @@ public:
|
||||
time_t expires = iter2->set_on + iter2->length;
|
||||
if (iter2->length != 0 && expires <= ServerInstance->Time())
|
||||
{
|
||||
u->WriteNumeric(RPL_DCCALLOWEXPIRED, u->nick, InspIRCd::Format("DCCALLOW entry for %s has expired", iter2->nickname.c_str()));
|
||||
u->WriteNumeric(RPL_DCCALLOWEXPIRED, u->nick, INSP_FORMAT("DCCALLOW entry for {} has expired", iter2->nickname));
|
||||
iter2 = dl->erase(iter2);
|
||||
}
|
||||
else
|
||||
@ -574,7 +574,7 @@ public:
|
||||
{
|
||||
|
||||
u->WriteNotice(i->nickname + " left the network or changed their nickname and has been removed from your DCCALLOW list");
|
||||
u->WriteNumeric(RPL_DCCALLOWREMOVED, u->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", i->nickname.c_str()));
|
||||
u->WriteNumeric(RPL_DCCALLOWREMOVED, u->nick, INSP_FORMAT("Removed {} from your DCCALLOW list", i->nickname));
|
||||
dl->erase(i);
|
||||
break;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target,
|
||||
if (user->HasPrivPermission("channels/ignore-delaymsg"))
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
||||
const std::string message = InspIRCd::Format("You cannot send messages to this channel until you have been a member for %ld seconds.", len);
|
||||
const std::string message = INSP_FORMAT("You cannot send messages to this channel until you have been a member for {} seconds.", len);
|
||||
user->WriteNumeric(Numerics::CannotSendTo(channel, message));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -171,14 +171,14 @@ public:
|
||||
if (badchan.redirect.empty() || user->IsModeSet(antiredirectmode)
|
||||
|| ((target = ServerInstance->Channels.Find(badchan.redirect)) && target->IsModeSet(redirectmode)))
|
||||
{
|
||||
user->WriteNumeric(ERR_BADCHANNEL, cname, InspIRCd::Format("Channel %s is forbidden: %s",
|
||||
cname.c_str(), badchan.reason.c_str()));
|
||||
user->WriteNumeric(ERR_BADCHANNEL, cname, INSP_FORMAT("Channel {} is forbidden: {}", cname,
|
||||
badchan.reason));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
// Redirect the user to the target channel.
|
||||
user->WriteNumeric(ERR_BADCHANNEL, cname, InspIRCd::Format("Channel %s is forbidden, redirecting to %s: %s",
|
||||
cname.c_str(), badchan.redirect.c_str(), badchan.reason.c_str()));
|
||||
user->WriteNumeric(ERR_BADCHANNEL, cname, INSP_FORMAT("Channel {} is forbidden, redirecting to {}: {}",
|
||||
cname, badchan.redirect, badchan.reason));
|
||||
Channel::JoinUser(user, badchan.redirect);
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ private:
|
||||
{
|
||||
// Check that the character is a valid mode letter.
|
||||
if (!ModeParser::IsModeChar(chr))
|
||||
throw ModuleException(this, InspIRCd::Format("Invalid mode '%c' was specified in <disabled:%s> at %s",
|
||||
chr, field.c_str(), tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("Invalid mode '{}' was specified in <disabled:{}> at {}",
|
||||
chr, field, tag->source.str()));
|
||||
|
||||
// Check that the mode actually exists.
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(chr, type);
|
||||
if (!mh)
|
||||
throw ModuleException(this, InspIRCd::Format("Nonexistent mode '%c' was specified in <disabled:%s> at %s",
|
||||
chr, field.c_str(), tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("Nonexistent mode '{}' was specified in <disabled:{}> at {}",
|
||||
chr, field, tag->source.str()));
|
||||
|
||||
// Disable the mode.
|
||||
ServerInstance->Logs.Debug(MODNAME, "The %c (%s) %s mode has been disabled",
|
||||
@ -93,8 +93,8 @@ public:
|
||||
// Check that the command actually exists.
|
||||
Command* handler = ServerInstance->Parser.GetHandler(command);
|
||||
if (!handler)
|
||||
throw ModuleException(this, InspIRCd::Format("Nonexistent command '%s' was specified in <disabled:commands> at %s",
|
||||
command.c_str(), tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("Nonexistent command '{}' was specified in <disabled:commands> at {}",
|
||||
command, tag->source.str()));
|
||||
|
||||
// Prevent admins from disabling MODULES for transparency reasons.
|
||||
if (handler->name == "MODULES")
|
||||
@ -190,13 +190,13 @@ public:
|
||||
// treated as if they do not exist.
|
||||
int numeric = (change.mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK);
|
||||
const char* typestr = (change.mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user");
|
||||
user->WriteNumeric(numeric, change.mh->GetModeChar(), InspIRCd::Format("is not a recognised %s mode.", typestr));
|
||||
user->WriteNumeric(numeric, change.mh->GetModeChar(), INSP_FORMAT("is not a recognised {} mode.", typestr));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
// Inform the user that the mode they changed has been disabled.
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - %s mode %c (%s) is disabled",
|
||||
what, change.mh->GetModeChar(), change.mh->name.c_str()));
|
||||
user->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - {} mode {} ({}) is disabled",
|
||||
what, change.mh->GetModeChar(), change.mh->name));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
};
|
||||
|
@ -572,8 +572,8 @@ public:
|
||||
total_misses += dnsbl->stats_misses;
|
||||
total_errors += dnsbl->stats_errors;
|
||||
|
||||
stats.AddGenericRow(InspIRCd::Format("The \"%s\" DNSBL had %lu hits, %lu misses, and %lu errors",
|
||||
dnsbl->name.c_str(), dnsbl->stats_hits, dnsbl->stats_misses, dnsbl->stats_errors));
|
||||
stats.AddGenericRow(INSP_FORMAT("The \"{}\" DNSBL had {} hits, {} misses, and {} errors",
|
||||
dnsbl->name, dnsbl->stats_hits, dnsbl->stats_misses, dnsbl->stats_errors));
|
||||
}
|
||||
|
||||
stats.AddGenericRow("Total DNSBL hits: " + ConvToStr(total_hits));
|
||||
|
@ -76,8 +76,8 @@ public:
|
||||
if (channel->GetPrefixValue(source) >= pm->GetLevelRequired(change.adding))
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
||||
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, InspIRCd::Format("You must be able to %s mode %c (%s) to %s a restriction containing it",
|
||||
change.adding ? "set" : "unset", pm->GetModeChar(), pm->name.c_str(), change.adding ? "add" : "remove"));
|
||||
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, INSP_FORMAT("You must be able to {} mode {} ({}) to {} a restriction containing it",
|
||||
change.adding ? "set" : "unset", pm->GetModeChar(), pm->name, change.adding ? "add" : "remove"));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
|
@ -311,11 +311,9 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters)
|
||||
std::pair<bool, std::string> result = static_cast<ModuleFilter*>(me)->AddFilter(freeform, type, parameters[reasonindex], duration, flags);
|
||||
if (result.first)
|
||||
{
|
||||
const std::string message = InspIRCd::Format("'%s', type '%s'%s, flags '%s', reason: %s",
|
||||
freeform.c_str(), parameters[1].c_str(),
|
||||
(duration ? InspIRCd::Format(", duration '%s'",
|
||||
Duration::ToString(duration).c_str()).c_str()
|
||||
: ""), flags.c_str(), parameters[reasonindex].c_str());
|
||||
const std::string message = INSP_FORMAT("'{}', type '{}'{}, flags '{}', reason: {}", freeform, parameters[1],
|
||||
(duration ? INSP_FORMAT(", duration '{}'", Duration::ToString(duration)) : ""),
|
||||
flags, parameters[reasonindex]);
|
||||
|
||||
user->WriteNotice("*** Added filter " + message);
|
||||
ServerInstance->SNO.WriteToSnoMask(IS_LOCAL(user) ? 'f' : 'F',
|
||||
@ -422,26 +420,26 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar
|
||||
|
||||
if (is_selfmsg && warnonselfmsg)
|
||||
{
|
||||
ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("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's self message matched %s (%s)",
|
||||
user->nick.c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
return MOD_RES_PASSTHRU;
|
||||
}
|
||||
else if (f->action == FA_WARN)
|
||||
{
|
||||
ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("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's message to %s matched %s (%s)",
|
||||
user->nick.c_str(), msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
return MOD_RES_PASSTHRU;
|
||||
}
|
||||
else if (f->action == FA_BLOCK)
|
||||
{
|
||||
ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%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', "%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());
|
||||
if (notifyuser)
|
||||
{
|
||||
if (msgtarget.type == MessageTarget::TYPE_CHANNEL)
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<Channel>(), InspIRCd::Format("Your message to this channel was blocked: %s.", f->reason.c_str())));
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<Channel>(), INSP_FORMAT("Your message to this channel was blocked: {}.", f->reason)));
|
||||
else
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<User>(), InspIRCd::Format("Your message to this user was blocked: %s.", f->reason.c_str())));
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<User>(), INSP_FORMAT("Your message to this user was blocked: {}.", f->reason)));
|
||||
}
|
||||
else
|
||||
details.echo_original = true;
|
||||
@ -451,26 +449,26 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar
|
||||
if (notifyuser)
|
||||
{
|
||||
if (msgtarget.type == MessageTarget::TYPE_CHANNEL)
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<Channel>(), InspIRCd::Format("Your message to this channel was blocked: %s.", f->reason.c_str())));
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<Channel>(), INSP_FORMAT("Your message to this channel was blocked: {}.", f->reason)));
|
||||
else
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<User>(), InspIRCd::Format("Your message to this user was blocked: %s.", f->reason.c_str())));
|
||||
user->WriteNumeric(Numerics::CannotSendTo(msgtarget.Get<User>(), INSP_FORMAT("Your message to this user was blocked: {}.", f->reason)));
|
||||
}
|
||||
else
|
||||
details.echo_original = true;
|
||||
}
|
||||
else if (f->action == FA_KILL)
|
||||
{
|
||||
ServerInstance->SNO.WriteGlobalSno('f', InspIRCd::Format("%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', "%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->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', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their message to %s matched %s (%s)",
|
||||
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()));
|
||||
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
if (ServerInstance->XLines->AddLine(sh, nullptr))
|
||||
{
|
||||
ServerInstance->XLines->ApplyLines();
|
||||
@ -481,10 +479,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', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their message to %s matched %s (%s)",
|
||||
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()));
|
||||
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
if (ServerInstance->XLines->AddLine(gl, nullptr))
|
||||
{
|
||||
ServerInstance->XLines->ApplyLines();
|
||||
@ -495,10 +493,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', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their message to %s matched %s (%s)",
|
||||
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()));
|
||||
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
if (ServerInstance->XLines->AddLine(zl, nullptr))
|
||||
{
|
||||
ServerInstance->XLines->ApplyLines();
|
||||
@ -572,11 +570,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', InspIRCd::Format("%s (%s) was G-lined for %s (expires on %s) because their %s message matched %s (%s)",
|
||||
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()));
|
||||
command.c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
|
||||
if (ServerInstance->XLines->AddLine(gl, nullptr))
|
||||
{
|
||||
@ -588,11 +586,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', InspIRCd::Format("%s (%s) was Z-lined for %s (expires on %s) because their %s message matched %s (%s)",
|
||||
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()));
|
||||
command.c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
|
||||
if (ServerInstance->XLines->AddLine(zl, nullptr))
|
||||
{
|
||||
@ -605,11 +603,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', InspIRCd::Format("%s (%s) was shunned for %s (expires on %s) because their %s message matched %s (%s)",
|
||||
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()));
|
||||
command.c_str(), f->freeform.c_str(), f->reason.c_str());
|
||||
|
||||
if (ServerInstance->XLines->AddLine(sh, nullptr))
|
||||
{
|
||||
|
@ -150,21 +150,20 @@ public:
|
||||
}
|
||||
|
||||
uint32_t addr = sa.in4.sin_addr.s_addr;
|
||||
user->WriteNotice(InspIRCd::Format("*** HEXIP: %s encodes to %02x%02x%02x%02x.",
|
||||
sa.addr().c_str(), (addr & 0xFF), ((addr >> 8) & 0xFF), ((addr >> 16) & 0xFF),
|
||||
user->WriteNotice(INSP_FORMAT("*** HEXIP: {} encodes to {:02x}{:02x}{:02x}{:02x}.",
|
||||
sa.addr(), (addr & 0xFF), ((addr >> 8) & 0xFF), ((addr >> 16) & 0xFF),
|
||||
((addr >> 24) & 0xFF)));
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
||||
if (ParseIP(parameters[0], sa))
|
||||
{
|
||||
user->WriteNotice(InspIRCd::Format("*** HEXIP: %s decodes to %s.",
|
||||
parameters[0].c_str(), sa.addr().c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** HEXIP: {} decodes to {}.", parameters[0], sa.addr()));
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
||||
user->WriteNotice(InspIRCd::Format("*** HEXIP: %s is not a valid raw or hex encoded IPv4 address.",
|
||||
parameters[0].c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** HEXIP: {} is not a valid raw or hex encoded IPv4 address.",
|
||||
parameters[0]));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,12 @@ public:
|
||||
|
||||
for (const auto& [location, count] : counts)
|
||||
{
|
||||
stats.AddGenericRow(InspIRCd::Format("%s (%s): %lu", location->GetName().c_str(),
|
||||
location->GetCode().c_str(), count));
|
||||
stats.AddGenericRow(INSP_FORMAT("{} ({}): {}", location->GetName(),
|
||||
location->GetCode(), count));
|
||||
}
|
||||
|
||||
if (unknown)
|
||||
stats.AddGenericRow("Unknown Country: " + ConvToStr(unknown));
|
||||
stats.AddGenericRow(INSP_FORMAT("Unknown Country: {}", unknown));
|
||||
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -121,16 +121,16 @@ public:
|
||||
// Attempt to read the help key.
|
||||
const std::string key = tag->getString("key");
|
||||
if (key.empty())
|
||||
throw ModuleException(this, InspIRCd::Format("<helpop:key> is empty at %s", tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<helpop:key> is empty at {}", tag->source.str()));
|
||||
else if (irc::equals(key, "index"))
|
||||
throw ModuleException(this, InspIRCd::Format("<helpop:key> is set to \"index\" which is reserved at %s", tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<helpop:key> is set to \"index\" which is reserved at {}", tag->source.str()));
|
||||
else if (key.length() > longestkey)
|
||||
longestkey = key.length();
|
||||
|
||||
// Attempt to read the help value.
|
||||
std::string value;
|
||||
if (!tag->readString("value", value, true) || value.empty())
|
||||
throw ModuleException(this, InspIRCd::Format("<helpop:value> is empty at %s", tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<helpop:value> is empty at {}", tag->source.str()));
|
||||
|
||||
// Parse the help body. Empty lines are replaced with a single
|
||||
// space because some clients are unable to show blank lines.
|
||||
@ -140,11 +140,11 @@ public:
|
||||
helpmsg.push_back(line.empty() ? " " : line);
|
||||
|
||||
// Read the help title and store the topic.
|
||||
const std::string title = tag->getString("title", InspIRCd::Format("*** Help for %s", key.c_str()), 1);
|
||||
const std::string title = tag->getString("title", INSP_FORMAT("*** Help for {}", key), 1);
|
||||
if (!newhelp.emplace(key, HelpTopic(helpmsg, title)).second)
|
||||
{
|
||||
throw ModuleException(this, InspIRCd::Format("<helpop> tag with duplicate key '%s' at %s",
|
||||
key.c_str(), tag->source.str().c_str()));
|
||||
throw ModuleException(this, INSP_FORMAT("<helpop> tag with duplicate key '{}' at {}",
|
||||
key, tag->source.str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
if (user->HasPrivPermission("channels/auspex"))
|
||||
return true;
|
||||
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, minrank, InspIRCd::Format("view the channel %s list", GetModeName().c_str())));
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, minrank, INSP_FORMAT("view the channel {} list", GetModeName())));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
@ -161,8 +161,8 @@ public:
|
||||
{
|
||||
const std::string awayperiod = Duration::ToString(ServerInstance->Time() - oper->awaytime);
|
||||
const std::string awaytime = InspIRCd::TimeString(oper->awaytime);
|
||||
extra += InspIRCd::Format(": away for %s [since %s] (%s)", awayperiod.c_str(),
|
||||
awaytime.c_str(), oper->awaymsg.c_str());
|
||||
|
||||
extra = INSP_FORMAT(": away for {} [since {}] ({})", awayperiod, awaytime, oper->awaymsg);
|
||||
}
|
||||
|
||||
auto* loper = IS_LOCAL(oper);
|
||||
@ -170,14 +170,13 @@ public:
|
||||
{
|
||||
const std::string idleperiod = Duration::ToString(ServerInstance->Time() - loper->idle_lastmsg);
|
||||
const std::string idletime = InspIRCd::TimeString(loper->idle_lastmsg);
|
||||
extra += InspIRCd::Format("%c idle for %s [since %s]", extra.empty() ? ':' : ',',
|
||||
idleperiod.c_str(), idletime.c_str());
|
||||
|
||||
extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime);
|
||||
}
|
||||
|
||||
stats.AddGenericRow(InspIRCd::Format("\x02%s\x02 (%s)%s", oper->nick.c_str(),
|
||||
oper->MakeHost().c_str(), extra.c_str()));
|
||||
stats.AddGenericRow(INSP_FORMAT("\x02{}\x02 ({}){}", oper->nick, oper->MakeHost(), extra));
|
||||
}
|
||||
stats.AddGenericRow(InspIRCd::Format("%zu server operator%s total", opers, opers ? "s" : ""));
|
||||
stats.AddGenericRow(INSP_FORMAT("{} server operator{} total", opers, opers ? "s" : ""));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
};
|
||||
|
@ -201,7 +201,7 @@ public:
|
||||
{
|
||||
// A hostname can not contain NUL, LF, CR, or SPACE.
|
||||
if (chr == 0x00 || chr == 0x0A || chr == 0x0D || chr == 0x20)
|
||||
throw ModuleException(this, InspIRCd::Format("<hostname:charmap> can not contain character 0x%02X (%c)", chr, chr));
|
||||
throw ModuleException(this, INSP_FORMAT("<hostname:charmap> can not contain character 0x{:02X} ({})", chr, chr));
|
||||
newhostmap.set(static_cast<unsigned char>(chr));
|
||||
}
|
||||
std::swap(newhostmap, hostmap);
|
||||
|
@ -256,9 +256,9 @@ public:
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "Sending HTTP error %u: %s", response, errstr);
|
||||
static HTTPHeaders empty;
|
||||
std::string data = InspIRCd::Format(
|
||||
std::string data = INSP_FORMAT(
|
||||
"<html><head></head><body style='font-family: sans-serif; text-align: center'>"
|
||||
"<h1 style='font-size: 48pt'>Error %u</h1><h2 style='font-size: 24pt'>%s</h2><hr>"
|
||||
"<h1 style='font-size: 48pt'>Error {}</h1><h2 style='font-size: 24pt'>{}</h2><hr>"
|
||||
"<small>Powered by <a href='https://www.inspircd.org'>InspIRCd</a></small></body></html>",
|
||||
response, errstr);
|
||||
|
||||
@ -267,7 +267,7 @@ public:
|
||||
|
||||
void SendHeaders(unsigned long size, unsigned int response, HTTPHeaders& rheaders)
|
||||
{
|
||||
WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, http_status_str((http_status)response)));
|
||||
WriteData(INSP_FORMAT("HTTP/{}.{} {} {}\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, http_status_str((http_status)response)));
|
||||
|
||||
rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT", true));
|
||||
rheaders.CreateHeader("Server", INSPIRCD_BRANCH);
|
||||
|
@ -47,7 +47,7 @@ class MsgIdGenerator final
|
||||
|
||||
public:
|
||||
MsgIdGenerator()
|
||||
: strid(InspIRCd::Format("%s~%lu~", ServerInstance->Config->GetSID().c_str(), ServerInstance->startup_time))
|
||||
: strid(INSP_FORMAT("{}~{}~", ServerInstance->Config->GetSID(), ServerInstance->startup_time))
|
||||
, baselen(strid.length())
|
||||
{
|
||||
}
|
||||
|
@ -195,7 +195,8 @@ public:
|
||||
{
|
||||
f->clear();
|
||||
f->lock();
|
||||
memb->chan->WriteNotice(InspIRCd::Format("This channel has been closed to new users for %u seconds because there have been more than %d joins in %d seconds.", duration, f->joins, f->secs));
|
||||
memb->chan->WriteNotice(INSP_FORMAT("This channel has been closed to new users for {} seconds because there have been more than {} joins in {} seconds.",
|
||||
duration, f->joins, f->secs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
const KickRejoinData* data = kr.ext.Get(chan);
|
||||
if ((data) && !invapi->IsInvited(user, chan) && (!data->canjoin(user)))
|
||||
{
|
||||
user->WriteNumeric(ERR_UNAVAILRESOURCE, chan->name, InspIRCd::Format("You must wait %u seconds after being kicked to rejoin (+J is set)", data->delay));
|
||||
user->WriteNumeric(ERR_UNAVAILRESOURCE, chan->name, INSP_FORMAT("You must wait {} seconds after being kicked to rejoin (+J is set)", data->delay));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
|
@ -89,19 +89,19 @@ public:
|
||||
|
||||
if (c->HasUser(user))
|
||||
{
|
||||
user->WriteNumeric(ERR_KNOCKONCHAN, c->name, InspIRCd::Format("Can't KNOCK on %s, you are already on that channel.", c->name.c_str()));
|
||||
user->WriteNumeric(ERR_KNOCKONCHAN, c->name, INSP_FORMAT("Can't KNOCK on {}, you are already on that channel.", c->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
if (c->IsModeSet(noknockmode))
|
||||
{
|
||||
user->WriteNumeric(ERR_CANNOTKNOCK, InspIRCd::Format("Can't KNOCK on %s, +K is set.", c->name.c_str()));
|
||||
user->WriteNumeric(ERR_CANNOTKNOCK, INSP_FORMAT("Can't KNOCK on {}, +K is set.", c->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
if (!c->IsModeSet(inviteonlymode))
|
||||
{
|
||||
user->WriteNumeric(ERR_CHANOPEN, c->name, InspIRCd::Format("Can't KNOCK on %s, channel is not invite only so knocking is pointless!", c->name.c_str()));
|
||||
user->WriteNumeric(ERR_CHANOPEN, c->name, INSP_FORMAT("Can't KNOCK on {}, channel is not invite only so knocking is pointless!", c->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ public:
|
||||
|
||||
if (notify & KN_SEND_NOTICE)
|
||||
{
|
||||
c->WriteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()), status);
|
||||
c->WriteNotice(INSP_FORMAT("User {} is KNOCKing on {} ({})", user->nick, c->name, parameters[1]), status);
|
||||
user->WriteNotice("KNOCKing on " + c->name);
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ class CommandMonitor final
|
||||
if (result == IRCv3::Monitor::Manager::WR_TOOMANY)
|
||||
{
|
||||
// List is full, send error which includes the remaining nicks that were not processed
|
||||
user->WriteNumeric(ERR_MONLISTFULL, maxmonitor, InspIRCd::Format("%s%s%s", nick.c_str(), (ss.StreamEnd() ? "" : ","), ss.GetRemaining().c_str()), "Monitor list is full");
|
||||
user->WriteNumeric(ERR_MONLISTFULL, maxmonitor, INSP_FORMAT("{}{}{}", nick, (ss.StreamEnd() ? "" : ","), ss.GetRemaining()), "Monitor list is full");
|
||||
break;
|
||||
}
|
||||
else if (result != IRCv3::Monitor::Manager::WR_OK)
|
||||
|
@ -158,8 +158,8 @@ public:
|
||||
|
||||
if (f->islocked())
|
||||
{
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("%s has been locked for nickchanges for %u seconds because there have been more than %u nick changes in %u seconds",
|
||||
memb->chan->name.c_str(), duration, f->nicks, f->secs));
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, INSP_FORMAT("{} has been locked for nickchanges for {} seconds because there have been more than {} nick changes in {} seconds",
|
||||
memb->chan->name, duration, f->nicks, f->secs));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
{
|
||||
f->clear();
|
||||
f->lock();
|
||||
memb->chan->WriteNotice(InspIRCd::Format("No nick changes are allowed for %u seconds because there have been more than %u nick changes in %u seconds.",
|
||||
memb->chan->WriteNotice(INSP_FORMAT("No nick changes are allowed for {} seconds because there have been more than {} nick changes in {} seconds.",
|
||||
duration, f->nicks, f->secs));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ public:
|
||||
if (!extban.GetStatus(source, memb->chan).check(!modeset))
|
||||
{
|
||||
// Can't kick with Q in place, not even opers with override, and founders
|
||||
source->WriteNumeric(ERR_RESTRICTED, memb->chan->name, InspIRCd::Format("Can't kick user %s from channel (%s)",
|
||||
memb->user->nick.c_str(), modeset ? "+Q is set" : "you're extbanned"));
|
||||
source->WriteNumeric(ERR_RESTRICTED, memb->chan->name, INSP_FORMAT("Can't kick user {} from channel ({})",
|
||||
memb->user->nick, modeset ? "+Q is set" : "you're extbanned"));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
bool modeset = memb->chan->IsModeSet(nn);
|
||||
if (!extban.GetStatus(user, memb->chan).check(!modeset))
|
||||
{
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Can't change nickname while on %s (%s)",
|
||||
memb->chan->name.c_str(), modeset ? "+N is set" : "you're extbanned"));
|
||||
user->WriteNumeric(ERR_CANTCHANGENICK, INSP_FORMAT("Can't change nickname while on {} ({})",
|
||||
memb->chan->name, modeset ? "+N is set" : "you're extbanned"));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
{
|
||||
if (!override && chan && chan->IsModeSet(oc) && !user->IsOper())
|
||||
{
|
||||
user->WriteNumeric(ERR_CANTJOINOPERSONLY, chan->name, InspIRCd::Format("Only server operators may join %s (+O is set)", chan->name.c_str()));
|
||||
user->WriteNumeric(ERR_CANTJOINOPERSONLY, chan->name, INSP_FORMAT("Only server operators may join {} (+O is set)", chan->name));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
source->nick.c_str(), source_level, dest->nick.c_str(), dest_level, reason.c_str());
|
||||
}
|
||||
dest->WriteNotice("*** Oper " + source->nick + " attempted to /KILL you!");
|
||||
source->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper %s is a higher level than you", dest->nick.c_str()));
|
||||
source->WriteNumeric(ERR_NOPRIVILEGES, INSP_FORMAT("Permission Denied - Oper {} is a higher level than you", dest->nick));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ private:
|
||||
}
|
||||
|
||||
if (NoisyOverride)
|
||||
chan->WriteRemoteNotice(InspIRCd::Format("%s used oper override to bypass %s", user->nick.c_str(), bypasswhat));
|
||||
chan->WriteRemoteNotice(INSP_FORMAT("{} used oper override to bypass {}", user->nick, bypasswhat));
|
||||
ServerInstance->SNO.WriteGlobalSno('v', user->nick+" used oper override to bypass " + mode + " on " + chan->name);
|
||||
return MOD_RES_ALLOW;
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ public:
|
||||
auto* c = ServerInstance->Channels.Find(parameter);
|
||||
if (!c)
|
||||
{
|
||||
source->WriteNumeric(690, InspIRCd::Format("Target channel %s must exist to be set as a redirect.", parameter.c_str()));
|
||||
source->WriteNumeric(690, INSP_FORMAT("Target channel {} must exist to be set as a redirect.", parameter));
|
||||
return false;
|
||||
}
|
||||
else if (c->GetPrefixValue(source) < OP_VALUE)
|
||||
{
|
||||
source->WriteNumeric(690, InspIRCd::Format("You must be opped on %s to set it as a redirect.", parameter.c_str()));
|
||||
source->WriteNumeric(690, INSP_FORMAT("You must be opped on {} to set it as a redirect.", parameter));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
if (!channel->HasUser(target))
|
||||
{
|
||||
user->WriteNotice(InspIRCd::Format("*** User %s is not on channel %s", target->nick.c_str(), channel->name.c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** User {} is not on channel {}", target->nick, channel->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
@ -129,21 +129,21 @@ public:
|
||||
/* Build up the part reason string. */
|
||||
std::string reason = "Removed by " + user->nick + ": " + reasonparam;
|
||||
|
||||
channel->WriteRemoteNotice(InspIRCd::Format("%s removed %s from the channel", user->nick.c_str(), target->nick.c_str()));
|
||||
channel->WriteRemoteNotice(INSP_FORMAT("{} removed {} from the channel", user->nick, target->nick));
|
||||
target->WriteNotice("*** " + user->nick + " removed you from " + channel->name + " with the message: " + reasonparam);
|
||||
|
||||
channel->PartUser(target, reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteNotice(InspIRCd::Format("*** You do not have access to /REMOVE %s from %s", target->nick.c_str(), channel->name.c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** You do not have access to /REMOVE {} from {}", target->nick, channel->name));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* m_nokicks.so was loaded and +Q was set, block! */
|
||||
user->WriteNumeric(ERR_RESTRICTED, channel->name, InspIRCd::Format("Can't remove user %s from channel (+Q is set)", target->nick.c_str()));
|
||||
user->WriteNumeric(ERR_RESTRICTED, channel->name, INSP_FORMAT("Can't remove user {} from channel (+Q is set)", target->nick));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
|
@ -318,15 +318,15 @@ private:
|
||||
{
|
||||
if (ms.MaxLines && settings.Lines > ms.MaxLines)
|
||||
{
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
|
||||
"The line number you specified is too big. Maximum allowed is %lu.", ms.MaxLines)));
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, INSP_FORMAT(
|
||||
"The line number you specified is too big. Maximum allowed is {}.", ms.MaxLines)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ms.MaxSecs && settings.Seconds > ms.MaxSecs)
|
||||
{
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
|
||||
"The seconds you specified are too big. Maximum allowed is %lu.", ms.MaxSecs)));
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, INSP_FORMAT(
|
||||
"The seconds you specified are too big. Maximum allowed is {}.", ms.MaxSecs)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -336,8 +336,8 @@ private:
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
|
||||
"The server administrator has disabled matching on edit distance."));
|
||||
else
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
|
||||
"The distance you specified is too big. Maximum allowed is %u.", ms.MaxDiff)));
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, INSP_FORMAT(
|
||||
"The distance you specified is too big. Maximum allowed is {}.", ms.MaxDiff)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -347,8 +347,8 @@ private:
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
|
||||
"The server administrator has disabled backlog matching."));
|
||||
else
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
|
||||
"The backlog you specified is too big. Maximum allowed is %lu.", ms.MaxBacklog)));
|
||||
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, INSP_FORMAT(
|
||||
"The backlog you specified is too big. Maximum allowed is {}.", ms.MaxBacklog)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ public:
|
||||
data["max-diff"] = ConvToStr(rm.ms.MaxDiff);
|
||||
data["max-backlog"] = ConvToStr(rm.ms.MaxBacklog);
|
||||
|
||||
compatdata = InspIRCd::Format("%lu:%lu:%u:%lu", rm.ms.MaxLines, rm.ms.MaxSecs,
|
||||
compatdata = INSP_FORMAT("{}:{}:{}:{}", rm.ms.MaxLines, rm.ms.MaxSecs,
|
||||
rm.ms.MaxDiff, rm.ms.MaxBacklog);
|
||||
}
|
||||
};
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
|
||||
if (chan->GetPrefixValue(user) < mh->GetLevelRequired(false))
|
||||
{
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, mh->GetLevelRequired(false), InspIRCd::Format("unset channel mode %c (%s)",
|
||||
mh->GetModeChar(), mh->name.c_str())));
|
||||
user->WriteNumeric(Numerics::ChannelPrivilegesNeeded(chan, mh->GetLevelRequired(false), INSP_FORMAT("unset channel mode {} ({})",
|
||||
mh->GetModeChar(), mh->name)));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
const std::string newTopic(parameters[1], 0, ServerInstance->Config->Limits.MaxTopic);
|
||||
if (target->topic == newTopic)
|
||||
{
|
||||
user->WriteNotice(InspIRCd::Format("The topic on %s is already what you are trying to change it to.", target->name.c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("The topic on {} is already what you are trying to change it to.", target->name));
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -104,9 +104,9 @@ public:
|
||||
// If <securehost:showmsg> is set then tell the user that they need to wait.
|
||||
if (showmsg)
|
||||
{
|
||||
user->WriteNotice(InspIRCd::Format("*** You cannot view the channel list right now. Please %stry again in %s.",
|
||||
user->WriteNotice(INSP_FORMAT("*** You cannot view the channel list right now. Please {}try again in {}.",
|
||||
exemptregistered ? "log in to an account or " : "",
|
||||
Duration::ToString(maxwaittime - ServerInstance->Time()).c_str()));
|
||||
Duration::ToString(maxwaittime - ServerInstance->Time())));
|
||||
}
|
||||
|
||||
// The client might be waiting on a response to do something so send them an
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
if ((u->IsModeSet(bm)) && (memb) && (memb->HasMode(pm)))
|
||||
{
|
||||
/* BZZZT, Denied! */
|
||||
user->WriteNumeric(ERR_RESTRICTED, chan->name, InspIRCd::Format("You are not permitted to remove privileges from %s services", ServerInstance->Config->Network.c_str()));
|
||||
user->WriteNumeric(ERR_RESTRICTED, chan->name, INSP_FORMAT("You are not permitted to remove privileges from {} services", ServerInstance->Config->Network));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
|
||||
if (dst->IsModeSet(bm))
|
||||
{
|
||||
src->WriteNumeric(ERR_KILLDENY, InspIRCd::Format("You are not permitted to kill %s services!", ServerInstance->Config->Network.c_str()));
|
||||
src->WriteNumeric(ERR_KILLDENY, INSP_FORMAT("You are not permitted to kill {} services!", ServerInstance->Config->Network));
|
||||
ServerInstance->SNO.WriteGlobalSno('a', src->nick+" tried to kill service "+dst->nick+" ("+reason+")");
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
// A hostname can not contain NUL, LF, CR, or SPACE.
|
||||
if (chr == 0x00 || chr == 0x0A || chr == 0x0D || chr == 0x20)
|
||||
throw ModuleException(this, InspIRCd::Format("<hostname:charmap> can not contain character 0x%02X (%c)", chr, chr));
|
||||
throw ModuleException(this, INSP_FORMAT("<hostname:charmap> can not contain character 0x{:02X} ({})", chr, chr));
|
||||
newhostmap.set(static_cast<unsigned char>(chr));
|
||||
}
|
||||
std::swap(newhostmap, cmd.hostmap);
|
||||
|
@ -22,7 +22,9 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
|
||||
#include "commands.h"
|
||||
#include "treeserver.h"
|
||||
#include "treesocket.h"
|
||||
@ -272,8 +274,8 @@ void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)
|
||||
if (Utils->AnnounceTSChange)
|
||||
{
|
||||
// WriteRemoteNotice is not used here because the message only needs to go to the local server.
|
||||
chan->WriteNotice(InspIRCd::Format("Creation time of %s changed from %s to %s", newname.c_str(),
|
||||
InspIRCd::TimeString(chan->age).c_str(), InspIRCd::TimeString(TS).c_str()));
|
||||
chan->WriteNotice(INSP_FORMAT("Creation time of {} changed from {} to {}", newname,
|
||||
InspIRCd::TimeString(chan->age), InspIRCd::TimeString(TS)));
|
||||
}
|
||||
|
||||
// While the name is equal in case-insensitive compare, it might differ in case; use the remote version
|
||||
|
@ -166,7 +166,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
|
||||
|
||||
user->WriteNumeric(RPL_LINKS, Current->GetName(),
|
||||
(((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->GetServerName() : Parent),
|
||||
InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str()));
|
||||
INSP_FORMAT("{} {}", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc()));
|
||||
}
|
||||
|
||||
void ModuleSpanningTree::HandleLinks(const CommandBase::Params& parameters, User* user)
|
||||
@ -356,25 +356,25 @@ ModResult ModuleSpanningTree::HandleConnect(const CommandBase::Params& parameter
|
||||
{
|
||||
if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, ascii_case_insensitive_map))
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** CONNECT: Server \002{}\002 is ME, not connecting.", x->Name));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
TreeServer* CheckDupe = Utils->FindServer(x->Name);
|
||||
if (!CheckDupe)
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Connecting to server: \002%s\002 (%s:%hu)", x->Name.c_str(), (x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()), x->Port));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** CONNECT: Connecting to server: \002{}\002 ({}:{})", x->Name, (x->HiddenFromStats ? "<hidden>" : x->IPAddr), x->Port));
|
||||
ConnectServer(x);
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
else
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002", x->Name.c_str(), CheckDupe->GetParent()->GetName().c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** CONNECT: Server \002{}\002 already exists on the network and is connected via \002{}\002", x->Name, CheckDupe->GetParent()->GetName()));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
}
|
||||
}
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: No server matching \002%s\002 could be found in the config file.", parameters[0].c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** CONNECT: No server matching \002{}\002 could be found in the config file.", parameters[0]));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "xline.h"
|
||||
#include "listmode.h"
|
||||
#include "xline.h"
|
||||
|
||||
#include "treesocket.h"
|
||||
#include "treeserver.h"
|
||||
@ -133,10 +133,11 @@ void TreeSocket::SendServerInfo(TreeServer* from)
|
||||
|
||||
if (proto_version < PROTO_INSPIRCD_4)
|
||||
{
|
||||
this->WriteLine(CommandSInfo::Builder(from, "version", InspIRCd::Format("%s. %s :%s", from->rawbranch.c_str(),
|
||||
from->GetPublicName().c_str(), from->customversion.c_str())));
|
||||
this->WriteLine(CommandSInfo::Builder(from, "fullversion", InspIRCd::Format("%s. %s :[%s] %s", from->rawversion.c_str(),
|
||||
from->GetName().c_str(), from->GetId().c_str(), from->customversion.c_str())));
|
||||
this->WriteLine(CommandSInfo::Builder(from, "version", INSP_FORMAT("{}. {} :{}", from->rawbranch,
|
||||
from->GetPublicName(), from->customversion)));
|
||||
|
||||
this->WriteLine(CommandSInfo::Builder(from, "fullversion", INSP_FORMAT("{}. {} :[{}] {}", from->rawversion,
|
||||
from->GetName(), from->GetId(), from->customversion)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ CommandNum::Builder::Builder(SpanningTree::RemoteUser* target, const Numeric::Nu
|
||||
: CmdBuilder("NUM")
|
||||
{
|
||||
TreeServer* const server = (numeric.GetServer() ? (static_cast<TreeServer*>(numeric.GetServer())) : Utils->TreeRoot);
|
||||
push(server->GetId()).push(target->uuid).push(InspIRCd::Format("%03u", numeric.GetNumeric()));
|
||||
push(server->GetId()).push(target->uuid).push(INSP_FORMAT("{:03}", numeric.GetNumeric()));
|
||||
const CommandBase::Params& params = numeric.GetParams();
|
||||
if (!params.empty())
|
||||
{
|
||||
|
@ -21,7 +21,9 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
|
||||
#include "commands.h"
|
||||
#include "treeserver.h"
|
||||
#include "utils.h"
|
||||
@ -103,7 +105,7 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para
|
||||
std::string extra;
|
||||
if (params.GetTags().find("~name") != params.GetTags().end())
|
||||
{
|
||||
extra += InspIRCd::Format(" (%susing account \x02%s\x02)", automatic ? "automatically " : "",
|
||||
extra += INSP_FORMAT(" ({}using account \x02{}\x02)", automatic ? "automatically " : "",
|
||||
u->oper->GetName().c_str());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, size_t m
|
||||
// Pad with spaces until its at max len, max_len must always be >= my names length
|
||||
buffer.append(max_len - current->GetName().length(), ' ');
|
||||
|
||||
buffer += InspIRCd::Format("%5zu [%5.2f%%]", current->UserCount, percent);
|
||||
buffer += INSP_FORMAT("{:5} [{:5.2}%]", current->UserCount, percent);
|
||||
|
||||
if (user->IsOper())
|
||||
{
|
||||
@ -219,8 +219,10 @@ CmdResult CommandMap::Handle(User* user, const Params& parameters)
|
||||
size_t totusers = ServerInstance->Users.GetUsers().size();
|
||||
float avg_users = (float) totusers / Utils->serverlist.size();
|
||||
|
||||
user->WriteRemoteNumeric(RPL_MAPUSERS, InspIRCd::Format("%u server%s and %u user%s, average %.2f users per server",
|
||||
(unsigned int)Utils->serverlist.size(), (Utils->serverlist.size() > 1 ? "s" : ""), (unsigned int)totusers, (totusers > 1 ? "s" : ""), avg_users));
|
||||
user->WriteRemoteNumeric(RPL_MAPUSERS, INSP_FORMAT("{} server{} and {} user{}, average {:.2} users per server",
|
||||
Utils->serverlist.size(), (Utils->serverlist.size() > 1 ? "s" : ""), totusers,
|
||||
(totusers > 1 ? "s" : ""), avg_users));
|
||||
|
||||
user->WriteRemoteNumeric(RPL_ENDMAP, "End of /MAP");
|
||||
|
||||
return CmdResult::SUCCESS;
|
||||
|
@ -42,7 +42,7 @@ CmdResult CommandRConnect::Handle(User* user, const Params& parameters)
|
||||
/* First see if the server which is being asked to connect to another server in fact exists */
|
||||
if (!Utils->FindServerMask(parameters[0]))
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** RCONNECT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** RCONNECT: Server \002{}\002 isn't connected to the network!", parameters[0]));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ CmdResult CommandRSQuit::Handle(User* user, const Params& parameters)
|
||||
server_target = Utils->FindServerMask(parameters[0]);
|
||||
if (!server_target)
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** RSQUIT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** RSQUIT: Server \002{}\002 isn't connected to the network!", parameters[0]));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
if (server_target->IsRoot())
|
||||
{
|
||||
user->WriteRemoteNotice(InspIRCd::Format("*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)", parameters[0].c_str()));
|
||||
user->WriteRemoteNotice(INSP_FORMAT("*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! ({} matches local server name)", parameters[0]));
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
|
@ -181,17 +181,17 @@ private:
|
||||
ssl_cert* cert = sslapi.GetCertificate(target);
|
||||
if (!cert)
|
||||
{
|
||||
source->WriteNotice(InspIRCd::Format("*** %s is not connected using TLS.", target->nick.c_str()));
|
||||
source->WriteNotice(INSP_FORMAT("*** {} is not connected using TLS.", target->nick));
|
||||
}
|
||||
else if (cert->GetError().length())
|
||||
{
|
||||
source->WriteNotice(InspIRCd::Format("*** %s is connected using TLS but has not specified a valid client certificate (%s).",
|
||||
target->nick.c_str(), cert->GetError().c_str()));
|
||||
source->WriteNotice(INSP_FORMAT("*** {} is connected using TLS but has not specified a valid client certificate ({}).",
|
||||
target->nick, cert->GetError()));
|
||||
}
|
||||
else if (!verbose)
|
||||
{
|
||||
source->WriteNotice(InspIRCd::Format("*** %s is connected using TLS with a valid client certificate (%s).",
|
||||
target->nick.c_str(), cert->GetFingerprint().c_str()));
|
||||
source->WriteNotice(INSP_FORMAT("*** {} is connected using TLS with a valid client certificate ({}).",
|
||||
target->nick, cert->GetFingerprint()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -243,9 +243,9 @@ private:
|
||||
|
||||
if (sslonlymode)
|
||||
{
|
||||
source->WriteNotice(InspIRCd::Format("*** %s %s have channel mode +%c (%s) set.",
|
||||
chan->name.c_str(), chan->IsModeSet(sslonlymode) ? "does" : "does not",
|
||||
sslonlymode->GetModeChar(), sslonlymode->name.c_str()));
|
||||
source->WriteNotice(INSP_FORMAT("*** {} {} have channel mode +{} ({}) set.",
|
||||
chan->name, chan->IsModeSet(sslonlymode) ? "does" : "does not",
|
||||
sslonlymode->GetModeChar(), sslonlymode->name));
|
||||
}
|
||||
|
||||
for (const auto& [u, _] : chan->GetUsers())
|
||||
@ -317,7 +317,7 @@ public:
|
||||
{
|
||||
whois.SendLine(RPL_WHOISSECURE, "is using a secure connection");
|
||||
if ((!cmd.operonlyfp || whois.IsSelfWhois() || whois.GetSource()->IsOper()) && !cert->fingerprint.empty())
|
||||
whois.SendLine(RPL_WHOISCERTFP, InspIRCd::Format("has TLS client certificate fingerprint %s", cert->fingerprint.c_str()));
|
||||
whois.SendLine(RPL_WHOISCERTFP, INSP_FORMAT("has TLS client certificate fingerprint {}", cert->fingerprint));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
|
||||
if (nonssl)
|
||||
{
|
||||
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, InspIRCd::Format("All members of the channel must be connected via TLS (%zu/%zu are non-TLS)",
|
||||
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, INSP_FORMAT("All members of the channel must be connected via TLS ({}/{} are non-TLS)",
|
||||
nonssl, channel->GetUsers().size()));
|
||||
return false;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
|
||||
if (rl)
|
||||
{
|
||||
user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Services reserved nickname: %s", rl->reason.c_str()));
|
||||
user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, INSP_FORMAT("Services reserved nickname: {}", rl->reason));
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,8 @@ public:
|
||||
|
||||
if (sendnotice)
|
||||
{
|
||||
const std::string message = InspIRCd::Format("Timed ban %s added by %s on %s lasting for %s.",
|
||||
mask.c_str(), user->nick.c_str(), channel->name.c_str(), Duration::ToString(duration).c_str());
|
||||
const std::string message = INSP_FORMAT("Timed ban {} added by {} on {} lasting for {}.",
|
||||
mask, user->nick, channel->name, Duration::ToString(duration));
|
||||
|
||||
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
|
||||
PrefixMode* mh = ServerInstance->Modes.FindNearestPrefixMode(HALFOP_VALUE);
|
||||
@ -256,8 +256,8 @@ public:
|
||||
{
|
||||
if (cmd.sendnotice)
|
||||
{
|
||||
const std::string message = InspIRCd::Format("Timed ban %s set by %s on %s has expired.",
|
||||
timedban.mask.c_str(), timedban.setter.c_str(), timedban.chan->name.c_str());
|
||||
const std::string message = INSP_FORMAT("Timed ban {} set by {} on {} has expired.",
|
||||
timedban.mask, timedban.setter, timedban.chan->name);
|
||||
|
||||
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
|
||||
PrefixMode* mh = ServerInstance->Modes.FindNearestPrefixMode(HALFOP_VALUE);
|
||||
|
@ -63,10 +63,11 @@ public:
|
||||
if (n_matched)
|
||||
{
|
||||
float p = (n_matched / (float)n_counted) * 100;
|
||||
user->WriteNotice(InspIRCd::Format("*** TLINE: Counted %lu user(s). Matched '%s' against %u user(s) (%0.2f%% of the userbase). %u by hostname and %u by IP address.", n_counted, parameters[0].c_str(), n_matched, p, n_match_host, n_match_ip));
|
||||
user->WriteNotice(INSP_FORMAT("*** TLINE: Counted {} user(s). Matched '{}' against {} user(s) ({:0.2}% of the userbase). {} by hostname and {} by IP address.",
|
||||
n_counted, parameters[0], n_matched, p, n_match_host, n_match_ip));
|
||||
}
|
||||
else
|
||||
user->WriteNotice(InspIRCd::Format("*** TLINE: Counted %lu user(s). Matched '%s' against no user(s).", n_counted, parameters[0].c_str()));
|
||||
user->WriteNotice(INSP_FORMAT("*** TLINE: Counted {} user(s). Matched '{}' against no user(s).", n_counted, parameters[0]));
|
||||
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
{
|
||||
Numeric::Numeric n(ERR_NOTINVITED);
|
||||
n.SetServer(user->server);
|
||||
n.push(u->nick).push(c->name).push(InspIRCd::Format("Is not invited to channel %s", c->name.c_str()));
|
||||
n.push(u->nick).push(c->name).push(INSP_FORMAT("Is not invited to channel {}", c->name));
|
||||
user->WriteRemoteNumeric(n);
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
@ -105,8 +105,8 @@ public:
|
||||
n.push(c->name).push(u->nick).push("Uninvited");
|
||||
user->WriteRemoteNumeric(n);
|
||||
|
||||
lu->WriteNumeric(RPL_UNINVITED, InspIRCd::Format("You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()));
|
||||
c->WriteRemoteNotice(InspIRCd::Format("*** %s uninvited %s.", user->nick.c_str(), u->nick.c_str()));
|
||||
lu->WriteNumeric(RPL_UNINVITED, INSP_FORMAT("You were uninvited from {} by {}", c->name, user->nick));
|
||||
c->WriteRemoteNotice(INSP_FORMAT("*** {} uninvited {}.", user->nick, u->nick));
|
||||
}
|
||||
|
||||
return CmdResult::SUCCESS;
|
||||
|
@ -113,7 +113,7 @@ class CommandWatch final
|
||||
|
||||
// Do not show how many clients are watching this nick, it's pointless
|
||||
const IRCv3::Monitor::WatchedList& list = manager.GetWatched(user);
|
||||
user->WriteNumeric(RPL_WATCHSTAT, InspIRCd::Format("You have %lu and are on 0 WATCH entries", (unsigned long)list.size()));
|
||||
user->WriteNumeric(RPL_WATCHSTAT, INSP_FORMAT("You have {} and are on 0 WATCH entries", list.size()));
|
||||
|
||||
Numeric::Builder<' '> out(user, RPL_WATCHLIST);
|
||||
for (const auto* entry : list)
|
||||
|
@ -129,7 +129,7 @@ void Snomask::Flush()
|
||||
void Snomask::Send(char letter, const std::string& desc, const std::string& msg)
|
||||
{
|
||||
ServerInstance->Logs.Normal(desc, msg);
|
||||
const std::string finalmsg = InspIRCd::Format("*** %s: %s", desc.c_str(), msg.c_str());
|
||||
const std::string finalmsg = INSP_FORMAT("*** {}: {}", desc, msg);
|
||||
|
||||
/* Only opers can receive snotices, so we iterate the oper list */
|
||||
for (auto* user : ServerInstance->Users.all_opers)
|
||||
@ -148,6 +148,6 @@ std::string Snomask::GetDescription(char letter) const
|
||||
if (!Description.empty())
|
||||
ret += Description;
|
||||
else
|
||||
ret += InspIRCd::Format("SNO-%c", tolower(letter));
|
||||
ret += INSP_FORMAT("SNO-{}", tolower(letter));
|
||||
return ret;
|
||||
}
|
||||
|
@ -327,13 +327,13 @@ std::string irc::sockets::sockaddrs::str() const
|
||||
char ip4addr[INET_ADDRSTRLEN];
|
||||
if (!inet_ntop(AF_INET, static_cast<const void*>(&in4.sin_addr), ip4addr, sizeof(ip4addr)))
|
||||
strcpy(ip4addr, "0.0.0.0");
|
||||
return InspIRCd::Format("%s:%u", ip4addr, ntohs(in4.sin_port));
|
||||
return INSP_FORMAT("{}:{}", ip4addr, ntohs(in4.sin_port));
|
||||
|
||||
case AF_INET6:
|
||||
char ip6addr[INET6_ADDRSTRLEN];
|
||||
if (!inet_ntop(AF_INET6, static_cast<const void*>(&in6.sin6_addr), ip6addr, sizeof(ip6addr)))
|
||||
strcpy(ip6addr, "0:0:0:0:0:0:0:0");
|
||||
return InspIRCd::Format("[%s]:%u", ip6addr, ntohs(in6.sin6_port));
|
||||
return INSP_FORMAT("[{}]:{}", ip6addr, ntohs(in6.sin6_port));
|
||||
|
||||
case AF_UNIX:
|
||||
return un.sun_path;
|
||||
|
@ -164,7 +164,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, const irc::sockets::soc
|
||||
const char* hooktype = i == via->iohookprovs.begin() ? "hook" : "sslprofile";
|
||||
ServerInstance->Logs.Warning("USERS", "Non-existent I/O hook '%s' in <bind:%s> tag at %s",
|
||||
iohookprovref.GetProvider().c_str(), hooktype, via->bind_tag->source.str().c_str());
|
||||
this->QuitUser(New, InspIRCd::Format("Internal error handling connection (misconfigured %s)", hooktype));
|
||||
this->QuitUser(New, INSP_FORMAT("Internal error handling connection (misconfigured {})", hooktype));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std
|
||||
ServerInstance->Logs.Debug("USERS", "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitmessage.c_str());
|
||||
if (localuser)
|
||||
{
|
||||
ClientProtocol::Messages::Error errormsg(InspIRCd::Format("Closing link: (%s) [%s]", user->MakeHost().c_str(), operquitmsg.c_str()));
|
||||
ClientProtocol::Messages::Error errormsg(INSP_FORMAT("Closing link: ({}) [{}]", user->MakeHost(), operquitmsg));
|
||||
localuser->Send(ServerInstance->GetRFCEvents().error, errormsg);
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user