diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/configreader.cpp | 26 | ||||
-rw-r--r-- | src/userprocess.cpp | 7 | ||||
-rw-r--r-- | src/xline.cpp | 20 |
3 files changed, 42 insertions, 11 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index e0d66d525..96f461162 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1924,7 +1924,10 @@ bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* reason = values[0].GetString(); const char* ipmask = values[1].GetString(); - conf->GetInstance()->XLines->AddZLine(0,"<Config>",reason,ipmask); + ZLine* zl = new ZLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ipmask); + if (!conf->GetInstance()->XLines->AddLine(zl)) + delete zl; + return true; } @@ -1933,7 +1936,10 @@ bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* reason = values[0].GetString(); const char* nick = values[1].GetString(); - conf->GetInstance()->XLines->AddQLine(0,"<Config>",reason,nick); + QLine* ql = new QLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, nick); + if (!conf->GetInstance()->XLines->AddLine(ql)) + delete ql; + return true; } @@ -1942,7 +1948,13 @@ bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* reason = values[0].GetString(); const char* host = values[1].GetString(); - conf->GetInstance()->XLines->AddKLine(0,"<Config>",reason,host); + XLineManager* xlm = conf->GetInstance()->XLines; + + IdentHostPair ih = xlm->IdentSplit(host); + + KLine* kl = new KLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); + if (!xlm->AddLine(kl)) + delete kl; return true; } @@ -1951,7 +1963,13 @@ bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* reason = values[0].GetString(); const char* host = values[1].GetString(); - conf->GetInstance()->XLines->AddELine(0,"<Config>",reason,host); + XLineManager* xlm = conf->GetInstance()->XLines; + + IdentHostPair ih = xlm->IdentSplit(host); + + ELine* el = new ELine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); + if (!xlm->AddLine(el)) + delete el; return true; } diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 066800409..39d3ad0ec 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -29,8 +29,11 @@ void FloodQuitUserHandler::Call(User* current) if (current->registered != REG_ALL) { - Server->XLines->AddZLine(120, Server->Config->ServerName, "Flood from unregistered connection", current->GetIPString()); - Server->XLines->ApplyLines(); + ZLine* zl = new ZLine(Server, Server->Time(), 0, Server->Config->ServerName, "Flood from unregistered connection", current->GetIPString()); + if (Server->XLines->AddLine(zl)) + Server->XLines->ApplyLines(); + else + delete zl; } } diff --git a/src/xline.cpp b/src/xline.cpp index 9a56450ff..bc505dcc5 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -428,11 +428,6 @@ XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance) { } -bool XLine::Matches(const std::string &str) -{ - return false; -} - void XLine::Apply(User* u) { } @@ -558,6 +553,21 @@ bool QLine::Matches(const std::string &str) return false; } +bool ELine::Matches(const std::string &str) +{ + return ((match(str.c_str(), matchtext.c_str(), true))); +} + +bool KLine::Matches(const std::string &str) +{ + return ((match(str.c_str(), matchtext.c_str(), true))); +} + +bool GLine::Matches(const std::string &str) +{ + return ((match(str.c_str(), matchtext.c_str(), true))); +} + virtual bool ELine::MatchesLiteral(const std::string &str) { return (assign(str) == irc::string(this->identmask) + '@' + this->hostmask); |