diff options
-rw-r--r-- | include/operserv.h | 2 | ||||
-rw-r--r-- | src/operserv.cpp | 30 |
2 files changed, 29 insertions, 3 deletions
diff --git a/include/operserv.h b/include/operserv.h index 79d907c33..f40815a45 100644 --- a/include/operserv.h +++ b/include/operserv.h @@ -215,6 +215,8 @@ class SNLineManager : public XLineManager void OnExpire(XLine *x); void Send(XLine *x); + + XLine *Check(User *u); }; class SQLineManager : public XLineManager diff --git a/src/operserv.cpp b/src/operserv.cpp index 3e1f6b7bd..610d24e61 100644 --- a/src/operserv.cpp +++ b/src/operserv.cpp @@ -364,9 +364,9 @@ std::pair<int, XLine *> XLineManager::CanAdd(const Anope::string &mask, time_t e ret.first = 0; ret.second = NULL; - for (unsigned i = 0, end = this->GetCount(); i < end; ++i) + for (unsigned i = this->GetCount(); i > 0; --i) { - XLine *x = this->GetEntry(i); + XLine *x = this->GetEntry(i - 1); ret.second = x; if (x->Mask.equals_ci(mask)) @@ -392,7 +392,6 @@ std::pair<int, XLine *> XLineManager::CanAdd(const Anope::string &mask, time_t e else if (Anope::Match(x->Mask, mask) && (!expires || x->Expires <= expires)) { this->DelXLine(x); - --i; } } @@ -636,6 +635,31 @@ void SNLineManager::Send(XLine *x) ircdproto->SendSGLine(x); } +XLine *SNLineManager::Check(User *u) +{ + for (unsigned i = this->XLines.size(); i > 0; --i) + { + XLine *x = this->XLines[i - 1]; + + if (x->Expires && x->Expires < Anope::CurTime) + { + this->OnExpire(x); + this->Del(x); + delete x; + this->XLines.erase(XLines.begin() + i - 1); + continue; + } + + if (Anope::Match(u->realname, x->Mask)) + { + this->OnMatch(u, x); + return x; + } + } + + return NULL; +} + XLine *SQLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_t expires, const Anope::string &reason) { if (mask.find_first_not_of("*") == Anope::string::npos) |