]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/xline.cpp
Calculate hosts on connect so theres no way around a ban on your cloak, even if you...
[user/henk/code/inspircd.git] / src / xline.cpp
index 3f0ddbf2b14104ae6f34db8d7c957a96454f93a6..47e12242053344ffe81d1000b51ac91b9fb869b8 100644 (file)
@@ -158,7 +158,13 @@ bool XLineManager::AddLine(XLine* line, User* user)
                return false;
 
        /*ELine* item = new ELine(ServerInstance, ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/
-       pending_lines.push_back(line);
+       XLineFactory* xlf = GetFactory(line->type);
+       if (!xlf)
+               return false;
+
+       if (xlf->AutoApplyToUserList(line))
+               pending_lines.push_back(line);
+
        lookup_lines[line->type][line->Displayable()] = line;
        line->OnAdd();
 
@@ -403,15 +409,18 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache)
        if (*ServerInstance->Config->MoronBanner)
                u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
        if (ServerInstance->Config->HideBans)
-               User::QuitUser(ServerInstance, u, line + "-Lined", sreason);
+               ServerInstance->Users->QuitUser(u, line + "-Lined", sreason);
        else
-               User::QuitUser(ServerInstance, u, sreason);
+               ServerInstance->Users->QuitUser(u, sreason);
 
 
        if (bancache)
        {
                ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Adding positive hit (") + line + ") for " + u->GetIPString());
-               ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason);
+               if (this->duration > 0)
+                       ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason, this->duration);
+               else
+                       ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason);
        }
 }