]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/xline.cpp
Update wiki links to use HTTPS and point to the correct pages.
[user/henk/code/inspircd.git] / src / xline.cpp
index 12948959b9b0ebb95fcc4aa09532c13be525dfbc..0506005add1926b256762955f579b6feea55cbbf 100644 (file)
@@ -156,9 +156,10 @@ void XLineManager::CheckELines()
        if (ELines.empty())
                return;
 
-       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+       for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
        {
                User* u = (User*)(*u2);
+               u->exempt = false;
 
                /* This uses safe iteration to ensure that if a line expires here, it doenst trash the iterator */
                LookupIter safei;
@@ -169,7 +170,8 @@ void XLineManager::CheckELines()
                        safei++;
 
                        XLine *e = i->second;
-                       u->exempt = e->Matches(u);
+                       if ((!e->duration || ServerInstance->Time() < e->expiry) && e->Matches(u))
+                               u->exempt = true;
 
                        i = safei;
                }
@@ -262,7 +264,12 @@ bool XLineManager::AddLine(XLine* line, User* user)
                LookupIter i = x->second.find(line->Displayable());
                if (i != x->second.end())
                {
-                       return false;
+                       // XLine propagation bug was here, if the line to be added already exists and
+                       // it's expired then expire it and add the new one instead of returning false
+                       if ((!i->second->duration) || (ServerInstance->Time() < i->second->expiry))
+                               return false;
+
+                       ExpireLine(x, i);
                }
        }
 
@@ -320,13 +327,6 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
 
 void ELine::Unset()
 {
-       /* remove exempt from everyone and force recheck after deleting eline */
-       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
-       {
-               User* u = (User*)(*u2);
-               u->exempt = false;
-       }
-
        ServerInstance->XLines->CheckELines();
 }
 
@@ -425,7 +425,7 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
 // applies lines, removing clients and changing nicks etc as applicable
 void XLineManager::ApplyLines()
 {
-       std::vector<LocalUser*>::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
+       LocalUserList::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
        while (u2 != ServerInstance->Users->local_users.rend())
        {
                User* u = *u2++;
@@ -674,7 +674,7 @@ bool GLine::Matches(const std::string &str)
 void ELine::OnAdd()
 {
        /* When adding one eline, only check the one eline */
-       for (std::vector<LocalUser*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+       for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
        {
                User* u = (User*)(*u2);
                if (this->Matches(u))