aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-24 23:41:50 +0000
committerGravatar Sadie Powell2023-01-25 00:39:27 +0000
commitaf8effe4f0876d6fa934806745712f679bd36278 (patch)
treeb0d6de94d60dc5e116faa5e14b6029fb1c527886 /src
parentFix using (unsigned) long instead of (s)size_t. (diff)
Replace getInt/getUInt/getFloat with type safe templated functions.
Diffstat (limited to 'src')
-rw-r--r--src/configparser.cpp13
-rw-r--r--src/configreader.cpp34
-rw-r--r--src/coremods/core_channel/core_channel.cpp4
-rw-r--r--src/coremods/core_dns.cpp2
-rw-r--r--src/coremods/core_whowas.cpp4
-rw-r--r--src/coremods/core_xline/core_xline.cpp2
-rw-r--r--src/listmode.cpp2
-rw-r--r--src/logging.cpp2
-rw-r--r--src/modules/extra/m_argon2.cpp38
-rw-r--r--src/modules/extra/m_log_json.cpp2
-rw-r--r--src/modules/extra/m_mysql.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp4
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp8
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp6
-rw-r--r--src/modules/m_bcrypt.cpp2
-rw-r--r--src/modules/m_callerid.cpp2
-rw-r--r--src/modules/m_chanfilter.cpp2
-rw-r--r--src/modules/m_chanhistory.cpp2
-rw-r--r--src/modules/m_cloak_md5.cpp2
-rw-r--r--src/modules/m_cloak_sha256.cpp4
-rw-r--r--src/modules/m_codepage.cpp8
-rw-r--r--src/modules/m_connectban.cpp6
-rw-r--r--src/modules/m_connflood.cpp2
-rw-r--r--src/modules/m_customprefix.cpp12
-rw-r--r--src/modules/m_dccallow.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp2
-rw-r--r--src/modules/m_hidelist.cpp2
-rw-r--r--src/modules/m_hidemode.cpp6
-rw-r--r--src/modules/m_ircv3_sts.cpp2
-rw-r--r--src/modules/m_messageflood.cpp6
-rw-r--r--src/modules/m_monitor.cpp2
-rw-r--r--src/modules/m_operlevels.cpp4
-rw-r--r--src/modules/m_pbkdf2.cpp8
-rw-r--r--src/modules/m_permchannels.cpp4
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_repeat.cpp8
-rw-r--r--src/modules/m_securelist.cpp2
-rw-r--r--src/modules/m_showfile.cpp6
-rw-r--r--src/modules/m_silence.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_watch.cpp2
-rw-r--r--src/users.cpp18
42 files changed, 115 insertions, 130 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 89fc33f6e..ee98c776d 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -22,6 +22,7 @@
*/
+#include <cinttypes>
#include <filesystem>
#include <fstream>
@@ -655,7 +656,7 @@ namespace
}
}
-long ConfigTag::getInt(const std::string& key, long def, long min, long max) const
+intmax_t ConfigTag::getSInt(const std::string& key, intmax_t def, intmax_t min, intmax_t max) const
{
std::string result;
if(!readString(key, result) || result.empty())
@@ -663,7 +664,7 @@ long ConfigTag::getInt(const std::string& key, long def, long min, long max) con
const char* res_cstr = result.c_str();
char* res_tail = nullptr;
- long res = strtol(res_cstr, &res_tail, 0);
+ intmax_t res = strtoimax(res_cstr, &res_tail, 0);
if (res_tail == res_cstr)
return def;
@@ -672,7 +673,7 @@ long ConfigTag::getInt(const std::string& key, long def, long min, long max) con
return res;
}
-unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsigned long min, unsigned long max) const
+uintmax_t ConfigTag::getUInt(const std::string& key, uintmax_t def, uintmax_t min, uintmax_t max) const
{
std::string result;
if (!readString(key, result) || result.empty())
@@ -680,7 +681,7 @@ unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsi
const char* res_cstr = result.c_str();
char* res_tail = nullptr;
- unsigned long res = strtoul(res_cstr, &res_tail, 0);
+ uintmax_t res = strtoumax(res_cstr, &res_tail, 0);
if (res_tail == res_cstr)
return def;
@@ -706,13 +707,13 @@ unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def,
return ret;
}
-double ConfigTag::getFloat(const std::string& key, double def, double min, double max) const
+long double ConfigTag::getFloat(const std::string& key, long double def, long double min, long double max) const
{
std::string result;
if (!readString(key, result))
return def;
- double res = strtod(result.c_str(), nullptr);
+ long double res = strtold(result.c_str(), nullptr);
CheckRange(this, key, res, def, min, max);
return res;
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 0a9256005..d7d6d2c93 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -41,17 +41,17 @@
#include "exitcodes.h"
ServerLimits::ServerLimits(const std::shared_ptr<ConfigTag>& tag)
- : MaxLine(tag->getUInt("maxline", 512, 512))
- , MaxNick(tag->getUInt("maxnick", 30, 1, MaxLine))
- , MaxChannel(tag->getUInt("maxchan", 60, 1, MaxLine))
- , MaxModes(tag->getUInt("maxmodes", 20, 1))
- , MaxUser(tag->getUInt("maxident", 10, 1))
- , MaxQuit(tag->getUInt("maxquit", 300, 0, MaxLine))
- , MaxTopic(tag->getUInt("maxtopic", 330, 1, MaxLine))
- , MaxKick(tag->getUInt("maxkick", 300, 1, MaxLine))
- , MaxReal(tag->getUInt("maxreal", 130, 1, MaxLine))
- , MaxAway(tag->getUInt("maxaway", 200, 1, MaxLine))
- , MaxHost(tag->getUInt("maxhost", 64, 1, MaxLine))
+ : MaxLine(tag->getNum<size_t>("maxline", 512, 512))
+ , MaxNick(tag->getNum<size_t>("maxnick", 30, 1, MaxLine))
+ , MaxChannel(tag->getNum<size_t>("maxchan", 60, 1, MaxLine))
+ , MaxModes(tag->getNum<size_t>("maxmodes", 20, 1))
+ , MaxUser(tag->getNum<size_t>("maxident", 10, 1))
+ , MaxQuit(tag->getNum<size_t>("maxquit", 300, 0, MaxLine))
+ , MaxTopic(tag->getNum<size_t>("maxtopic", 330, 1, MaxLine))
+ , MaxKick(tag->getNum<size_t>("maxkick", 300, 1, MaxLine))
+ , MaxReal(tag->getNum<size_t>("maxreal", 130, 1, MaxLine))
+ , MaxAway(tag->getNum<size_t>("maxaway", 200, 1, MaxLine))
+ , MaxHost(tag->getNum<size_t>("maxhost", 64, 1, MaxLine))
{
}
@@ -298,22 +298,22 @@ void ServerConfig::Fill()
if (!nsid.empty() && nsid != sid)
throw CoreException("You must restart to change the server id");
}
- SoftLimit = ConfValue("performance")->getUInt("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : LONG_MAX), 10);
- MaxConn = static_cast<int>(ConfValue("performance")->getUInt("somaxconn", SOMAXCONN));
+ SoftLimit = ConfValue("performance")->getNum<size_t>("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : SIZE_MAX), 10);
+ MaxConn = ConfValue("performance")->getNum<int>("somaxconn", SOMAXCONN, 1);
TimeSkipWarn = ConfValue("performance")->getDuration("timeskipwarn", 2, 0, 30);
XLineMessage = options->getString("xlinemessage", "You're banned!", 1);
ServerDesc = server->getString("description", "Configure Me", 1);
Network = server->getString("network", "Network", 1);
- NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534);
+ NetBufferSize = ConfValue("performance")->getNum<size_t>("netbuffersize", 10240, 1024, 65534);
CustomVersion = security->getString("customversion");
HideBans = security->getBool("hidebans");
HideServer = security->getString("hideserver", "", InspIRCd::IsFQDN);
SyntaxHints = options->getBool("syntaxhints");
FullHostInTopic = options->getBool("hostintopic");
- MaxTargets = security->getUInt("maxtargets", 20, 1, 31);
+ MaxTargets = security->getNum<unsigned long>("maxtargets", 5, 1, 50);
DefaultModes = options->getString("defaultmodes", "not");
- c_ipv4_range = ConfValue("cidr")->getUInt("ipv4clone", 32, 1, 32);
- c_ipv6_range = ConfValue("cidr")->getUInt("ipv6clone", 128, 1, 128);
+ c_ipv4_range = ConfValue("cidr")->getNum<unsigned char>("ipv4clone", 32, 1, 32);
+ c_ipv6_range = ConfValue("cidr")->getNum<unsigned char>("ipv6clone", 128, 1, 128);
Limits = ServerLimits(ConfValue("limits"));
Paths = ServerPaths(ConfValue("path"));
NoSnoticeStack = options->getBool("nosnoticestack", false);
diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp
index 999df0c05..b261a1c0e 100644
--- a/src/coremods/core_channel/core_channel.cpp
+++ b/src/coremods/core_channel/core_channel.cpp
@@ -215,7 +215,7 @@ public:
ServerInstance->Modules.Detach(events, this, sizeof(events)/sizeof(Implementation));
const auto& limitstag = ServerInstance->Config->ConfValue("limits");
- keymode.maxkeylen = limitstag->getUInt("maxkey", 32, 1, ModeParser::MODE_PARAM_MAX);
+ keymode.maxkeylen = limitstag->getNum<size_t>("maxkey", 32, 1, ModeParser::MODE_PARAM_MAX);
}
void OnBuildISupport(ISupport::TokenMap& tokens) override
@@ -258,7 +258,7 @@ public:
*/
unsigned long maxchans = user->GetClass()->maxchans;
if (user->IsOper())
- maxchans = user->oper->GetConfig()->getUInt("maxchans", maxchans, maxchans);
+ maxchans = user->oper->GetConfig()->getNum<unsigned long>("maxchans", maxchans, maxchans);
if (user->chans.size() >= maxchans)
{
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index d1188cbd4..7d6fc1a78 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -919,7 +919,7 @@ public:
SourceIP = tag->getString("sourceip");
const in_port_t oldport = SourcePort;
- SourcePort = static_cast<in_port_t>(tag->getUInt("sourceport", 0, 0, 65535));
+ SourcePort = tag->getNum<in_port_t>("sourceport", 0);
if (DNSServer.empty())
FindDNSServer();
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index 21ada0af5..0f49bd303 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -448,8 +448,8 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& tag = ServerInstance->Config->ConfValue("whowas");
- unsigned int NewGroupSize = static_cast<unsigned int>(tag->getUInt("groupsize", 10, 0, 10000));
- unsigned int NewMaxGroups = static_cast<unsigned int>(tag->getUInt("maxgroups", 10240, 0, 1000000));
+ unsigned int NewGroupSize = tag->getNum<unsigned int>("groupsize", 10, 0, 10000);
+ unsigned int NewMaxGroups = tag->getNum<unsigned int>("maxgroups", 10240, 0, 1000000);
unsigned int NewMaxKeep = static_cast<unsigned int>(tag->getDuration("maxkeep", 3600, 3600));
cmd.manager.UpdateConfig(NewGroupSize, NewMaxGroups, NewMaxKeep);
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index e7e38fac3..23008a8a2 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -32,7 +32,7 @@ bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User
if (insane->getBool(confkey))
return false;
- float itrigger = insane->getFloat("trigger", 95.5, 0.0, 100.0);
+ float itrigger = insane->getNum<float>("trigger", 95.5, 0.0, 100.0);
long matches = test.Run(mask);
diff --git a/src/listmode.cpp b/src/listmode.cpp
index a350c4ad5..8b3cdfdeb 100644
--- a/src/listmode.cpp
+++ b/src/listmode.cpp
@@ -80,7 +80,7 @@ void ListModeBase::DoRehash()
if (!mname.empty() && !stdalgo::string::equalsci(mname, name) && !(mname.length() == 1 && GetModeChar() == mname[0]))
continue;
- ListLimit limit(c->getString("chan", "*", 1), c->getUInt("limit", DEFAULT_LIST_SIZE));
+ ListLimit limit(c->getString("chan", "*", 1), c->getNum<unsigned long>("limit", DEFAULT_LIST_SIZE));
if (limit.mask.empty())
throw ModuleException(creator, INSP_FORMAT("<maxlist:chan> is empty, at {}", c->source.str()));
diff --git a/src/logging.cpp b/src/logging.cpp
index 7251c515c..8dbc156be 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -131,7 +131,7 @@ Log::MethodPtr Log::FileEngine::Create(const std::shared_ptr<ConfigTag>& tag)
tag->source.str(), strerror(errno)));
}
- const unsigned long flush = tag->getUInt("flush", 20, 1);
+ const unsigned long flush = tag->getNum<unsigned long>("flush", 20, 1);
return std::make_shared<FileMethod>(fulltarget, fh, flush, true);
}
diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp
index aec1b40d5..f2b3301a5 100644
--- a/src/modules/extra/m_argon2.cpp
+++ b/src/modules/extra/m_argon2.cpp
@@ -34,25 +34,6 @@
class ProviderConfig final
{
-private:
- static Argon2_version SanitizeArgon2Version(unsigned long version)
- {
- // Note, 10 is 0x10, and 13 is 0x13. Referring to it as
- // dec 10 or 13 in the config file, for the name to
- // match better.
- switch (version)
- {
- case 10:
- return ARGON2_VERSION_10;
- case 13:
- return ARGON2_VERSION_13;
- }
-
- ServerInstance->Logs.Warning(MODNAME, "Unknown Argon2 version ({}) specified; assuming 13",
- version);
- return ARGON2_VERSION_13;
- }
-
public:
uint32_t iterations;
uint32_t lanes;
@@ -72,25 +53,28 @@ public:
const auto& tag = ServerInstance->Config->ConfValue(tagname);
uint32_t def_iterations = def ? def->iterations : 3;
- this->iterations = static_cast<uint32_t>(tag->getUInt("iterations", def_iterations, 1, UINT32_MAX));
+ this->iterations = tag->getNum<uint32_t>("iterations", def_iterations, 1);
uint32_t def_lanes = def ? def->lanes : 1;
- this->lanes = static_cast<uint32_t>(tag->getUInt("lanes", def_lanes, ARGON2_MIN_LANES, ARGON2_MAX_LANES));
+ this->lanes = tag->getNum<uint32_t>("lanes", def_lanes, ARGON2_MIN_LANES, ARGON2_MAX_LANES);
uint32_t def_memory = def ? def->memory : 131072; // 128 MiB
- this->memory = static_cast<uint32_t>(tag->getUInt("memory", def_memory, ARGON2_MIN_MEMORY, ARGON2_MAX_MEMORY));
+ this->memory = tag->getNum<uint32_t>("memory", def_memory, ARGON2_MIN_MEMORY, ARGON2_MAX_MEMORY);
uint32_t def_outlen = def ? def->outlen : 32;
- this->outlen = static_cast<uint32_t>(tag->getUInt("length", def_outlen, ARGON2_MIN_OUTLEN, ARGON2_MAX_OUTLEN));
+ this->outlen = tag->getNum<int32_t>("length", def_outlen, ARGON2_MIN_OUTLEN, ARGON2_MAX_OUTLEN);
uint32_t def_saltlen = def ? def->saltlen : 16;
- this->saltlen = static_cast<uint32_t>(tag->getUInt("saltlength", def_saltlen, ARGON2_MIN_SALT_LENGTH, ARGON2_MAX_SALT_LENGTH));
+ this->saltlen = tag->getNum<uint32_t>("saltlength", def_saltlen, ARGON2_MIN_SALT_LENGTH, ARGON2_MAX_SALT_LENGTH);
uint32_t def_threads = def ? def->threads : 1;
- this->threads = static_cast<uint32_t>(tag->getUInt("threads", def_threads, ARGON2_MIN_THREADS, ARGON2_MAX_THREADS));
+ this->threads = tag->getNum<uint32_t>("threads", def_threads, ARGON2_MIN_THREADS, ARGON2_MAX_THREADS);
- uint32_t def_version = def ? def->version : 13;
- this->version = SanitizeArgon2Version(tag->getUInt("version", def_version));
+ Argon2_version def_version = def ? def->version : ARGON2_VERSION_13;
+ this->version = tag->getEnum("version", def_version, {
+ { "10", ARGON2_VERSION_10 },
+ { "13", ARGON2_VERSION_13 },
+ });
}
};
diff --git a/src/modules/extra/m_log_json.cpp b/src/modules/extra/m_log_json.cpp
index b8ff6e838..4b401be92 100644
--- a/src/modules/extra/m_log_json.cpp
+++ b/src/modules/extra/m_log_json.cpp
@@ -145,7 +145,7 @@ public:
fulltarget, tag->source.str(), strerror(errno)));
}
- const unsigned long flush = tag->getUInt("flush", 20, 1);
+ const unsigned long flush = tag->getNum<unsigned long>("flush", 20, 1);
return std::make_shared<JSONMethod>(fulltarget, fh, flush, true);
}
};
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 0d89e30a5..b2715dba8 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -335,7 +335,7 @@ public:
const std::string user = config->getString("user");
const std::string pass = config->getString("pass");
const std::string dbname = config->getString("name");
- unsigned int port = static_cast<unsigned int>(config->getUInt("port", 3306, 1, 65535));
+ unsigned int port = config->getNum<unsigned int>("port", 3306, 1, 65535);
if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, nullptr, CLIENT_IGNORE_SIGPIPE))
{
ServerInstance->Logs.Error(MODNAME, "Unable to connect to the {} MySQL server: {}",
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index c9fb76dc0..3a1401636 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -541,7 +541,7 @@ namespace GnuTLS
, dh(DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem", 1))))
#endif
, priostr(GetPrioStr(profilename, tag))
- , mindh(static_cast<unsigned int>(tag->getUInt("mindhbits", 1024, 0, UINT32_MAX)))
+ , mindh(tag->getNum<unsigned int>("mindhbits", 1024))
, hashstr(tag->getString("hash", "sha256", 1))
, requestclientcert(tag->getBool("requestclientcert", true))
{
@@ -556,7 +556,7 @@ namespace GnuTLS
crl.reset(new X509CRL(ReadFile(filename)));
}
- outrecsize = static_cast<unsigned int>(tag->getUInt("outrecsize", 2048, 512, UINT32_MAX));
+ outrecsize = tag->getNum<unsigned int>("outrecsize", 2048, 512);
}
};
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index cb5d3acef..61625404f 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -451,12 +451,12 @@ namespace mbedTLS
, dhstr(ReadFile(tag->getString("dhfile", "dhparams.pem", 1)))
, ciphersuitestr(tag->getString("ciphersuites"))
, curvestr(tag->getString("curves"))
- , mindh(static_cast<unsigned int>(tag->getUInt("mindhbits", 2048, 0, UINT32_MAX)))
+ , mindh(tag->getNum<unsigned int>("mindhbits", 2048))
, hashstr(tag->getString("hash", "sha256", 1))
, castr(tag->getString("cafile"))
- , minver(static_cast<int>(tag->getUInt("minver", 0, 0, INT32_MAX)))
- , maxver(static_cast<int>(tag->getUInt("maxver", 0, 0, INT32_MAX)))
- , outrecsize(static_cast<unsigned int>(tag->getUInt("outrecsize", 2048, 512, 16384)))
+ , minver(tag->getNum<int>("minver", 0))
+ , maxver(tag->getNum<int>("maxver", 0))
+ , outrecsize(tag->getNum<unsigned int>("outrecsize", 2048, 512, 16384))
, requestclientcert(tag->getBool("requestclientcert", true))
{
if (!castr.empty())
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 448db9180..64dbc8b64 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -326,8 +326,8 @@ namespace OpenSSL
*/
void SetContextOptions(const std::string& ctxname, const std::shared_ptr<ConfigTag>& tag, Context& context)
{
- long setoptions = tag->getInt(ctxname + "setoptions", 0);
- long clearoptions = tag->getInt(ctxname + "clearoptions", 0);
+ long setoptions = tag->getNum<long>(ctxname + "setoptions", 0);
+ long clearoptions = tag->getNum<long>(ctxname + "clearoptions", 0);
#ifdef SSL_OP_NO_COMPRESSION
// Disable compression by default
@@ -370,7 +370,7 @@ namespace OpenSSL
, ctx(SSL_CTX_new(TLS_server_method()))
, clientctx(SSL_CTX_new(TLS_client_method()))
, allowrenego(tag->getBool("renegotiation")) // Disallow by default
- , outrecsize(static_cast<unsigned int>(tag->getUInt("outrecsize", 2048, 512, 16384)))
+ , outrecsize(tag->getNum<unsigned int>("outrecsize", 2048, 512, 16384))
{
#ifndef INSPIRCD_OPENSSL_AUTO_DH
if ((!ctx.SetDH(dh)) || (!clientctx.SetDH(dh)))
diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp
index cac81cfa1..9ae763027 100644
--- a/src/modules/m_bcrypt.cpp
+++ b/src/modules/m_bcrypt.cpp
@@ -87,7 +87,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& conf = ServerInstance->Config->ConfValue("bcrypt");
- bcrypt.rounds = conf->getUInt("rounds", 10, 1);
+ bcrypt.rounds = conf->getNum<unsigned long>("rounds", 10, 1);
}
};
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 678d923cb..5d414f9e5 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -460,7 +460,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& tag = ServerInstance->Config->ConfValue("callerid");
- cmd.maxaccepts = tag->getUInt("maxaccepts", 30);
+ cmd.maxaccepts = tag->getNum<unsigned long>("maxaccepts", 30, 1);
tracknick = tag->getBool("tracknick");
notify_cooldown = tag->getDuration("cooldown", 60);
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 722b90512..a3eab65c5 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -107,7 +107,7 @@ public:
{
const auto& tag = ServerInstance->Config->ConfValue("chanfilter");
hidemask = tag->getBool("hidemask");
- cf.maxlen = tag->getUInt("maxlen", 35, 10, ModeParser::MODE_PARAM_MAX);
+ cf.maxlen = tag->getNum<unsigned long>("maxlen", 35, 10, ModeParser::MODE_PARAM_MAX);
notifyuser = tag->getBool("notifyuser", true);
cf.DoRehash();
}
diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp
index c3b8efd4c..f7dc37265 100644
--- a/src/modules/m_chanhistory.cpp
+++ b/src/modules/m_chanhistory.cpp
@@ -210,7 +210,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& tag = ServerInstance->Config->ConfValue("chanhistory");
- historymode.maxlines = tag->getUInt("maxlines", 50, 1);
+ historymode.maxlines = tag->getNum<unsigned long>("maxlines", 50, 1);
prefixmsg = tag->getBool("prefixmsg", true);
dobots = tag->getBool("bots", true);
}
diff --git a/src/modules/m_cloak_md5.cpp b/src/modules/m_cloak_md5.cpp
index 45bb07e6a..dd2c970c3 100644
--- a/src/modules/m_cloak_md5.cpp
+++ b/src/modules/m_cloak_md5.cpp
@@ -306,7 +306,7 @@ public:
if (halfcloak)
{
- unsigned int domainparts = static_cast<unsigned int>(tag->getUInt("domainparts", 3, 1, 10));
+ unsigned int domainparts = tag->getNum<unsigned int>("domainparts", 3, 1, 10);
return std::make_shared<CloakInfo>(this, MODE_HALF_CLOAK, key, prefix, suffix, ignorecase, domainparts);
}
else
diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp
index 088a3b411..945250b56 100644
--- a/src/modules/m_cloak_sha256.cpp
+++ b/src/modules/m_cloak_sha256.cpp
@@ -188,9 +188,9 @@ public:
SHA256Method(const Cloak::Engine* engine, const std::shared_ptr<ConfigTag>& tag, const std::string& k, psl_ctx_t* p, bool ch) ATTR_NOT_NULL(2)
: Cloak::Method(engine)
, cloakhost(ch)
- , hostparts(tag->getUInt("hostparts", 3, 0, ServerInstance->Config->Limits.MaxHost / 2))
+ , hostparts(tag->getNum<unsigned long>("hostparts", 3, 0, ServerInstance->Config->Limits.MaxHost / 2))
, key(k)
- , pathparts(tag->getUInt("pathparts", 1, 0, ServerInstance->Config->Limits.MaxHost / 2))
+ , pathparts(tag->getNum<unsigned long>("pathparts", 1, 0, ServerInstance->Config->Limits.MaxHost / 2))
, prefix(tag->getString("prefix"))
#ifdef HAS_LIBPSL
, psl(p)
diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp
index 1f5f2ac88..675255238 100644
--- a/src/modules/m_codepage.cpp
+++ b/src/modules/m_codepage.cpp
@@ -264,11 +264,11 @@ public:
std::unique_ptr<Codepage> newcodepage = std::make_unique<SingleByteCodepage>();
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars"))
{
- unsigned long begin = tag->getUInt("begin", tag->getUInt("index", 0));
+ unsigned long begin = tag->getNum<unsigned long>("begin", tag->getNum<unsigned long>("index", 0));
if (!begin)
throw ModuleException(this, "<cpchars> tag without index or begin specified at " + tag->source.str());
- unsigned long end = tag->getUInt("end", begin);
+ unsigned long end = tag->getNum<unsigned long>("end", begin);
if (begin > end)
throw ModuleException(this, "<cpchars:begin> must be lower than <cpchars:end> at " + tag->source.str());
@@ -296,11 +296,11 @@ public:
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpcase"))
{
- unsigned long lower = tag->getUInt("lower", 0);
+ unsigned long lower = tag->getNum<unsigned long>("lower", 0);
if (!lower)
throw ModuleException(this, "<cpcase:lower> is required at " + tag->source.str());
- unsigned long upper = tag->getUInt("upper", 0);
+ unsigned long upper = tag->getNum<unsigned long>("upper", 0);
if (!upper)
throw ModuleException(this, "<cpcase:upper> is required at " + tag->source.str());
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index e99c958ba..a65d8ab52 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -100,9 +100,9 @@ public:
{
const auto& tag = ServerInstance->Config->ConfValue("connectban");
- ipv4_cidr = static_cast<unsigned int>(tag->getUInt("ipv4cidr", ServerInstance->Config->c_ipv4_range, 1, 32));
- ipv6_cidr = static_cast<unsigned int>(tag->getUInt("ipv6cidr", ServerInstance->Config->c_ipv6_range, 1, 128));
- threshold = tag->getUInt("threshold", 10, 1);
+ ipv4_cidr = tag->getNum<unsigned int>("ipv4cidr", ServerInstance->Config->c_ipv4_range, 1, 32);
+ ipv6_cidr = tag->getNum<unsigned int>("ipv6cidr", ServerInstance->Config->c_ipv6_range, 1, 128);
+ threshold = tag->getNum<unsigned long>("threshold", 10, 1);
bootwait = tag->getDuration("bootwait", 60*2);
splitwait = tag->getDuration("splitwait", 60*2);
banduration = tag->getDuration("banduration", 6*60*60, 1);
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 09e9df0fc..d4c5c6596 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -60,7 +60,7 @@ public:
const auto& tag = ServerInstance->Config->ConfValue("connflood");
/* throttle configuration */
seconds = tag->getDuration("period", 30);
- maxconns = tag->getUInt("maxconns", 3);
+ maxconns = tag->getNum<unsigned long>("maxconns", 3);
timeout = tag->getDuration("timeout", 30);
quitmsg = tag->getString("quitmsg");
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index a60b17ec8..be13de1ef 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -32,9 +32,9 @@ public:
: PrefixMode(parent, Name, Letter, 0, Prefix)
, tag(Tag)
{
- ModeHandler::Rank rank = static_cast<ModeHandler::Rank>(tag->getUInt("rank", 1, 1, std::numeric_limits<ModeHandler::Rank>::max()));
- ModeHandler::Rank setrank = static_cast<ModeHandler::Rank>(tag->getUInt("ranktoset", prefixrank, rank, std::numeric_limits<ModeHandler::Rank>::max()));
- ModeHandler::Rank unsetrank = static_cast<ModeHandler::Rank>(tag->getUInt("ranktounset", setrank, setrank, std::numeric_limits<ModeHandler::Rank>::max()));
+ ModeHandler::Rank rank = tag->getNum<ModeHandler::Rank>("rank", 1, 1);
+ ModeHandler::Rank setrank = tag->getNum<ModeHandler::Rank>("ranktoset", prefixrank, rank);
+ ModeHandler::Rank unsetrank = tag->getNum<ModeHandler::Rank>("ranktounset", setrank, setrank);
bool depriv = tag->getBool("depriv", true);
this->Update(rank, setrank, unsetrank, depriv);
@@ -77,9 +77,9 @@ public:
if (!pm)
throw ModuleException(this, "<customprefix:change> specified for a non-prefix mode at " + tag->source.str());
- ModeHandler::Rank rank = static_cast<ModeHandler::Rank>(tag->getUInt("rank", pm->GetPrefixRank(), 1, std::numeric_limits<ModeHandler::Rank>::max()));
- ModeHandler::Rank setrank = static_cast<ModeHandler::Rank>(tag->getUInt("ranktoset", pm->GetLevelRequired(true), rank, std::numeric_limits<ModeHandler::Rank>::max()));
- ModeHandler::Rank unsetrank = static_cast<ModeHandler::Rank>(tag->getUInt("ranktounset", pm->GetLevelRequired(false), setrank, std::numeric_limits<ModeHandler::Rank>::max()));
+ ModeHandler::Rank rank = tag->getNum<ModeHandler::Rank>("rank", pm->GetPrefixRank(), 1);
+ ModeHandler::Rank setrank = tag->getNum<ModeHandler::Rank>("ranktoset", pm->GetLevelRequired(true), rank);
+ ModeHandler::Rank unsetrank = tag->getNum<ModeHandler::Rank>("ranktounset", pm->GetLevelRequired(false), setrank);
bool depriv = tag->getBool("depriv", pm->CanSelfRemove());
pm->Update(rank, setrank, unsetrank, depriv);
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 20dfc5897..f1026e528 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -617,7 +617,7 @@ public:
bfl.swap(newbfl);
const auto& tag = ServerInstance->Config->ConfValue("dccallow");
- cmd.ext.maxentries = tag->getUInt("maxentries", 20, 1);
+ cmd.ext.maxentries = tag->getNum<unsigned long>("maxentries", 20, 1);
cmd.defaultlength = tag->getDuration("length", 0);
blockchat = tag->getBool("blockchat");
defaultaction = tag->getString("action");
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 556a5339d..3d6a5074e 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -134,7 +134,7 @@ public:
{
type = Type::BITMASK;
- bitmask = static_cast<unsigned int>(tag->getUInt("bitmask", 0, 0, UINT_MAX));
+ bitmask = tag->getNum<unsigned int>("bitmask", 0);
records = 0;
}
else if (stdalgo::string::equalsci(typestr, "record"))
diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp
index ba3cc0ae1..be5606808 100644
--- a/src/modules/m_hidelist.cpp
+++ b/src/modules/m_hidelist.cpp
@@ -71,7 +71,7 @@ public:
throw ModuleException(this, "Empty <hidelist:mode> at " + tag->source.str());
// If rank is set to 0 everyone inside the channel can view the list,
// but non-members may not
- ModeHandler::Rank rank = tag->getUInt("rank", HALFOP_VALUE);
+ ModeHandler::Rank rank = tag->getNum<ModeHandler::Rank>("rank", HALFOP_VALUE);
newconfigs.emplace_back(modename, rank);
}
diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp
index c01060580..d858b82e5 100644
--- a/src/modules/m_hidemode.cpp
+++ b/src/modules/m_hidemode.cpp
@@ -27,11 +27,11 @@ namespace
{
class Settings final
{
- typedef insp::flat_map<std::string, unsigned int> RanksToSeeMap;
+ typedef insp::flat_map<std::string, ModeHandler::Rank> RanksToSeeMap;
RanksToSeeMap rankstosee;
public:
- unsigned int GetRequiredRank(const ModeHandler& mh) const
+ ModeHandler::Rank GetRequiredRank(const ModeHandler& mh) const
{
RanksToSeeMap::const_iterator it = rankstosee.find(mh.name);
if (it != rankstosee.end())
@@ -49,7 +49,7 @@ public:
if (modename.empty())
throw ModuleException(mod, "<hidemode:mode> is empty at " + tag->source.str());
- unsigned long rank = tag->getUInt("rank", 0);
+ ModeHandler::Rank rank = tag->getNum<ModeHandler::Rank>("rank", 0);
if (!rank)
throw ModuleException(mod, "<hidemode:rank> must be greater than 0 at " + tag->source.str());
diff --git a/src/modules/m_ircv3_sts.cpp b/src/modules/m_ircv3_sts.cpp
index 24874ef97..51099466e 100644
--- a/src/modules/m_ircv3_sts.cpp
+++ b/src/modules/m_ircv3_sts.cpp
@@ -181,7 +181,7 @@ public:
if (host.empty())
throw ModuleException(this, "<sts:host> must contain a hostname, at " + tag->source.str());
- in_port_t port = static_cast<in_port_t>(tag->getUInt("port", 6697, 1, 65535));
+ in_port_t port = tag->getNum<in_port_t>("port", 6697, 1);
if (!HasValidSSLPort(port))
throw ModuleException(this, "<sts:port> must be a TLS port, at " + tag->source.str());
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index e48883324..76e59b1b8 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -138,9 +138,9 @@ public:
void ReadConfig(ConfigStatus&) override
{
const auto& tag = ServerInstance->Config->ConfValue("messageflood");
- notice = tag->getFloat("notice", 1.0);
- privmsg = tag->getFloat("privmsg", 1.0);
- tagmsg = tag->getFloat("tagmsg", 0.2);
+ notice = tag->getNum<float>("notice", 1.0);
+ privmsg = tag->getNum<float>("privmsg", 1.0);
+ tagmsg = tag->getNum<float>("tagmsg", 0.2);
kickmessage = tag->getString("kickmessage", "Message flood (trigger is %lines% messages in %duration%)", 1);
}
diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp
index 3e2b9d514..890736fc5 100644
--- a/src/modules/m_monitor.cpp
+++ b/src/modules/m_monitor.cpp
@@ -393,7 +393,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& tag = ServerInstance->Config->ConfValue("monitor");
- cmd.maxmonitor = tag->getUInt("maxentries", 30, 1);
+ cmd.maxmonitor = tag->getNum<unsigned long>("maxentries", 30, 1);
}
void OnPostConnect(User* user) override
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 86ccddce0..c7db667f6 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -40,8 +40,8 @@ public:
// oper killing an oper?
if (dest->IsOper() && source->IsOper())
{
- unsigned long dest_level = dest->oper->GetConfig()->getUInt("level", 0);
- unsigned long source_level = source->oper->GetConfig()->getUInt("level", 0);
+ unsigned long dest_level = dest->oper->GetConfig()->getNum<unsigned long>("level", 0);
+ unsigned long source_level = source->oper->GetConfig()->getNum<unsigned long>("level", 0);
if (dest_level > source_level)
{
diff --git a/src/modules/m_pbkdf2.cpp b/src/modules/m_pbkdf2.cpp
index fbeb52e3b..53afb0ed3 100644
--- a/src/modules/m_pbkdf2.cpp
+++ b/src/modules/m_pbkdf2.cpp
@@ -185,8 +185,8 @@ class ModulePBKDF2 final
// First set the common values
const auto& tag = ServerInstance->Config->ConfValue("pbkdf2");
ProviderConfig newglobal;
- newglobal.iterations = tag->getUInt("iterations", 12288, 1);
- newglobal.dkey_length = tag->getUInt("length", 32, 1, 1024);
+ newglobal.iterations = tag->getNum<unsigned long>("iterations", 12288, 1);
+ newglobal.dkey_length = tag->getNum<size_t>("length", 32, 1, 1024);
// Then the specific values
ProviderConfigMap newconfigs;
@@ -195,8 +195,8 @@ class ModulePBKDF2 final
std::string hash_name = "hash/" + ptag->getString("hash");
ProviderConfig& config = newconfigs[hash_name];
- config.iterations = ptag->getUInt("iterations", newglobal.iterations, 1);
- config.dkey_length = ptag->getUInt("length", newglobal.dkey_length, 1, 1024);
+ config.iterations = ptag->getNum<unsigned long>("iterations", newglobal.iterations, 1);
+ config.dkey_length = ptag->getNum<size_t>("length", newglobal.dkey_length, 1, 1024);
}
// Config is valid, apply it
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 24fc5bd8b..904ecf22d 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -218,10 +218,10 @@ public:
auto* c = ServerInstance->Channels.Find(channel);
if (!c)
{
- time_t TS = tag->getInt("ts", ServerInstance->Time(), 1);
+ time_t TS = tag->getNum<time_t>("ts", ServerInstance->Time(), 1);
c = new Channel(channel, TS);
- time_t topicset = tag->getInt("topicts", 0);
+ time_t topicset = tag->getNum<time_t>("topicts", 0);
std::string topic = tag->getString("topic");
if ((topicset != 0) || (!topic.empty()))
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 113062b30..864429b04 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -175,7 +175,7 @@ public:
{
const auto& tag = ServerInstance->Config->ConfValue("remove");
cmd.supportnokicks = tag->getBool("supportnokicks");
- cmd.protectedrank = tag->getUInt("protectedrank", 50000);
+ cmd.protectedrank = tag->getNum<ModeHandler::Rank>("protectedrank", 50000, 1);
}
};
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index ec2568779..7e0317a62 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -248,13 +248,13 @@ public:
void ReadConfig()
{
const auto& conf = ServerInstance->Config->ConfValue("repeat");
- ms.MaxLines = conf->getUInt("maxlines", 20);
- ms.MaxBacklog = conf->getUInt("maxbacklog", 20);
+ ms.MaxLines = conf->getNum<unsigned long>("maxlines", 20);
+ ms.MaxBacklog = conf->getNum<unsigned long>("maxbacklog", 20);
ms.MaxSecs = conf->getDuration("maxtime", 0);
- ms.MaxDiff = static_cast<unsigned int>(conf->getUInt("maxdistance", 50, 0, 100));
+ ms.MaxDiff = conf->getNum<unsigned int>("maxdistance", 50, 0, 100);
- unsigned long newsize = conf->getUInt("size", 512);
+ size_t newsize = conf->getNum<size_t>("size", 512);
if (newsize > ServerInstance->Config->Limits.MaxLine)
newsize = ServerInstance->Config->Limits.MaxLine;
Resize(newsize);
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 18d6e495d..1c6dfdc2c 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -67,7 +67,7 @@ public:
const auto& tag = ServerInstance->Config->ConfValue("securelist");
exemptregistered = tag->getBool("exemptregistered", true);
- fakechans = tag->getUInt("fakechans", 5, 0);
+ fakechans = tag->getNum<unsigned long>("fakechans", 5, 0);
fakechanprefix = tag->getString("fakechanprefix", "#", 1, ServerInstance->Config->Limits.MaxChannel - 1);
fakechantopic = tag->getString("fakechantopic", "Fake channel for confusing spambots", 1, ServerInstance->Config->Limits.MaxTopic - 1);
showmsg = tag->getBool("showmsg", true);
diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp
index 4fee8b8e6..e4241105b 100644
--- a/src/modules/m_showfile.cpp
+++ b/src/modules/m_showfile.cpp
@@ -84,9 +84,9 @@ public:
{
introtext = tag->getString("introtext", "Showing " + name);
endtext = tag->getString("endtext", "End of " + name);
- intronumeric = static_cast<unsigned int>(tag->getUInt("intronumeric", RPL_RULESTART, 0, 999));
- textnumeric = static_cast<unsigned int>(tag->getUInt("numeric", RPL_RULES, 0, 999));
- endnumeric = static_cast<unsigned int>(tag->getUInt("endnumeric", RPL_RULESEND, 0, 999));
+ intronumeric = tag->getNum<unsigned int>("intronumeric", RPL_RULESTART, 0, 999);
+ textnumeric = tag->getNum<unsigned int>("numeric", RPL_RULES, 0, 999);
+ endnumeric = tag->getNum<unsigned int>("endnumeric", RPL_RULESEND, 0, 999);
std::string smethod = tag->getString("method");
method = SF_NUMERIC;
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 15690fb47..321dbeb86 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -459,7 +459,7 @@ public:
{
const auto& tag = ServerInstance->Config->ConfValue("silence");
exemptservice = tag->getBool("exemptservice", tag->getBool("exemptuline", true));
- cmd.ext.maxsilence = tag->getUInt("maxentries", 32, 1);
+ cmd.ext.maxsilence = tag->getNum<unsigned long>("maxentries", 32, 1);
}
void OnBuildISupport(ISupport::TokenMap& tokens) override
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 3a0ec1cfc..d1d931ff3 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -262,7 +262,7 @@ void SpanningTreeUtilities::ReadConfiguration()
if (path.empty())
{
L->IPAddr = tag->getString("ipaddr");
- L->Port = static_cast<in_port_t>(tag->getUInt("port", 0, 0, 65535));
+ L->Port = tag->getNum<in_port_t>("port", 0);
if (tag->getBool("sctp"))
{
#ifdef IPPROTO_SCTP
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 61b20bcf6..43c2d1c85 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -219,7 +219,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
const auto& tag = ServerInstance->Config->ConfValue("watch");
- cmd.maxwatch = tag->getUInt("maxwatch", 30, 1);
+ cmd.maxwatch = tag->getNum<unsigned long>("maxwatch", 30, 1);
}
void OnPostConnect(User* user) override
diff --git a/src/users.cpp b/src/users.cpp
index cf2652403..e44e2bda3 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1091,20 +1091,20 @@ void ConnectClass::Configure(const std::string& classname, const std::shared_ptr
ports.insert(static_cast<in_port_t>(port));
}
- commandrate = tag->getUInt("commandrate", commandrate, 1);
+ commandrate = tag->getNum<unsigned long>("commandrate", commandrate, 1);
fakelag = tag->getBool("fakelag", fakelag);
- hardsendqmax = tag->getUInt("hardsendq", hardsendqmax, ServerInstance->Config->Limits.MaxLine);
- limit = tag->getUInt("limit", limit, 1);
- maxchans = tag->getUInt("maxchans", maxchans);
+ hardsendqmax = tag->getNum<unsigned long>("hardsendq", hardsendqmax, ServerInstance->Config->Limits.MaxLine);
+ limit = tag->getNum<unsigned long>("limit", limit, 1);
+ maxchans = tag->getNum<unsigned long>("maxchans", maxchans);
maxconnwarn = tag->getBool("maxconnwarn", maxconnwarn);
- maxlocal = tag->getUInt("localmax", maxlocal);
- maxglobal = tag->getUInt("globalmax", maxglobal, maxlocal);
- penaltythreshold = tag->getUInt("threshold", penaltythreshold, 1);
+ maxlocal = tag->getNum<unsigned long>("localmax", maxlocal);
+ maxglobal = tag->getNum<unsigned long>("globalmax", maxglobal, maxlocal);
+ penaltythreshold = tag->getNum<unsigned long>("threshold", penaltythreshold, 1);
pingtime = tag->getDuration("pingfreq", pingtime);
- recvqmax = tag->getUInt("recvq", recvqmax, ServerInstance->Config->Limits.MaxLine);
+ recvqmax = tag->getNum<unsigned long>("recvq", recvqmax, ServerInstance->Config->Limits.MaxLine);
connection_timeout = tag->getDuration("timeout", connection_timeout);
resolvehostnames = tag->getBool("resolvehostnames", resolvehostnames);
- softsendqmax = tag->getUInt("softsendq", softsendqmax, ServerInstance->Config->Limits.MaxLine);
+ softsendqmax = tag->getNum<unsigned long>("softsendq", softsendqmax, ServerInstance->Config->Limits.MaxLine);
uniqueusername = tag->getBool("uniqueusername", uniqueusername);
}