diff options
| author | 2021-03-05 09:54:26 +0000 | |
|---|---|---|
| committer | 2021-03-05 09:54:26 +0000 | |
| commit | e76b208ce8389cc7f20e95cefe34b8b0ace308db (patch) | |
| tree | 9ad750dd432154f822e64ba6b6e42b327157a25a /src | |
| parent | Remove unnecessary prefix from socketengine source files. (diff) | |
| parent | Fix a bunch of really obvious unnecessary includes. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src')
| -rw-r--r-- | src/base.cpp | 1 | ||||
| -rw-r--r-- | src/configreader.cpp | 36 | ||||
| -rw-r--r-- | src/helperfuncs.cpp | 2 |
3 files changed, 12 insertions, 27 deletions
diff --git a/src/base.cpp b/src/base.cpp index 063457b8b..256979286 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -25,7 +25,6 @@ #include "inspircd.h" #include "base.h" -#include <time.h> // This trick detects heap allocations of refcountbase objects static void* last_heap = NULL; diff --git a/src/configreader.cpp b/src/configreader.cpp index dbce47666..b4aaab9cc 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -154,21 +154,22 @@ void ServerConfig::CrossCheckOperClassType() void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) { - typedef std::map<std::string, std::shared_ptr<ConnectClass>> ClassMap; + typedef std::map<std::pair<std::string, char>, std::shared_ptr<ConnectClass>> ClassMap; ClassMap oldBlocksByMask; if (current) { for (auto& c : current->Classes) { - if (c->name.compare(0, 8, "unnamed-", 8)) + switch (c->type) { - oldBlocksByMask["n" + c->name] = c; - } - else if (c->type == CC_ALLOW || c->type == CC_DENY) - { - std::string typeMask = (c->type == CC_ALLOW) ? "a" : "d"; - typeMask += c->host; - oldBlocksByMask[typeMask] = c; + case CC_ALLOW: + case CC_DENY: + oldBlocksByMask[std::make_pair(c->host, c->type)] = c; + break; + + case CC_NAMED: + oldBlocksByMask[std::make_pair(c->name, c->type)] = c; + break; } } } @@ -218,24 +219,17 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) } std::string name = tag->getString("name"); - std::string mask, typeMask; + std::string mask; char type; if (tag->readString("allow", mask, false)) - { type = CC_ALLOW; - typeMask = 'a' + mask; - } else if (tag->readString("deny", mask, false)) - { type = CC_DENY; - typeMask = 'd' + mask; - } else if (!name.empty()) { type = CC_NAMED; mask = name; - typeMask = 'n' + mask; } else { @@ -243,13 +237,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) } if (name.empty()) - { name = "unnamed-" + ConvToStr(i); - } - else - { - typeMask = 'n' + name; - } if (names.find(name) != names.end()) throw CoreException("Two connect classes with name \"" + name + "\" defined!"); @@ -303,7 +291,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) me->ports.insert(port); } - ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask); + ClassMap::iterator oldMask = oldBlocksByMask.find(std::make_pair(me->name, me->type)); if (oldMask != oldBlocksByMask.end()) { std::shared_ptr<ConnectClass> old = oldMask->second; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index afd391ae4..9e3f1d4e1 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -35,8 +35,6 @@ #include "inspircd.h" #include "xline.h" -#include "exitcodes.h" -#include <iostream> /* find a channel record by channel name and return a pointer to it */ |
