#include "inspircd.h"
#include "xline.h"
-#include "bancache.h"
/** An XLineFactory specialized to generate GLine* pointers
*/
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;
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);
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);
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;
* 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);
// applies lines, removing clients and changing nicks etc as applicable
void XLineManager::ApplyLines()
{
- LocalUserList::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin();
- while (u2 != ServerInstance->Users->local_users.rend())
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator j = list.begin(); j != list.end(); ++j)
{
- LocalUser* u = *u2++;
+ LocalUser* u = *j;
// Don't ban people who are exempt.
if (u->exempt)
ExpireLine(n, i);
}
else
- results.push_back(ServerInstance->Config->ServerName+" "+ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+
+ results.push_back(ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+
ConvToStr(i->second->set_time)+" "+ConvToStr(i->second->duration)+" "+i->second->source+" :"+i->second->reason);
i = safei;
}
u->WriteNotice("*** " + ServerInstance->Config->XLineMessage);
if (ServerInstance->Config->HideBans)
- ServerInstance->Users->QuitUser(u, line + "-Lined", banReason.c_str());
+ ServerInstance->Users->QuitUser(u, line + "-Lined", &banReason);
else
ServerInstance->Users->QuitUser(u, banReason);
if (bancache)
{
ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString());
- ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason, this->duration);
+ ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration);
}
}
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);
}
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))