The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
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 is used by the core to create lists of users prior to actually quitting (and deleting the objects) all at once. More...

#include <cull_list.h>

Inheritance diagram for CullList:

Inheritance graph
[legend]
Collaboration diagram for CullList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CullList (InspIRCd *Instance)
 Constructor.
void AddItem (User *user)
 Adds a user to the cull list for later removal via QUIT.
void MakeSilent (User *user)
int Apply ()
 Applies the cull list, quitting all the users on the list with their quit reasons all at once.

Private Attributes

InspIRCdServerInstance
 Creator of this CullList.
std::vector< User * > list
 Holds a list of users being quit.

Detailed Description

The CullList class is used by the core to create lists of users prior to actually quitting (and deleting the objects) all at once.

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.

NOTE: Don't use this outside core, use the QuitUser method like everyone else!

Definition at line 32 of file cull_list.h.


Constructor & Destructor Documentation

CullList::CullList InspIRCd Instance  ) 
 

Constructor.

Parameters:
Instance Creator of this CullList object

Definition at line 19 of file cull_list.cpp.

References list.


Member Function Documentation

void CullList::AddItem User user  ) 
 

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
o_reason The quit reason to show only to opers

Definition at line 24 of file cull_list.cpp.

References list.

Referenced by UserManager::QuitUser().

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.

Definition at line 35 of file cull_list.cpp.

References UserManager::clientlist, User::CloseSocket(), InspIRCd::Config, DEBUG, SocketEngine::DelFd(), User::FlushWriteBuf(), FOREACH_MOD_I, EventHandler::GetFd(), EventHandler::GetIOHook(), User::GetOperQuit(), CoreException::GetReason(), CoreException::GetSource(), I_OnUserDisconnect, I_OnUserQuit, IS_LOCAL, ServerConfig::Limits, list, UserManager::local_users, LogManager::Log(), InspIRCd::Logs, ServerLimits::MaxQuit, User::nick, Module::OnRawSocketClose(), User::operquitmsg, User::PurgeEmptyChannels(), User::quitmsg, REG_ALL, User::registered, InspIRCd::SE, User::sendq, ServerInstance, InspIRCd::SilentULine(), InspIRCd::SNO, UserManager::unregistered_count, InspIRCd::Users, User::WriteCommonQuit(), and SnomaskManager::WriteToSnoMask().

Referenced by InspIRCd::Run().

void CullList::MakeSilent User user  ) 
 

Definition at line 29 of file cull_list.cpp.

References User::quietquit.

Referenced by TreeServer::QuitUsers().


Member Data Documentation

std::vector<User *> CullList::list [private]
 

Holds a list of users being quit.

See the information for CullItem for more information.

Definition at line 43 of file cull_list.h.

Referenced by AddItem(), Apply(), and CullList().

InspIRCd* CullList::ServerInstance [private]
 

Creator of this CullList.

Definition at line 37 of file cull_list.h.

Referenced by Apply().


The documentation for this class was generated from the following files: