/** 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);
* @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
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"));
{
// 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);
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;
, 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))
{
*/
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;
/* 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();
}
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()))
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();
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");