summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 21:37:22 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-28 21:37:22 +0000
commitae8341627017a0a1b1e1033c6239b4ebb16e7219 (patch)
tree247b146af6ff675e9792061470cf8794a871b7d1 /src
parent7dbd30b89c18f212041582f6638f2ae1b62a5b4d (diff)
Make ELines cached, and check for ELined status in all the Matches for all the linetypes. Brain, SVN up before you overwrite my fixes to bits of this again :P
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8417 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/xline.cpp59
1 files changed, 34 insertions, 25 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index 9af297e31..7979a1d82 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -137,6 +137,23 @@ bool XLine::Matches(User *u)
return false;
}
+//XXX perhaps move into xlinemanager
+void CheckELines(InspIRCd *ServerInstance, std::vector<ELine *> &ELines)
+{
+ for (std::vector<User*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
+ {
+ User* u = (User*)(*u2);
+
+ for (std::vector<ELine *>::iterator i = ELines.begin(); i != ELines.end(); i++)
+ {
+ ELine *e = (*i);
+
+ u->exempt = e->Matches(u);
+ }
+ }
+}
+
+
IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host)
{
IdentHostPair n = std::make_pair<std::string,std::string>("*","*");
@@ -553,21 +570,6 @@ void XLineManager::expire_lines()
}
-void CheckELines(InspIRCd *ServerInstance, const std::vector &ELines)
-{
- for (std::vector<User*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
- {
- User* u = (User*)(*u2);
-
- for (std::vector<ELine *>::iterator i = ELines.begin(); i != ELines.end(); i++)
- {
- ELine *e = (*i);
-
- u->exempt = e->Matches(u);
- }
- }
-}
-
// applies lines, removing clients and changing nicks etc as applicable
void XLineManager::ApplyLines()
{
@@ -575,14 +577,6 @@ void XLineManager::ApplyLines()
{
User* u = (User*)(*u2);
- if (elines.size())
- {
- // ignore people matching exempts -- XXX cache the exempt state in userrec permanently?
- // should be fairly easy to accomplish really, and might achieve some nice gains?
- if (matches_exception(u))
- continue;
- }
-
for (std::vector<XLine *>::iterator i = pending_lines.begin(); i != pending_lines.end(); i++)
{
XLine *x = *i;
@@ -633,7 +627,7 @@ XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance)
{
}
-virtual bool Matches(const std::string &str)
+bool XLine::Matches(const std::string &str)
{
return false;
}
@@ -656,6 +650,9 @@ void XLine::DefaultApply(User* u, char line)
bool KLine::Matches(User *u)
{
+ if (u->exempt)
+ return false;
+
if ((match(u->ident, this->identmask)))
{
if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
@@ -674,6 +671,9 @@ void KLine::Apply(User* u)
bool GLine::Matches(User *u)
{
+ if (u->exempt)
+ return false;
+
if ((match(u->ident, this->identmask)))
{
if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
@@ -692,6 +692,9 @@ void GLine::Apply(User* u)
bool ELine::Matches(User *u)
{
+ if (u->exempt)
+ return false;
+
if ((match(u->ident, this->identmask)))
{
if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true)))
@@ -705,6 +708,9 @@ bool ELine::Matches(User *u)
bool ZLine::Matches(User *u)
{
+ if (u->exempt)
+ return false;
+
if (match(u->GetIPString(), this->ipaddr, true))
return true;
else
@@ -719,7 +725,10 @@ void ZLine::Apply(User* u)
bool QLine::Matches(User *u)
{
- if (match(user->nick, this->nick))
+ if (u->exempt)
+ return false;
+
+ if (match(u->nick, this->nick))
return true;
return false;