Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CullList Class Reference

The CullList class can be used by modules, and is used by the core, to compile large lists of users in preperation to quitting them all at once. More...

#include <cull_list.h>

Collaboration diagram for CullList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CullList ()
 Constructor.
void AddItem (userrec *user, std::string reason)
 Adds a user to the cull list for later removal via QUIT.
int Apply ()
 Applies the cull list, quitting all the users on the list with their quit reasons all at once.

Private Attributes

std::vector< CullItemlist
 Holds a list of users being quit.
std::map< userrec *, int > exempt
 A list of users who have already been placed on the list, as a map for fast reference.

Detailed Description

The CullList class can be used by modules, and is used by the core, to compile large lists of users in preperation to quitting them all at once.

This is faster than quitting them within the loop, as the loops become tighter with little or no comparisons within them. The CullList class operates by allowing the programmer to push users onto the list, each with a seperate quit reason, and then, once the list is complete, call a method to flush the list, quitting all the users upon it. A CullList may hold local or remote users, but it may only hold each user once. If you attempt to add the same user twice, then the second attempt will be ignored.

Definition at line 75 of file cull_list.h.


Constructor & Destructor Documentation

CullList::CullList  ) 
 

Constructor.

Clears the CullList::list and CullList::exempt items.


Member Function Documentation

void CullList::AddItem userrec user,
std::string  reason
 

Adds a user to the cull list for later removal via QUIT.

Parameters:
user The user to add
reason The quit reason of the user being added

int CullList::Apply  ) 
 

Applies the cull list, quitting all the users on the list with their quit reasons all at once.

This is a very fast operation compared to iterating the user list and comparing each one, especially if there are multiple comparisons to be done, or recursion.

Returns:
The number of users removed from IRC.


Member Data Documentation

std::map<userrec*,int> CullList::exempt [private]
 

A list of users who have already been placed on the list, as a map for fast reference.

Definition at line 87 of file cull_list.h.

std::vector<CullItem> CullList::list [private]
 

Holds a list of users being quit.

See the information for CullItem for more information.

Definition at line 82 of file cull_list.h.


The documentation for this class was generated from the following file:
Generated on Thu Dec 15 11:14:18 2005 for InspIRCd by  doxygen 1.4.4-20050815