]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Add options:maxtargets that was somehow omitted, fixes bug #400 (Reported by DarkStorm)
[user/henk/code/inspircd.git] / src / configreader.cpp
index b3258eb2ee1702d1532a1b53f56583a26301a2d3..35dee373278fec4e208e46ae22a1c6efda41d7d4 100644 (file)
@@ -353,6 +353,22 @@ bool ValidateExemptChanOps(ServerConfig* conf, const char* tag, const char* valu
        return true;
 }
 
+bool ValidateInvite(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
+{
+       std::string v = data.GetString();
+
+       if (v == "ops")
+               conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_OPS;
+       else if (v == "all")
+               conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_ALL;
+       else if (v == "dynamic")
+               conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_DYNAMIC;
+       else
+               conf->AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_NONE;
+
+       return true;
+}
+
 bool ValidateWhoWas(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
 {
        conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString());
@@ -416,14 +432,14 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
                 */
                for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item)
                {
-                       if (item->GetName() == name)
+                       if (item->GetName() == parent)
                        {
                                ConnectClass c(name, *item);
-                               c.Update(timeout, flood, std::string(*allow ? allow : deny), pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port);
+                               c.Update(timeout, flood, *allow ? allow : deny, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port);
                                conf->Classes.push_back(c);
                        }
                }
-               throw CoreException("Class name '" + std::string(name) + "' is configured to inherit from class '" + std::string(name) + "' which cannot be found.");
+               throw CoreException("Class name '" + std::string(name) + "' is configured to inherit from class '" + std::string(parent) + "' which cannot be found.");
        }
        else
        {
@@ -605,6 +621,7 @@ void ServerConfig::Read(bool bail, userrec* user)
        static char maxkeep[MAXBUF];    /* Temporary buffer for WhoWasMaxKeep value */
        static char hidemodes[MAXBUF];  /* Modes to not allow listing from users below halfop */
        static char exemptchanops[MAXBUF];      /* Exempt channel ops from these modes */
+       static char announceinvites[MAXBUF];    /* options:announceinvites setting */
        int rem = 0, add = 0;           /* Number of modules added, number of modules removed */
        std::ostringstream errstr;      /* String stream containing the error output */
 
@@ -649,10 +666,11 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"options",     "syntaxhints",  "0",                    new ValueContainerBool (&this->SyntaxHints),            DT_BOOLEAN, NoValidation},
                {"options",     "cyclehosts",   "0",                    new ValueContainerBool (&this->CycleHosts),             DT_BOOLEAN, NoValidation},
                {"options",     "ircumsgprefix","0",                    new ValueContainerBool (&this->UndernetMsgPrefix),      DT_BOOLEAN, NoValidation},
-               {"options",     "announceinvites", "1",                 new ValueContainerBool (&this->AnnounceInvites),        DT_BOOLEAN, NoValidation},
+               {"options",     "announceinvites", "1",                 new ValueContainerChar (announceinvites),               DT_CHARPTR, ValidateInvite},
                {"options",     "hostintopic",  "1",                    new ValueContainerBool (&this->FullHostInTopic),        DT_BOOLEAN, NoValidation},
                {"options",     "hidemodes",    "",                     new ValueContainerChar (hidemodes),                     DT_CHARPTR, ValidateModeLists},
                {"options",     "exemptchanops","",                     new ValueContainerChar (exemptchanops),                 DT_CHARPTR, ValidateExemptChanOps},
+               {"options",     "maxtargets",   "20",                   new ValueContainerUInt (&this->MaxTargets),             DT_INTEGER, ValidateMaxTargets},
                {"options",     "defaultmodes", "nt",                   new ValueContainerChar (this->DefaultModes),            DT_CHARPTR, NoValidation},
                {"pid",         "file",         "",                     new ValueContainerChar (this->PID),                     DT_CHARPTR, NoValidation},
                {"whowas",      "groupsize",    "10",                   new ValueContainerInt  (&this->WhoWasGroupSize),        DT_INTEGER, NoValidation},
@@ -676,7 +694,7 @@ void ServerConfig::Read(bool bail, userrec* user)
                                NULL},
                                {"",            "",             "",             "",             "120",          "",
                                 "",            "",             "",             "3",            "3",            "0",
-                                "",            "",
+                                "",            "",             "0",
                                 NULL},
                                {DT_CHARPTR,    DT_CHARPTR,     DT_CHARPTR,     DT_INTEGER,     DT_INTEGER,     DT_INTEGER,
                                 DT_INTEGER,    DT_INTEGER,     DT_INTEGER,     DT_INTEGER,     DT_INTEGER,     DT_INTEGER,