1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 #include "cull_list.h"
19 CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance)
24 void CullList::AddItem(User* user)
29 void CullList::MakeSilent(User* user)
31 user->quietquit = true;
41 std::vector<User *>::iterator a = list.begin();
44 // user has been moved onto their UID; that's why this isn't find(u->nick)
45 user_hash::iterator iter = ServerInstance->Users->clientlist->find(u->uuid);
47 if (u->registered != REG_ALL)
48 if (ServerInstance->Users->unregistered_count)
49 ServerInstance->Users->unregistered_count--;
53 if (!u->sendq.empty())
60 u->GetIOHook()->OnRawSocketClose(u->GetFd());
62 catch (CoreException& modexcept)
64 ServerInstance->Logs->Log("CULLLIST",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
68 ServerInstance->SE->DelFd(u);
73 * this must come before the ServerInstance->SNO->WriteToSnoMaskso that it doesnt try to fill their buffer with anything
74 * if they were an oper with +sn +qQ.
76 if (u->registered == REG_ALL)
82 ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]", u->nick.c_str(), u->ident.c_str(), u->host.c_str(), u->operquitmsg.c_str());
87 if ((!ServerInstance->SilentULine(u->server)) && (!u->quietquit))
89 ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", u->server, u->nick.c_str(), u->ident.c_str(), u->host.c_str(), u->operquitmsg.c_str());
95 if (iter != ServerInstance->Users->clientlist->end())
97 ServerInstance->Users->clientlist->erase(iter);
101 ServerInstance->Logs->Log("CULLLIST", DEBUG, "iter == clientlist->end, can't remove them from hash... problematic..");
106 std::vector<User*>::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),u);
107 if (x != ServerInstance->Users->local_users.end())
108 ServerInstance->Users->local_users.erase(x);
111 ServerInstance->Logs->Log("CULLLIST", DEBUG, "Failed to remove user from vector..");
116 list.erase(list.begin());