InspIRCd  3.0
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
UserManager Class Reference
Inheritance diagram for UserManager:
fakederef< UserManager >

Classes

struct  CloneCounts
 

Public Types

typedef std::map< irc::sockets::cidr_mask, CloneCountsCloneMap
 
typedef std::vector< User * > OperList
 
typedef insp::intrusive_list< LocalUserLocalList
 

Public Member Functions

 UserManager ()
 
 ~UserManager ()
 
void DoBackgroundUserStuff ()
 
bool AllModulesReportReady (LocalUser *user)
 
void AddUser (int socket, ListenSocket *via, irc::sockets::sockaddrs *client, irc::sockets::sockaddrs *server)
 
void QuitUser (User *user, const std::string &quitreason, const std::string *operreason=NULL)
 
void AddClone (User *user)
 
void RemoveCloneCounts (User *user)
 
void RehashCloneCounts ()
 
const CloneCountsGetCloneCounts (User *user) const
 
const CloneMapGetCloneMap () const
 
unsigned int UserCount () const
 
unsigned int RegisteredUserCount ()
 
unsigned int OperCount () const
 
unsigned int UnregisteredUserCount () const
 
unsigned int LocalUserCount () const
 
user_hash & GetUsers ()
 
const LocalListGetLocalUsers () const
 
void ServerNoticeAll (const char *text,...) CUSTOM_PRINTF(2
 
void already_sent_t NextAlreadySentId ()
 
- Public Member Functions inherited from fakederef< UserManager >
UserManageroperator-> ()
 

Public Attributes

user_hash clientlist
 
user_hash uuidlist
 
OperList all_opers
 
unsigned int unregistered_count
 

Member Typedef Documentation

◆ CloneMap

Container that maps IP addresses to clone counts

◆ LocalList

A list holding local users

◆ OperList

typedef std::vector<User*> UserManager::OperList

Sequence container in which each element is a User*

Constructor & Destructor Documentation

◆ UserManager()

UserManager::UserManager ( )

Constructor, initializes variables

◆ ~UserManager()

UserManager::~UserManager ( )

Destructor, destroys all users in clientlist

Member Function Documentation

◆ AddClone()

void UserManager::AddClone ( User user)

Add a user to the clone map

Parameters
userThe user to add

◆ AddUser()

void UserManager::AddUser ( int  socket,
ListenSocket via,
irc::sockets::sockaddrs client,
irc::sockets::sockaddrs server 
)

Handle a client connection. Creates a new LocalUser object, inserts it into the appropriate containers, initializes it as not yet registered, and adds it to the socket engine.

The new user may immediately be quit after being created, for example if the user limit is reached or if the user is banned.

Parameters
socketFile descriptor of the connection
viaListener socket that this user connected to
clientThe IP address and client port of the user
serverThe server IP address and port used by the user

◆ AllModulesReportReady()

bool UserManager::AllModulesReportReady ( LocalUser user)

Returns true when all modules have done pre-registration checks on a user

Parameters
userThe user to verify
Returns
True if all modules have finished checking this user

◆ DoBackgroundUserStuff()

void UserManager::DoBackgroundUserStuff ( )

Perform background user events for all local users such as PING checks, registration timeouts, penalty management and recvq processing for users who have data in their recvq due to throttling.

This function is called once a second from the mainloop. It is intended to do background checking on all the users, e.g. do ping checks, registration timeouts, etc.

◆ GetCloneCounts()

const UserManager::CloneCounts & UserManager::GetCloneCounts ( User user) const

Return the number of local and global clones of this user

Parameters
userThe user to get the clone counts for
Returns
The clone counts of this user. The returned reference is volatile - you must assume that it becomes invalid as soon as you call any function other than your own.

◆ GetCloneMap()

const CloneMap& UserManager::GetCloneMap ( ) const
inline

Return a map containg IP addresses and their clone counts

Returns
The clone count map

◆ GetLocalUsers()

const LocalList& UserManager::GetLocalUsers ( ) const
inline

Get a list containing all local users

Returns
A const list of local users

◆ GetUsers()

user_hash& UserManager::GetUsers ( )
inline

Get a hash map containing all users, keyed by their nickname

Returns
A hash map mapping nicknames to User pointers

◆ LocalUserCount()

unsigned int UserManager::LocalUserCount ( ) const
inline

Return a count of local registered users

Returns
The number of registered local users

◆ NextAlreadySentId()

already_sent_t UserManager::NextAlreadySentId ( )

Retrieves the next already sent id, guaranteed to be not equal to any user's already_sent field

Returns
Next already_sent id

◆ OperCount()

unsigned int UserManager::OperCount ( ) const
inline

Return a count of opered (umode +o) users on the network

Returns
The number of opers on the network

◆ QuitUser()

void UserManager::QuitUser ( User user,
const std::string &  quitreason,
const std::string *  operreason = NULL 
)

Disconnect a user gracefully. When this method returns the user provided will be quit, but the User object will continue to be valid and will be deleted at the end of the current main loop iteration.

Parameters
userThe user to remove
quitreasonThe quit reason to show to normal users
operreasonThe quit reason to show to opers, can be NULL if same as quitreason

◆ RegisteredUserCount()

unsigned int UserManager::RegisteredUserCount ( )
inline

Return a count of fully registered connections on the network

Returns
The number of registered users on the network

◆ RehashCloneCounts()

void UserManager::RehashCloneCounts ( )

Rebuild clone counts. Required when <cidr> settings change.

◆ RemoveCloneCounts()

void UserManager::RemoveCloneCounts ( User user)

Remove all clone counts from the user, you should use this if you change the user's IP address after they have registered.

Parameters
userThe user to remove

◆ ServerNoticeAll()

void UserManager::ServerNoticeAll ( const char *  text,
  ... 
)

Send a server notice to all local users

Parameters
textThe text format string to send
...The format arguments

◆ UnregisteredUserCount()

unsigned int UserManager::UnregisteredUserCount ( ) const
inline

Return a count of local unregistered (before NICK/USER) users

Returns
The number of local unregistered (unknown) connections

◆ UserCount()

unsigned int UserManager::UserCount ( ) const
inline

Return a count of all global users, unknown and known connections

Returns
The number of users on the network, including local unregistered users

Member Data Documentation

◆ all_opers

OperList UserManager::all_opers

Oper list, a vector containing all local and remote opered users

◆ clientlist

user_hash UserManager::clientlist

Nickname string -> User* map. Contains all users, including unregistered ones.

◆ unregistered_count

unsigned int UserManager::unregistered_count

Number of unregistered users online right now. (Unregistered means before USER/NICK/dns)

◆ uuidlist

user_hash UserManager::uuidlist

UUID -> User* map. Contains all users, including unregistered ones.


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