Merge branch 'insp4' into master.

This commit is contained in:
Sadie Powell 2025-03-01 16:24:05 +00:00
commit a27defd72f
64 changed files with 141 additions and 105 deletions

View File

@ -1706,7 +1706,7 @@
#<module name="operlog">
#
# If the following option is on then all oper commands will be sent to
# the snomask 'r'. The default is no.
# the snomask 'o'. The default is no.
#<operlog tosnomask="no">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012-2013, 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013, 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2022-2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2020, 2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2020, 2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2019 iwalkalone <iwalkalone69@gmail.com>
* Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012-2013, 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013, 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2008 Thomas Stagner <aquanight@gmail.com>

View File

@ -139,7 +139,7 @@ public:
* @param error The error which occurred whilst compiling the regular expression.
*/
Exception(const Module* mod, const std::string& regex, const std::string& error)
: ModuleException(mod, "Error in regex '" + regex + "': " + error)
: ModuleException(mod, FMT::format("Error in regex '{}': {}", regex, error))
{
}
@ -150,7 +150,7 @@ public:
* @param offset The offset at which the errror occurred.
*/
Exception(const Module* mod, const std::string& regex, const std::string& error, size_t offset)
: ModuleException(mod, "Error in regex '" + regex + "' at offset " + ConvToStr(offset) + ": " + error)
: ModuleException(mod, FMT::format("Error in regex '{}' at offset {}: {}", regex, offset, error))
{
}
};

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018-2022, 2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018-2022, 2024-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2023-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2023-2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
@ -29,9 +29,10 @@ namespace Duration
* seconds. If called with this duration 33,019,565 will be returned.
*
* @param str A string containing a duration.
* @param base The base time to use for leap year calculation.
* @return Either the number of seconds in the duration or 0 on error.
*/
CoreExport unsigned long From(const std::string& str);
CoreExport unsigned long From(const std::string& str, time_t base = 0);
/** Determines whether a duration string is valid.
* @param str The duration string to check.
@ -40,7 +41,7 @@ namespace Duration
/** Converts a number of seconds to a duration string.
*
* e.g. 33,019,565 weill result in 1y2w3d4h6m5s which represents one year,
* e.g. 33,019,565 will result in 1y2w3d4h6m5s which represents one year,
* two weeks, three days, four hours, six minutes, and five seconds.
*/
CoreExport std::string ToString(unsigned long duration);
@ -54,9 +55,10 @@ namespace Duration
*
* @param str A string containing a duration.
* @param duration The location to store the resulting duration.
* @param base The base time to use for leap year calculation.
* @return True if the conversion succeeded; otherwise, false.
*/
CoreExport bool TryFrom(const std::string& str, unsigned long& duration);
CoreExport bool TryFrom(const std::string& str, unsigned long& duration, time_t base = 0);
}
namespace Time

View File

@ -1,9 +1,9 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2019-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
* Copyright (C) 2007 Craig Edwards <brain@inspircd.org>

View File

@ -4,10 +4,9 @@
* Copyright (C) 2020 Michael <michaelhazell@hotmail.com>
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2013, 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2018-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2012, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2009 John Brooks <john@jbrooks.io>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
* Copyright (C) 2006 Craig Edwards <brain@inspircd.org>

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019-2021, 2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2019-2021, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>

View File

@ -281,9 +281,9 @@ public:
if ((prefixmsg) && (!batchcap.IsEnabled(localuser)))
{
std::string message("Replaying up to " + ConvToStr(list->maxlen) + " lines of pre-join history");
auto message = FMT::format("Replaying up to {} lines of pre-join history", list->maxlen);
if (list->maxtime > 0)
message.append(" from the last " + Duration::ToString(list->maxtime));
message += FMT::format(" from the last {}", Duration::ToString(list->maxtime));
memb->WriteNotice(message);
}

View File

@ -311,7 +311,7 @@ public:
// Ensure that we have the <cloak:key> parameter.
const std::string key = tag->getString("key");
if (key.length() < minkeylen)
throw ModuleException(creator, "Your cloak key should be at least " + ConvToStr(minkeylen) + " characters long, at " + tag->source.str());
throw ModuleException(creator, FMT::format("Your cloak key should be at least {} characters long, at {}", minkeylen, tag->source.str()));
psl_ctx_t* psl = nullptr;
std::string psldb = tag->getString("psl");

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2017-2018, 2020, 2022-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017-2018, 2020, 2022-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
* Copyright (C) 2013-2014, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2020, 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2020, 2022-2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2015, 2018-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2015, 2018-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2014-2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013, 2015-2016, 2021 Adam <Adam@anope.org>
*

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2013, 2018-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2018-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2016 Adam <Adam@anope.org>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018, 2020, 2022-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020, 2022-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2014, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2021 Herman <GermanAizek@yandex.ru>
* Copyright (C) 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014, 2016, 2018 Attila Molnar <attilamolnar@hush.com>
*

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2014, 2016 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2020-2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public

