mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Remove the default value in ConfigTag::get{Duration,Float,Int}.
This commit is contained in:
parent
dec17a2e32
commit
7ef2f87e39
@ -45,9 +45,9 @@ class CoreExport ConfigTag : public refcountbase
|
||||
/** 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);
|
||||
/** Get the value of an option, using def if it does not exist */
|
||||
long getInt(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
|
||||
long getInt(const std::string& key, long def, long min = LONG_MIN, long max = LONG_MAX);
|
||||
/** Get the value of an option, using def if it does not exist */
|
||||
double getFloat(const std::string& key, double def = 0);
|
||||
double getFloat(const std::string& key, double def);
|
||||
/** Get the value of an option, using def if it does not exist */
|
||||
bool getBool(const std::string& key, bool def = false);
|
||||
|
||||
@ -59,7 +59,7 @@ class CoreExport ConfigTag : public refcountbase
|
||||
* @param max Maximum acceptable value (optional)
|
||||
* @return The duration in seconds
|
||||
*/
|
||||
long getDuration(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
|
||||
long getDuration(const std::string& key, long def, long min = LONG_MIN, long max = LONG_MAX);
|
||||
|
||||
/** Get the value of an option
|
||||
* @param key The option to get
|
||||
|
@ -443,7 +443,7 @@ void ServerConfig::Fill()
|
||||
DefaultModes = options->getString("defaultmodes", "not");
|
||||
PID = ConfValue("pid")->getString("file");
|
||||
MaxChans = ConfValue("channels")->getInt("users", 20);
|
||||
OperMaxChans = ConfValue("channels")->getInt("opers");
|
||||
OperMaxChans = ConfValue("channels")->getInt("opers", 0);
|
||||
c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32, 1, 32);
|
||||
c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128, 1, 128);
|
||||
Limits = ServerLimits(ConfValue("limits"));
|
||||
|
@ -69,7 +69,7 @@ void ListModeBase::DoRehash()
|
||||
{
|
||||
// For each <banlist> tag
|
||||
ConfigTag* c = i->second;
|
||||
ListLimit limit(c->getString("chan"), c->getInt("limit"));
|
||||
ListLimit limit(c->getString("chan"), c->getInt("limit", 0));
|
||||
|
||||
if (limit.mask.size() && limit.limit > 0)
|
||||
chanlimits.push_back(limit);
|
||||
|
@ -272,7 +272,7 @@ class SQLConnection : public SQL::Provider
|
||||
std::string user = config->getString("user");
|
||||
std::string pass = config->getString("pass");
|
||||
std::string dbname = config->getString("name");
|
||||
int port = config->getInt("port");
|
||||
int port = config->getInt("port", 3306);
|
||||
bool rv = mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, 0);
|
||||
if (!rv)
|
||||
return rv;
|
||||
|
@ -413,8 +413,8 @@ namespace mbedTLS
|
||||
, mindh(tag->getInt("mindhbits", 2048))
|
||||
, hashstr(tag->getString("hash", "sha256"))
|
||||
, castr(tag->getString("cafile"))
|
||||
, minver(tag->getInt("minver"))
|
||||
, maxver(tag->getInt("maxver"))
|
||||
, minver(tag->getInt("minver", 0))
|
||||
, maxver(tag->getInt("maxver", 0))
|
||||
, outrecsize(tag->getInt("outrecsize", 2048, 512, 16384))
|
||||
, requestclientcert(tag->getBool("requestclientcert", true))
|
||||
{
|
||||
|
@ -334,8 +334,8 @@ namespace OpenSSL
|
||||
*/
|
||||
void SetContextOptions(const std::string& ctxname, ConfigTag* tag, Context& context)
|
||||
{
|
||||
long setoptions = tag->getInt(ctxname + "setoptions");
|
||||
long clearoptions = tag->getInt(ctxname + "clearoptions");
|
||||
long setoptions = tag->getInt(ctxname + "setoptions", 0);
|
||||
long clearoptions = tag->getInt(ctxname + "clearoptions", 0);
|
||||
#ifdef SSL_OP_NO_COMPRESSION
|
||||
if (!tag->getBool("compression", false)) // Disable compression by default
|
||||
setoptions |= SSL_OP_NO_COMPRESSION;
|
||||
|
@ -46,13 +46,13 @@ public:
|
||||
/* read configuration variables */
|
||||
ConfigTag* tag = ServerInstance->Config->ConfValue("connflood");
|
||||
/* throttle configuration */
|
||||
seconds = tag->getDuration("period", tag->getInt("seconds"));
|
||||
maxconns = tag->getInt("maxconns");
|
||||
timeout = tag->getDuration("timeout");
|
||||
seconds = tag->getDuration("period", tag->getInt("seconds", 30));
|
||||
maxconns = tag->getInt("maxconns", 3);
|
||||
timeout = tag->getDuration("timeout", 30);
|
||||
quitmsg = tag->getString("quitmsg");
|
||||
|
||||
/* seconds to wait when the server just booted */
|
||||
boot_wait = tag->getInt("bootwait");
|
||||
boot_wait = tag->getInt("bootwait", 10);
|
||||
|
||||
first = ServerInstance->Time();
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public:
|
||||
time_t TS = tag->getInt("ts", ServerInstance->Time(), 1);
|
||||
c = new Channel(channel, TS);
|
||||
|
||||
unsigned int topicset = tag->getInt("topicts");
|
||||
unsigned int topicset = tag->getInt("topicts", 0);
|
||||
std::string topic = tag->getString("topic");
|
||||
|
||||
if ((topicset != 0) || (!topic.empty()))
|
||||
|
@ -229,13 +229,10 @@ void SpanningTreeUtilities::ReadConfiguration()
|
||||
AnnounceTSChange = options->getBool("announcets");
|
||||
AllowOptCommon = options->getBool("allowmismatch");
|
||||
quiet_bursts = ServerInstance->Config->ConfValue("performance")->getBool("quietbursts");
|
||||
PingWarnTime = options->getDuration("pingwarning");
|
||||
PingFreq = options->getDuration("serverpingfreq");
|
||||
PingWarnTime = options->getDuration("pingwarning", 15);
|
||||
PingFreq = options->getDuration("serverpingfreq", 60, 1);
|
||||
|
||||
if (PingFreq == 0)
|
||||
PingFreq = 60;
|
||||
|
||||
if (PingWarnTime > PingFreq - 1)
|
||||
if (PingWarnTime >= PingFreq)
|
||||
PingWarnTime = 0;
|
||||
|
||||
AutoconnectBlocks.clear();
|
||||
@ -253,7 +250,7 @@ void SpanningTreeUtilities::ReadConfiguration()
|
||||
L->AllowMasks.push_back(s);
|
||||
|
||||
L->IPAddr = tag->getString("ipaddr");
|
||||
L->Port = tag->getInt("port");
|
||||
L->Port = tag->getInt("port", 0);
|
||||
L->SendPass = tag->getString("sendpass", tag->getString("password"));
|
||||
L->RecvPass = tag->getString("recvpass", tag->getString("password"));
|
||||
L->Fingerprint = tag->getString("fingerprint");
|
||||
|
Loading…
x
Reference in New Issue
Block a user