From af8effe4f0876d6fa934806745712f679bd36278 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 24 Jan 2023 23:41:50 +0000 Subject: [PATCH] Replace getInt/getUInt/getFloat with type safe templated functions. --- include/configreader.h | 53 +++++++++++++++++++--- src/configparser.cpp | 13 +++--- src/configreader.cpp | 34 +++++++------- src/coremods/core_channel/core_channel.cpp | 4 +- src/coremods/core_dns.cpp | 2 +- src/coremods/core_whowas.cpp | 4 +- src/coremods/core_xline/core_xline.cpp | 2 +- src/listmode.cpp | 2 +- src/logging.cpp | 2 +- src/modules/extra/m_argon2.cpp | 38 +++++----------- src/modules/extra/m_log_json.cpp | 2 +- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 4 +- src/modules/extra/m_ssl_mbedtls.cpp | 8 ++-- src/modules/extra/m_ssl_openssl.cpp | 6 +-- src/modules/m_bcrypt.cpp | 2 +- src/modules/m_callerid.cpp | 2 +- src/modules/m_chanfilter.cpp | 2 +- src/modules/m_chanhistory.cpp | 2 +- src/modules/m_cloak_md5.cpp | 2 +- src/modules/m_cloak_sha256.cpp | 4 +- src/modules/m_codepage.cpp | 8 ++-- src/modules/m_connectban.cpp | 6 +-- src/modules/m_connflood.cpp | 2 +- src/modules/m_customprefix.cpp | 12 ++--- src/modules/m_dccallow.cpp | 2 +- src/modules/m_dnsbl.cpp | 2 +- src/modules/m_hidelist.cpp | 2 +- src/modules/m_hidemode.cpp | 6 +-- src/modules/m_ircv3_sts.cpp | 2 +- src/modules/m_messageflood.cpp | 6 +-- src/modules/m_monitor.cpp | 2 +- src/modules/m_operlevels.cpp | 4 +- src/modules/m_pbkdf2.cpp | 8 ++-- src/modules/m_permchannels.cpp | 4 +- src/modules/m_remove.cpp | 2 +- src/modules/m_repeat.cpp | 8 ++-- src/modules/m_securelist.cpp | 2 +- src/modules/m_showfile.cpp | 6 +-- src/modules/m_silence.cpp | 2 +- src/modules/m_spanningtree/utils.cpp | 2 +- src/modules/m_watch.cpp | 2 +- src/users.cpp | 18 ++++---- 43 files changed, 161 insertions(+), 137 deletions(-) diff --git a/include/configreader.h b/include/configreader.h index a5d60525e..b322ded92 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -67,6 +67,30 @@ public: private: Items items; + /** Retrieves the value of a signed integer from the server config. + * @param key The config key to retrieve. + * @param def The default value to return if not set, empty, or out of range. + * @param min The minimum valid value. + * @param max The maximum valid value. + */ + long double getFloat(const std::string& key, long double def, long double min, long double max) const; + + /** Retrieves the value of a signed integer from the server config. + * @param key The config key to retrieve. + * @param def The default value to return if not set, empty, or out of range. + * @param min The minimum valid value. + * @param max The maximum valid value. + */ + intmax_t getSInt(const std::string& key, intmax_t def, intmax_t min, intmax_t max) const; + + /** Retrieves the value of an unsigned integer from the server config. + * @param key The config key to retrieve. + * @param def The default value to return if not set, empty, or out of range. + * @param min The minimum valid value. + * @param max The maximum valid value. + */ + uintmax_t getUInt(const std::string& key, uintmax_t def, uintmax_t min, uintmax_t max) const; + public: /** The name of the configuration tag (e.g. "foo" for \). */ const std::string name; @@ -80,17 +104,32 @@ public: */ ConfigTag(const std::string& Name, const FilePosition& Source); + /** @copydoc getFloat */ + template + std::enable_if_t, T> getNum(const std::string& key, T def, T min = std::numeric_limits::min(), T max = std::numeric_limits::max()) const + { + return static_cast(getFloat(key, def, min, max)); + } + + /** @copydoc getSInt */ + template + std::enable_if_t && !std::is_floating_point_v, T> getNum(const std::string& key, T def, T min = std::numeric_limits::min(), T max = std::numeric_limits::max()) const + { + return static_cast(getSInt(key, def, min, max)); + } + + /** @copydoc getUInt */ + template + std::enable_if_t && !std::is_floating_point_v, T> getNum(const std::string& key, T def, T min = std::numeric_limits::min(), T max = std::numeric_limits::max()) const + { + return static_cast(getUInt(key, def, min, max)); + } + /** Get the value of an option, using def if it does not exist */ std::string getString(const std::string& key, const std::string& def, const std::function& validator) const; /** Get the value of an option, using def if it does not exist */ std::string getString(const std::string& key, const std::string& def = "", size_t minlen = 0, size_t maxlen = UINT32_MAX) const; /** Get the value of an option, using def if it does not exist */ - long getInt(const std::string& key, long def, long min = LONG_MIN, long max = LONG_MAX) const; - /** Get the value of an option, using def if it does not exist */ - unsigned long getUInt(const std::string& key, unsigned long def, unsigned long min = 0, unsigned long max = ULONG_MAX) const; - /** Get the value of an option, using def if it does not exist */ - double getFloat(const std::string& key, double def, double min = DBL_MIN, double max = DBL_MAX) const; - /** Get the value of an option, using def if it does not exist */ bool getBool(const std::string& key, bool def = false) const; /** Get the value of an option, using def if it does not exist */ unsigned char getCharacter(const std::string& key, unsigned char def = '\0') const; @@ -408,7 +447,7 @@ public: * The IRC server will not allow more than this * number of local users. */ - unsigned long SoftLimit; + size_t SoftLimit; /** Maximum number of targets for a multi target command * such as PRIVMSG or KICK 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 #include #include @@ -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& 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("maxline", 512, 512)) + , MaxNick(tag->getNum("maxnick", 30, 1, MaxLine)) + , MaxChannel(tag->getNum("maxchan", 60, 1, MaxLine)) + , MaxModes(tag->getNum("maxmodes", 20, 1)) + , MaxUser(tag->getNum("maxident", 10, 1)) + , MaxQuit(tag->getNum("maxquit", 300, 0, MaxLine)) + , MaxTopic(tag->getNum("maxtopic", 330, 1, MaxLine)) + , MaxKick(tag->getNum("maxkick", 300, 1, MaxLine)) + , MaxReal(tag->getNum("maxreal", 130, 1, MaxLine)) + , MaxAway(tag->getNum("maxaway", 200, 1, MaxLine)) + , MaxHost(tag->getNum("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(ConfValue("performance")->getUInt("somaxconn", SOMAXCONN)); + SoftLimit = ConfValue("performance")->getNum("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : SIZE_MAX), 10); + MaxConn = ConfValue("performance")->getNum("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("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("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("ipv4clone", 32, 1, 32); + c_ipv6_range = ConfValue("cidr")->getNum("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("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("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(tag->getUInt("sourceport", 0, 0, 65535)); + SourcePort = tag->getNum("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(tag->getUInt("groupsize", 10, 0, 10000)); - unsigned int NewMaxGroups = static_cast(tag->getUInt("maxgroups", 10240, 0, 1000000)); + unsigned int NewGroupSize = tag->getNum("groupsize", 10, 0, 10000); + unsigned int NewMaxGroups = tag->getNum("maxgroups", 10240, 0, 1000000); unsigned int NewMaxKeep = static_cast(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("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("limit", DEFAULT_LIST_SIZE)); if (limit.mask.empty()) throw ModuleException(creator, INSP_FORMAT(" 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& tag) tag->source.str(), strerror(errno))); } - const unsigned long flush = tag->getUInt("flush", 20, 1); + const unsigned long flush = tag->getNum("flush", 20, 1); return std::make_shared(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(tag->getUInt("iterations", def_iterations, 1, UINT32_MAX)); + this->iterations = tag->getNum("iterations", def_iterations, 1); uint32_t def_lanes = def ? def->lanes : 1; - this->lanes = static_cast(tag->getUInt("lanes", def_lanes, ARGON2_MIN_LANES, ARGON2_MAX_LANES)); + this->lanes = tag->getNum("lanes", def_lanes, ARGON2_MIN_LANES, ARGON2_MAX_LANES); uint32_t def_memory = def ? def->memory : 131072; // 128 MiB - this->memory = static_cast(tag->getUInt("memory", def_memory, ARGON2_MIN_MEMORY, ARGON2_MAX_MEMORY)); + this->memory = tag->getNum("memory", def_memory, ARGON2_MIN_MEMORY, ARGON2_MAX_MEMORY); uint32_t def_outlen = def ? def->outlen : 32; - this->outlen = static_cast(tag->getUInt("length", def_outlen, ARGON2_MIN_OUTLEN, ARGON2_MAX_OUTLEN)); + this->outlen = tag->getNum("length", def_outlen, ARGON2_MIN_OUTLEN, ARGON2_MAX_OUTLEN); uint32_t def_saltlen = def ? def->saltlen : 16; - this->saltlen = static_cast(tag->getUInt("saltlength", def_saltlen, ARGON2_MIN_SALT_LENGTH, ARGON2_MAX_SALT_LENGTH)); + this->saltlen = tag->getNum("saltlength", def_saltlen, ARGON2_MIN_SALT_LENGTH, ARGON2_MAX_SALT_LENGTH); uint32_t def_threads = def ? def->threads : 1; - this->threads = static_cast(tag->getUInt("threads", def_threads, ARGON2_MIN_THREADS, ARGON2_MAX_THREADS)); + this->threads = tag->getNum("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("flush", 20, 1); return std::make_shared(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(config->getUInt("port", 3306, 1, 65535)); + unsigned int port = config->getNum("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(tag->getUInt("mindhbits", 1024, 0, UINT32_MAX))) + , mindh(tag->getNum("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(tag->getUInt("outrecsize", 2048, 512, UINT32_MAX)); + outrecsize = tag->getNum("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(tag->getUInt("mindhbits", 2048, 0, UINT32_MAX))) + , mindh(tag->getNum("mindhbits", 2048)) , hashstr(tag->getString("hash", "sha256", 1)) , castr(tag->getString("cafile")) - , minver(static_cast(tag->getUInt("minver", 0, 0, INT32_MAX))) - , maxver(static_cast(tag->getUInt("maxver", 0, 0, INT32_MAX))) - , outrecsize(static_cast(tag->getUInt("outrecsize", 2048, 512, 16384))) + , minver(tag->getNum("minver", 0)) + , maxver(tag->getNum("maxver", 0)) + , outrecsize(tag->getNum("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& tag, Context& context) { - long setoptions = tag->getInt(ctxname + "setoptions", 0); - long clearoptions = tag->getInt(ctxname + "clearoptions", 0); + long setoptions = tag->getNum(ctxname + "setoptions", 0); + long clearoptions = tag->getNum(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(tag->getUInt("outrecsize", 2048, 512, 16384))) + , outrecsize(tag->getNum("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("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("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("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("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(tag->getUInt("domainparts", 3, 1, 10)); + unsigned int domainparts = tag->getNum("domainparts", 3, 1, 10); return std::make_shared(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& 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("hostparts", 3, 0, ServerInstance->Config->Limits.MaxHost / 2)) , key(k) - , pathparts(tag->getUInt("pathparts", 1, 0, ServerInstance->Config->Limits.MaxHost / 2)) + , pathparts(tag->getNum("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 newcodepage = std::make_unique(); for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars")) { - unsigned long begin = tag->getUInt("begin", tag->getUInt("index", 0)); + unsigned long begin = tag->getNum("begin", tag->getNum("index", 0)); if (!begin) throw ModuleException(this, " tag without index or begin specified at " + tag->source.str()); - unsigned long end = tag->getUInt("end", begin); + unsigned long end = tag->getNum("end", begin); if (begin > end) throw ModuleException(this, " must be lower than 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("lower", 0); if (!lower) throw ModuleException(this, " is required at " + tag->source.str()); - unsigned long upper = tag->getUInt("upper", 0); + unsigned long upper = tag->getNum("upper", 0); if (!upper) throw ModuleException(this, " 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(tag->getUInt("ipv4cidr", ServerInstance->Config->c_ipv4_range, 1, 32)); - ipv6_cidr = static_cast(tag->getUInt("ipv6cidr", ServerInstance->Config->c_ipv6_range, 1, 128)); - threshold = tag->getUInt("threshold", 10, 1); + ipv4_cidr = tag->getNum("ipv4cidr", ServerInstance->Config->c_ipv4_range, 1, 32); + ipv6_cidr = tag->getNum("ipv6cidr", ServerInstance->Config->c_ipv6_range, 1, 128); + threshold = tag->getNum("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("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(tag->getUInt("rank", 1, 1, std::numeric_limits::max())); - ModeHandler::Rank setrank = static_cast(tag->getUInt("ranktoset", prefixrank, rank, std::numeric_limits::max())); - ModeHandler::Rank unsetrank = static_cast(tag->getUInt("ranktounset", setrank, setrank, std::numeric_limits::max())); + ModeHandler::Rank rank = tag->getNum("rank", 1, 1); + ModeHandler::Rank setrank = tag->getNum("ranktoset", prefixrank, rank); + ModeHandler::Rank unsetrank = tag->getNum("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, " specified for a non-prefix mode at " + tag->source.str()); - ModeHandler::Rank rank = static_cast(tag->getUInt("rank", pm->GetPrefixRank(), 1, std::numeric_limits::max())); - ModeHandler::Rank setrank = static_cast(tag->getUInt("ranktoset", pm->GetLevelRequired(true), rank, std::numeric_limits::max())); - ModeHandler::Rank unsetrank = static_cast(tag->getUInt("ranktounset", pm->GetLevelRequired(false), setrank, std::numeric_limits::max())); + ModeHandler::Rank rank = tag->getNum("rank", pm->GetPrefixRank(), 1); + ModeHandler::Rank setrank = tag->getNum("ranktoset", pm->GetLevelRequired(true), rank); + ModeHandler::Rank unsetrank = tag->getNum("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("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(tag->getUInt("bitmask", 0, 0, UINT_MAX)); + bitmask = tag->getNum("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 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("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 RanksToSeeMap; + typedef insp::flat_map 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, " is empty at " + tag->source.str()); - unsigned long rank = tag->getUInt("rank", 0); + ModeHandler::Rank rank = tag->getNum("rank", 0); if (!rank) throw ModuleException(mod, " 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, " must contain a hostname, at " + tag->source.str()); - in_port_t port = static_cast(tag->getUInt("port", 6697, 1, 65535)); + in_port_t port = tag->getNum("port", 6697, 1); if (!HasValidSSLPort(port)) throw ModuleException(this, " 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("notice", 1.0); + privmsg = tag->getNum("privmsg", 1.0); + tagmsg = tag->getNum("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("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("level", 0); + unsigned long source_level = source->oper->GetConfig()->getNum("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("iterations", 12288, 1); + newglobal.dkey_length = tag->getNum("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("iterations", newglobal.iterations, 1); + config.dkey_length = ptag->getNum("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("ts", ServerInstance->Time(), 1); c = new Channel(channel, TS); - time_t topicset = tag->getInt("topicts", 0); + time_t topicset = tag->getNum("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("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("maxlines", 20); + ms.MaxBacklog = conf->getNum("maxbacklog", 20); ms.MaxSecs = conf->getDuration("maxtime", 0); - ms.MaxDiff = static_cast(conf->getUInt("maxdistance", 50, 0, 100)); + ms.MaxDiff = conf->getNum("maxdistance", 50, 0, 100); - unsigned long newsize = conf->getUInt("size", 512); + size_t newsize = conf->getNum("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("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(tag->getUInt("intronumeric", RPL_RULESTART, 0, 999)); - textnumeric = static_cast(tag->getUInt("numeric", RPL_RULES, 0, 999)); - endnumeric = static_cast(tag->getUInt("endnumeric", RPL_RULESEND, 0, 999)); + intronumeric = tag->getNum("intronumeric", RPL_RULESTART, 0, 999); + textnumeric = tag->getNum("numeric", RPL_RULES, 0, 999); + endnumeric = tag->getNum("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("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(tag->getUInt("port", 0, 0, 65535)); + L->Port = tag->getNum("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("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(port)); } - commandrate = tag->getUInt("commandrate", commandrate, 1); + commandrate = tag->getNum("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("hardsendq", hardsendqmax, ServerInstance->Config->Limits.MaxLine); + limit = tag->getNum("limit", limit, 1); + maxchans = tag->getNum("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("localmax", maxlocal); + maxglobal = tag->getNum("globalmax", maxglobal, maxlocal); + penaltythreshold = tag->getNum("threshold", penaltythreshold, 1); pingtime = tag->getDuration("pingfreq", pingtime); - recvqmax = tag->getUInt("recvq", recvqmax, ServerInstance->Config->Limits.MaxLine); + recvqmax = tag->getNum("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("softsendq", softsendqmax, ServerInstance->Config->Limits.MaxLine); uniqueusername = tag->getBool("uniqueusername", uniqueusername); }