1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __CULLLIST_H__
15 #define __CULLLIST_H__
17 /** The CullList class is used by the core to create lists of users
18 * prior to actually quitting (and deleting the objects) all at once.
19 * to quitting them all at once. This is faster than quitting
20 * them within the loop, as the loops become tighter with
21 * little or no comparisons within them. The CullList class
22 * operates by allowing the programmer to push users onto
23 * the list, each with a seperate quit reason, and then, once
24 * the list is complete, call a method to flush the list,
25 * quitting all the users upon it. A CullList may hold local
26 * or remote users, but it may only hold each user once. If
27 * you attempt to add the same user twice, then the second
28 * attempt will be ignored.
30 * NOTE: Don't use this outside core, use the QuitUser method like everyone else!
32 class CoreExport CullList : public classbase
35 /** Creator of this CullList
37 InspIRCd* ServerInstance;
39 /** Holds a list of users being quit.
40 * See the information for CullItem for
43 std::vector<User *> list;
47 * @param Instance Creator of this CullList object
49 CullList(InspIRCd* Instance);
51 /** Adds a user to the cull list for later
53 * @param user The user to add
54 * @param reason The quit reason of the user being added
55 * @param o_reason The quit reason to show only to opers
57 void AddItem(User* user);
59 /* Turn an item into a silent item (don't send out QUIT for this user)
61 void MakeSilent(User* user);
63 /** Applies the cull list, quitting all the users
64 * on the list with their quit reasons all at once.
65 * This is a very fast operation compared to
66 * iterating the user list and comparing each one,
67 * especially if there are multiple comparisons
68 * to be done, or recursion.
69 * @returns The number of users removed from IRC.