View File

@ -1,8 +1,8 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2018-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018, 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018, 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018, 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018, 2020, 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020, 2022-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018, 2020, 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020, 2022-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>

View File

@ -4,7 +4,7 @@
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2020 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018-2019 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2016 Adam <Adam@anope.org>
* Copyright (C) 2013, 2015-2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
@ -657,9 +657,9 @@ public:
dnsbl->name, dnsbl->stats_hits, dnsbl->stats_misses, dnsbl->stats_errors));
}
stats.AddGenericRow("Total DNSBL hits: " + ConvToStr(total_hits));
stats.AddGenericRow("Total DNSBL misses: " + ConvToStr(total_misses));
stats.AddGenericRow("Total DNSBL errors: " + ConvToStr(total_errors));
stats.AddGenericRow(FMT::format("Total DNSBL hits: {}", total_hits));
stats.AddGenericRow(FMT::format("Total DNSBL misses: {}", total_misses));
stats.AddGenericRow(FMT::format("Total DNSBL errors: {}", total_errors));
return MOD_RES_DENY;
}
};

View File

@ -4,7 +4,7 @@
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2015 Daniel Vassdal <shutter@canternet.org>
* Copyright (C) 2013-2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013, 2016-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2016-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2024 Larry Williamson <l422y@l422y.com>
* Copyright (C) 2015 Daniel Vassdal <shutter@canternet.org>
* Copyright (C) 2013, 2016-2017, 2019-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2016-2017, 2019-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2015 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Daniel Vassdal <shutter@canternet.org>
* Copyright (C) 2014, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013-2014, 2016-2017, 2019-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014, 2016-2017, 2019-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
* Copyright (C) 2012 Adam <Adam@anope.org>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2020 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2013-2014, 2016-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014, 2016-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
* Copyright (C) 2012-2017 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012-2013, 2016 Adam <Adam@anope.org>
@ -261,7 +261,8 @@ namespace GnuTLS
if (ret < 0)
{
// gnutls did not understand the user supplied string
throw Exception("Unable to initialize priorities to \"" + priorities + "\": " + gnutls_strerror(ret) + " Syntax error at position " + ConvToStr((unsigned int) (prioerror - priocstr)));
throw Exception(FMT::format("Unable to initialize priorities to \"{}\": {} Syntax error at position {}.",
priorities, gnutls_strerror(ret), static_cast<size_t>(prioerror - priocstr)));
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2020 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2017, 2023 Wade Cline <wadecline@hotmail.com>
* Copyright (C) 2014, 2016-2017, 2019-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2014, 2016-2017, 2019-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2014 Julien Vehent <julien@linuxwall.info>
* Copyright (C) 2012-2017 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>

View File

@ -8,7 +8,7 @@
* Copyright (C) 2018 Michael Hazell <michaelhazell@hotmail.com>
* Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
* Copyright (C) 2012-2014, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012-2013, 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013, 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012, 2018-2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2011 Adam <Adam@anope.org>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
@ -989,7 +989,7 @@ bool ModuleFilter::WriteDatabase()
return true;
}
const std::string newfilterconf = filterconf + ".new." + ConvToStr(ServerInstance->Time());
const auto newfilterconf = FMT::format("{}.new.{}", filterconf, ServerInstance->Time());
std::ofstream stream(newfilterconf.c_str());
if (!stream.is_open()) // Filesystem probably not writable.
{

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2016 Johanna A
* Copyright (C) 2013, 2020-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2020-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2015 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2013, 2018-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2018-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013 Robby <robby@chatbelgie.be>
* Copyright (C) 2012, 2014-2015 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -67,7 +67,8 @@ public:
{
if (!IsValid())
return "";
return ConvToStr(this->iterations) + ":" + Base64::Encode(this->hash) + ":" + Base64::Encode(this->salt);
return FMT::format("{}:{}:{}", this->iterations, Base64::Encode(this->hash), Base64::Encode(this->salt));
}
bool IsValid() const

View File

@ -74,7 +74,7 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes)
if (permchannelsconf.empty())
return true;
const std::string permchannelsnewconf = permchannelsconf + ".new." + ConvToStr(ServerInstance->Time());
const auto permchannelsnewconf = FMT::format("{}.new.{}", permchannelsconf, ServerInstance->Time());
std::ofstream stream(permchannelsnewconf);
if (!stream.is_open())
{

View File

@ -1,11 +1,12 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2025 iwalkalone <iwalkalone@chathispano.com>
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2021 David Schultz <me@zpld.me>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2018 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
*

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2013, 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2018-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2013, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019-2021, 2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2019-2021, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2007-2008 Craig Edwards <brain@inspircd.org>

View File

@ -61,7 +61,7 @@ public:
if (user->signon > user->idle_lastmsg)
user->signon = user->idle_lastmsg;
ServerInstance->SNO.WriteToSnoMask('a', user->nick+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
ServerInstance->SNO.WriteToSnoMask('a', "{} used SETIDLE to set their idle time to {} seconds", user->nick, idle);
noterpl.SendIfCap(user, stdrplcap, this, "IDLE_TIME_SET", user->idle_lastmsg, "Idle time set.");
return CmdResult::SUCCESS;
}

View File

@ -314,7 +314,7 @@ void TreeSocket::SendCapabilities(int phase)
return;
if (capab->capab_phase < 1 && phase >= 1)
WriteLine("CAPAB START " + ConvToStr(PROTO_NEWEST));
WriteLine(FMT::format("CAPAB START {}", (uint16_t)PROTO_NEWEST));
capab->capab_phase = phase;
if (phase < 2)

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018, 2020, 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018, 2020, 2022-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014, 2016 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -100,7 +100,10 @@ static std::vector<std::string> GetMap(User* user, TreeServer* current, size_t m
if (user->IsOper())
{
time_t secs_up = ServerInstance->Time() - current->age;
buffer += " [Up: " + Duration::ToString(secs_up) + (current->rtt == 0 ? "]" : " Lag: " + ConvToStr(current->rtt) + "ms]");
buffer += FMT::format(" [Up: {}", Duration::ToString(secs_up));
if (current->rtt)
buffer += FMT::format(" Lag: {}ms", current->rtt);
buffer += "]";
}
std::vector<std::string> map;

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018-2020, 2022-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018-2020, 2022-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
* Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
*

View File

@ -161,11 +161,11 @@ void TreeSocket::ProcessLine(std::string& line)
if (!params.empty())
{
time_t them = ServerCommand::ExtractTS(params[0]);
time_t delta = them - ServerInstance->Time();
if ((delta < -15) || (delta > 15))
time_t delta = std::abs(them - ServerInstance->Time());
if (delta > 15)
{
ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", labs((long)delta));
SendError("Your clocks are out by "+ConvToStr(labs((long)delta))+" seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!");
ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", delta);
SendError(FMT::format("Your clocks are out by {} seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", delta));
return;
}
else if ((delta < -5) || (delta > 5))

View File

@ -301,7 +301,7 @@ void SpanningTreeUtilities::ReadConfiguration()
throw ModuleException((Module*)Creator, "The link name '"+L->Name+"' is invalid as it must contain at least one '.' character");
if (L->Name.length() > ServerInstance->Config->Limits.MaxHost)
throw ModuleException((Module*)Creator, "The link name '"+L->Name+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters");
throw ModuleException((Module*)Creator, FMT::format("The link name '{}' is invalid as it is longer than {} characters", L->Name, ServerInstance->Config->Limits.MaxHost));
if (L->RecvPass.empty())
throw ModuleException((Module*)Creator, "Invalid configuration for server '"+L->Name+"', recvpass not defined");

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2021 Dominic Hamon
* Copyright (C) 2019 iwalkalone <iwalkalone69@gmail.com>
* Copyright (C) 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2018-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2016 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -124,7 +124,7 @@ public:
* -- w00t
*/
ServerInstance->Logs.Debug(MODNAME, "Opening temporary database");
const std::string xlinenewdbpath = xlinedbpath + ".new." + ConvToStr(ServerInstance->Time());
const auto xlinenewdbpath = FMT::format("{}.new.{}", xlinedbpath, ServerInstance->Time());
std::ofstream stream(xlinenewdbpath);
if (!stream.is_open())
{

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2021-2022 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2021-2022, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012-2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2013-2016, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013, 2016-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2016-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Adam <Adam@anope.org>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>

View File

@ -348,7 +348,7 @@ FilePosition::FilePosition(const std::string& Name, unsigned long Line, unsigned
std::string FilePosition::str() const
{
return name + ":" + ConvToStr(line) + ":" + ConvToStr(column);
return FMT::format("{}:{}:{}", name, line, column);
}
void ParseStack::DoInclude(const std::shared_ptr<ConfigTag>& tag, int flags)
@ -588,7 +588,7 @@ std::string ConfigTag::getString(const std::string& key, const std::string& def,
if (res.length() < minlen || res.length() > maxlen)
{
LogMalformed(key, res, def, "not between " + ConvToStr(minlen) + " and " + ConvToStr(maxlen) + " characters in length");
LogMalformed(key, res, def, FMT::format("not between {} and {} characters in length", minlen, maxlen));
return def;
}
return res;
@ -629,7 +629,7 @@ namespace
default:
num = def;
tag->LogMalformed(key, val, ConvToStr(def), "contains an invalid magnitude specifier (" + ConvToStr(*tail) +")");
tag->LogMalformed(key, val, ConvToStr(def), FMT::format("contains an invalid magnitude specifier ({})", *tail));
return;
}
}
@ -649,7 +649,7 @@ namespace
if (num >= min && num <= max)
return;
tag->LogMalformed(key, ConvToStr(num), ConvToStr(def), "not between " + ConvToStr(min) + " and " + ConvToStr(max));
tag->LogMalformed(key, ConvToStr(num), ConvToStr(def), FMT::format("not between {} and {}", min, max));
num = def;
}
}

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2013-2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013-2014, 2016-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014, 2016-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
@ -283,7 +283,7 @@ void ServerConfig::CrossCheckConnectBlocks(const std::unique_ptr<ServerConfig>&
throw CoreException("Connect class must have allow, deny, or name specified at " + tag->source.str());
if (name.empty())
name = "unnamed-" + ConvToStr(i);
name = FMT::format("unnamed-{}", i);
if (names.find(name) != names.end())
throw CoreException("Two connect classes with name \"" + name + "\" defined!");

View File

@ -4,7 +4,7 @@
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2012-2013 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2014, 2017-2018, 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012, 2014, 2017-2018, 2020-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
@ -357,6 +357,21 @@ bool InspIRCd::IsSID(const std::string_view& str)
((str[2] >= 'A' && str[2] <= 'Z') || isdigit(str[2])));
}
namespace
{
constexpr const auto SECONDS_PER_MINUTE = 60;
constexpr const auto SECONDS_PER_HOUR = SECONDS_PER_MINUTE * 60;
constexpr const auto SECONDS_PER_DAY = SECONDS_PER_HOUR * 24;
constexpr const auto SECONDS_PER_WEEK = SECONDS_PER_DAY * 7;
constexpr const auto SECONDS_PER_YEAR = (SECONDS_PER_DAY * 365);
constexpr const auto SECONDS_PER_AVG_YEAR = SECONDS_PER_YEAR + (SECONDS_PER_HOUR * 6);
}
/** A lookup table of values for multiplier characters used by
* Duration::{Try,}From(). In this lookup table, the indexes for
* the ascii values 'm' and 'M' have the value '60', the indexes
@ -368,10 +383,10 @@ static constexpr unsigned int duration_multi[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 86400, 0, 0, 0, 3600, 0, 0, 0, 0, 60, 0, 0,
0, 0, 0, 1, 0, 0, 0, 604800, 0, 31557600, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 86400, 0, 0, 0, 3600, 0, 0, 0, 0, 60, 0, 0,
0, 0, 0, 1, 0, 0, 0, 604800, 0, 31557600, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, SECONDS_PER_DAY, 0, 0, 0, SECONDS_PER_HOUR, 0, 0, 0, 0, SECONDS_PER_MINUTE, 0, 0,
0, 0, 0, 1, 0, 0, 0, SECONDS_PER_WEEK, 0, SECONDS_PER_AVG_YEAR, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, SECONDS_PER_DAY, 0, 0, 0, SECONDS_PER_HOUR, 0, 0, 0, 0, SECONDS_PER_MINUTE, 0, 0,
0, 0, 0, 1, 0, 0, 0, SECONDS_PER_WEEK, 0, SECONDS_PER_AVG_YEAR, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -382,7 +397,7 @@ static constexpr unsigned int duration_multi[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
bool Duration::TryFrom(const std::string& str, unsigned long& duration)
bool Duration::TryFrom(const std::string& str, unsigned long& duration, time_t base)
{
unsigned long total = 0;
unsigned long subtotal = 0;
@ -416,10 +431,10 @@ bool Duration::TryFrom(const std::string& str, unsigned long& duration)
return true;
}
unsigned long Duration::From(const std::string& str)
unsigned long Duration::From(const std::string& str, time_t base)
{
unsigned long out = 0;
Duration::TryFrom(str, out);
Duration::TryFrom(str, out, base);
return out;
}
@ -443,29 +458,43 @@ std::string Duration::ToString(unsigned long duration)
std::string ret;
unsigned long years = duration / 31449600;
const auto years = (duration / SECONDS_PER_YEAR);
if (years)
ret += ConvToStr(years) + "y";
{
ret = FMT::format("{}y", years);
duration -= (years * SECONDS_PER_YEAR);
}
unsigned long weeks = (duration / 604800) % 52;
const auto weeks = (duration / SECONDS_PER_WEEK);
if (weeks)
ret += ConvToStr(weeks) + "w";
{
ret += FMT::format("{}w", weeks);
duration -= (weeks * SECONDS_PER_WEEK);
}
unsigned long days = (duration / 86400) % 7;
const auto days = (duration / SECONDS_PER_DAY);
if (days)
ret += ConvToStr(days) + "d";
{
ret += FMT::format("{}d", days);
duration -= (days * SECONDS_PER_DAY);
}
unsigned long hours = (duration / 3600) % 24;
const auto hours = (duration / SECONDS_PER_HOUR);
if (hours)
ret += ConvToStr(hours) + "h";
{
ret += FMT::format("{}h", hours);
duration -= (hours * SECONDS_PER_HOUR);
}
unsigned long minutes = (duration / 60) % 60;
const auto minutes = (duration / SECONDS_PER_MINUTE);
if (minutes)
ret += ConvToStr(minutes) + "m";
{
ret += FMT::format("{}m", minutes);
duration -= (minutes * SECONDS_PER_MINUTE);
}
unsigned long seconds = duration % 60;
if (seconds)
ret += ConvToStr(seconds) + "s";
if (duration)
ret += FMT::format("{}s", duration);
return ret;
}

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2018 Chris Novakovic
* Copyright (C) 2013, 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Adam <Adam@anope.org>
* Copyright (C) 2012-2014, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012-2013 ChrisTX <xpipe@hotmail.de>

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2018 B00mX0r <b00mx0r@aureus.pw>
* Copyright (C) 2017-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2017-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2022-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2022-2025 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public

View File

@ -1,7 +1,7 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2020-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2020-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013-2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>

View File

@ -100,7 +100,7 @@ void Snomask::Flush()
if (Count > 1)
{
std::string desc = GetDescription(LastLetter);
std::string msg = "(last message repeated " + ConvToStr(Count) + " times)";
std::string msg = FMT::format("(last message repeated {} times)", Count);
FOREACH_MOD(OnSendSnotice, (LastLetter, desc, msg));
Snomask::Send(LastLetter, desc, msg);

View File

@ -120,7 +120,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
// Check if the port is out of range.
if (port <= std::numeric_limits<in_port_t>::min() || port > std::numeric_limits<in_port_t>::max())
{
failed_ports.emplace_back("Port is not valid: " + ConvToStr(port), bindspec, tag);
failed_ports.emplace_back(FMT::format("Port is not valid: {}", port), bindspec, tag);
continue;
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2019 iwalkalone <iwalkalone69@gmail.com>
* Copyright (C) 2013-2016, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2013, 2018-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2018-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2015 Adam <Adam@anope.org>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
@ -65,7 +65,7 @@ namespace
if (!user->lastping)
{
time_t secs = ServerInstance->Time() - (user->nextping - user->GetClass()->pingtime);
const std::string message = "Ping timeout: " + ConvToStr(secs) + (secs != 1 ? " seconds" : " second");
const std::string message = FMT::format("Ping timeout: {} {}", secs, (secs != 1 ? "seconds" : "second"));
ServerInstance->Users.QuitUser(user, message);
return;
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2019 linuxdaemon <linuxdaemon.irc@gmail.com>
* Copyright (C) 2018 systocrat <systocrat@outlook.com>
* Copyright (C) 2018 Dylan Frank <b00mx0r@aureus.pw>
* Copyright (C) 2013, 2017-2024 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2017-2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Adam <Adam@anope.org>
* Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012 Robby <robby@chatbelgie.be>

View File

@ -2,7 +2,7 @@
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
* Copyright (C) 2013, 2017-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013, 2017-2023, 2025 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Adam <Adam@anope.org>
* Copyright (C) 2012-2014, 2016 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>