diff options
-rw-r--r-- | include/xline.h | 12 | ||||
-rw-r--r-- | src/xline.cpp | 46 |
2 files changed, 50 insertions, 8 deletions
diff --git a/include/xline.h b/include/xline.h index 794f9b794..d5dd87aa5 100644 --- a/include/xline.h +++ b/include/xline.h @@ -59,7 +59,7 @@ class CoreExport XLine : public classbase /** Returns true whether or not the given user is covered by this line. */ - virtual bool Matches(User *u); + virtual bool Matches(User *u) = 0; /** The time the line was added. */ @@ -109,6 +109,8 @@ class CoreExport KLine : public XLine free(hostmask); } + virtual bool Matches(User *u); + /** Ident mask */ char* identmask; @@ -144,6 +146,8 @@ class CoreExport GLine : public XLine free(hostmask); } + virtual bool Matches(User *u); + /** Ident mask */ char* identmask; @@ -177,6 +181,8 @@ class CoreExport ELine : public XLine free(hostmask); } + virtual bool Matches(User *u); + /** Ident mask */ char* identmask; @@ -209,6 +215,8 @@ class CoreExport ZLine : public XLine free(ipaddr); } + virtual bool Matches(User *u); + /** IP mask */ char* ipaddr; @@ -236,7 +244,9 @@ class CoreExport QLine : public XLine ~QLine() { free(nick); + } + virtual bool Matches(User *u); /** Nickname mask */ diff --git a/src/xline.cpp b/src/xline.cpp index 1387ac755..eca06b06d 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -486,13 +486,8 @@ KLine* XLineManager::matches_kline(User* user) for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++) { - if ((match(user->ident,(*i)->identmask))) - { - if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true))) - { - return (*i); - } - } + if ((*i)->Matches(user)) + return (*i); } return NULL; @@ -666,3 +661,40 @@ void XLineManager::stats_e(User* user, string_list &results) XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance) { } + + + +bool KLine::Matches(User *u) +{ + if ((match(u->ident, this->identmask))) + { + if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) + { + return true; + } + } + + return false; +} + +bool GLine::Matches(User *u) +{ + return false; +} + +bool ELine::Matches(User *u) +{ + return false; +} + +bool ZLine::Matches(User *u) +{ + return false; +} + +bool QLine::Matches(User *u) +{ + return false; +} + + |