]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove the default value in ConfigTag::get{Duration,Float,Int}.
authorPeter Powell <petpow@saberuk.com>
Sat, 14 Apr 2018 15:53:03 +0000 (16:53 +0100)
committerPeter Powell <petpow@saberuk.com>
Mon, 16 Apr 2018 14:07:06 +0000 (15:07 +0100)
include/configreader.h
src/configreader.cpp
src/listmode.cpp
src/modules/extra/m_mysql.cpp
src/modules/extra/m_ssl_mbedtls.cpp
src/modules/extra/m_ssl_openssl.cpp
src/modules/m_connflood.cpp
src/modules/m_permchannels.cpp
src/modules/m_spanningtree/utils.cpp

index 9349813d6cf15eaf1d61cfbbb1e4a0dcec38751b..bb4c03fae2c1f1a9ba8e84bc06f7db382bb5c178 100644 (file)
@@ -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
index 58a932981a402a8213c7386c30a9fd083e9372da..76bd268f2cc92ad0ff085299b50d0244db337e10 100644 (file)
@@ -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"));
index a8f6e51089aefbeb91a3347c7063fe0b07391377..d106bfa1d004b8f548e2e51b37d914279fefdf55 100644 (file)
@@ -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);
index a177951cefc0fdda0025192e110c7da760881f0c..6c65cd87eff1f73abe8cedf80ea8ccf4f74b53a8 100644 (file)
@@ -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;
index 8c15342f22820ceedaa95a66a61f76c0c03b418e..391d4d79b91c42efbbf94556e14954451f028b93 100644 (file)
@@ -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))
                        {
index 2129e5da7377c421b8554fc6f3e6c3798cfc0c46..828fcc26a07332e7e39c3b224582659533b38ca3 100644 (file)
@@ -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;
index 1d27e3990d1581f967486cecef6ef068967c164e..29d4d9d3ad6c8a195171a3bd15ff3e2cc32e99e9 100644 (file)
@@ -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();
        }
index 7e28c5fc65081dbbff95af4ba0455cec8f58a38d..95f01839ee8ccb7385f8a885129f594ac35f5124 100644 (file)
@@ -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()))
index 0a96ecfcd4a07243b46dede5dc77d51a81f9403f..d6f74cc69ecb07e0e2d17dd0c0fdc1d9ff68015e 100644 (file)
@@ -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");