]> 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 ac483229af7c243d3529db690d60fffb679b5aac..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());
@@ -404,25 +420,39 @@ bool DoConnect(ServerConfig* conf, const char* tag, char** entries, ValueList &v
        int recvq = values[8].GetInteger();
        int localmax = values[9].GetInteger();
        int globalmax = values[10].GetInteger();
-       const char* name = values[11].GetString();
-       const char* parent = values[12].GetString();
+       int port = values[11].GetInteger();
+       const char* name = values[12].GetString();
+       const char* parent = values[13].GetString();
+       int maxchans = values[14].GetInteger();
 
        if (*parent)
        {
                /* Find 'parent' and inherit a new class from it,
                 * then overwrite any values that are set here
                 */
+               for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item)
+               {
+                       if (item->GetName() == parent)
+                       {
+                               ConnectClass c(name, *item);
+                               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(parent) + "' which cannot be found.");
        }
        else
        {
                if (*allow)
                {
-                       ConnectClass c(name, timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax);
+                       ConnectClass c(name, timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans);
+                       c.SetPort(port);
                        conf->Classes.push_back(c);
                }
                else
                {
                        ConnectClass c(name, deny);
+                       c.SetPort(port);
                        conf->Classes.push_back(c);
                }
        }
@@ -591,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 */
 
@@ -635,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},
@@ -658,15 +690,15 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"connect",
                                {"allow",       "deny",         "password",     "timeout",      "pingfreq",     "flood",
                                "threshold",    "sendq",        "recvq",        "localmax",     "globalmax",    "port",
-                               "name",         "parent",
+                               "name",         "parent",       "maxchans",
                                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,
-                                DT_CHARPTR,    DT_CHARPTR},
+                                DT_CHARPTR,    DT_CHARPTR,     DT_INTEGER},
                                InitConnect, DoConnect, DoneConnect},
 
                {"uline",