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;
40 while (list.size() && i++ != 100)
42 std::vector<User *>::iterator a = list.begin();
45 // user has been moved onto their UID; that's why this isn't find(u->nick)
46 user_hash::iterator iter = ServerInstance->Users->clientlist->find(u->uuid);
48 if (u->registered != REG_ALL)
49 if (ServerInstance->Users->unregistered_count)
50 ServerInstance->Users->unregistered_count--;
54 if (!u->sendq.empty())
61 u->GetIOHook()->OnRawSocketClose(u->GetFd());
63 catch (CoreException& modexcept)
65 ServerInstance->Logs->Log("CULLLIST",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
69 ServerInstance->SE->DelFd(u);
74 * this must come before the ServerInstance->SNO->WriteToSnoMaskso that it doesnt try to fill their buffer with anything
75 * if they were an oper with +sn +qQ.
77 if (u->registered == REG_ALL)
83 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());
88 if ((!ServerInstance->SilentULine(u->server)) && (!u->quietquit))
90 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());
96 if (iter != ServerInstance->Users->clientlist->end())
98 ServerInstance->Users->clientlist->erase(iter);
102 ServerInstance->Logs->Log("CULLLIST", DEBUG, "iter == clientlist->end, can't remove them from hash... problematic..");
107 std::vector<User*>::iterator x = find(ServerInstance->Users->local_users.begin(),ServerInstance->Users->local_users.end(),u);
108 if (x != ServerInstance->Users->local_users.end())
109 ServerInstance->Users->local_users.erase(x);
112 ServerInstance->Logs->Log("CULLLIST", DEBUG, "Failed to remove user from vector..");
117 list.erase(list.begin());