X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigreader.cpp;h=b3258eb2ee1702d1532a1b53f56583a26301a2d3;hb=cf4439ac5c5e5f57aba2c998ee63b9b27ec17d69;hp=ccf88ea0d7b42488817b344eb10ab6b93c1174a4;hpb=e24540666cf30d4cd093c82d14b1f6f703dc0196;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configreader.cpp b/src/configreader.cpp index ccf88ea0d..b3258eb2e 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -404,16 +404,41 @@ 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(); + int port = values[11].GetInteger(); + const char* name = values[12].GetString(); + const char* parent = values[13].GetString(); + int maxchans = values[14].GetInteger(); - if (*allow) + if (*parent) { - ConnectClass c(timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax); - conf->Classes.push_back(c); + /* 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() == name) + { + ConnectClass c(name, *item); + c.Update(timeout, flood, std::string(*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."); } else { - ConnectClass c(deny); - conf->Classes.push_back(c); + if (*allow) + { + 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); + } } return true; @@ -647,12 +672,15 @@ void ServerConfig::Read(bool bail, userrec* user) {"connect", {"allow", "deny", "password", "timeout", "pingfreq", "flood", "threshold", "sendq", "recvq", "localmax", "globalmax", "port", + "name", "parent", "maxchans", NULL}, {"", "", "", "", "120", "", "", "", "", "3", "3", "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_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, DT_INTEGER, + DT_CHARPTR, DT_CHARPTR, DT_INTEGER}, InitConnect, DoConnect, DoneConnect}, {"uline",