summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index 20693b599..b116d2e1f 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -23,7 +23,6 @@
#include "inspircd.h"
#include "xline.h"
-#include "bancache.h"
/** An XLineFactory specialized to generate GLine* pointers
*/
@@ -156,7 +155,8 @@ void XLineManager::CheckELines()
if (ELines.empty())
return;
- for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
@@ -259,7 +259,7 @@ bool XLineManager::AddLine(XLine* line, User* user)
ContainerIter x = lookup_lines.find(line->type);
if (x != lookup_lines.end())
{
- LookupIter i = x->second.find(line->Displayable().c_str());
+ LookupIter i = x->second.find(line->Displayable());
if (i != x->second.end())
{
// XLine propagation bug was here, if the line to be added already exists and
@@ -276,12 +276,12 @@ bool XLineManager::AddLine(XLine* line, User* user)
if (!xlf)
return false;
- ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here?
+ ServerInstance->BanCache.RemoveEntries(line->type, false); // XXX perhaps remove ELines here?
if (xlf->AutoApplyToUserList(line))
pending_lines.push_back(line);
- lookup_lines[line->type][line->Displayable().c_str()] = line;
+ lookup_lines[line->type][line->Displayable()] = line;
line->OnAdd();
FOREACH_MOD(OnAddLine, (user, line));
@@ -306,15 +306,13 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
if (simulate)
return true;
- ServerInstance->BanCache->RemoveEntries(y->second->type, true);
+ ServerInstance->BanCache.RemoveEntries(y->second->type, true);
FOREACH_MOD(OnDelLine, (user, y->second));
y->second->Unset();
- std::vector<XLine*>::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), y->second);
- if (pptr != pending_lines.end())
- pending_lines.erase(pptr);
+ stdalgo::erase(pending_lines, y->second);
delete y->second;
x->second.erase(y);
@@ -326,7 +324,8 @@ 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 (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
u->exempt = false;
@@ -418,9 +417,7 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
* is pending, cleared when it is no longer pending, so we skip over this loop if its not pending?
* -- Brain
*/
- std::vector<XLine*>::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), item->second);
- if (pptr != pending_lines.end())
- pending_lines.erase(pptr);
+ stdalgo::erase(pending_lines, item->second);
delete item->second;
container->second.erase(item);
@@ -430,8 +427,8 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item)
// applies lines, removing clients and changing nicks etc as applicable
void XLineManager::ApplyLines()
{
- LocalUserList& list = ServerInstance->Users->local_users;
- for (LocalUserList::iterator j = list.begin(); j != list.end(); ++j)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator j = list.begin(); j != list.end(); ++j)
{
LocalUser* u = *j;
@@ -450,7 +447,7 @@ void XLineManager::ApplyLines()
pending_lines.clear();
}
-void XLineManager::InvokeStats(const std::string &type, int numeric, User* user, string_list &results)
+void XLineManager::InvokeStats(const std::string& type, unsigned int numeric, Stats::Context& stats)
{
ContainerIter n = lookup_lines.find(type);
@@ -471,7 +468,7 @@ void XLineManager::InvokeStats(const std::string &type, int numeric, User* user,
ExpireLine(n, i);
}
else
- results.push_back(ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+
+ stats.AddRow(numeric, i->second->Displayable()+" "+
ConvToStr(i->second->set_time)+" "+ConvToStr(i->second->duration)+" "+i->second->source+" :"+i->second->reason);
i = safei;
}
@@ -534,7 +531,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache)
const std::string banReason = line + "-Lined: " + reason;
if (!ServerInstance->Config->XLineMessage.empty())
- u->WriteNotice("*** " + ServerInstance->Config->XLineMessage);
+ u->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage);
if (ServerInstance->Config->HideBans)
ServerInstance->Users->QuitUser(u, line + "-Lined", &banReason);
@@ -545,7 +542,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache)
if (bancache)
{
ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString());
- ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, banReason, this->duration);
+ ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration);
}
}
@@ -642,7 +639,7 @@ bool QLine::Matches(User *u)
void QLine::Apply(User* u)
{
/* Force to uuid on apply of qline, no need to disconnect any more :) */
- u->ForceNickChange(u->uuid);
+ u->ChangeNick(u->uuid);
}
@@ -680,7 +677,8 @@ bool GLine::Matches(const std::string &str)
void ELine::OnAdd()
{
/* When adding one eline, only check the one eline */
- for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator u2 = list.begin(); u2 != list.end(); u2++)
{
LocalUser* u = *u2;
if (this->Matches(u))