diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-17 12:17:09 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-17 12:17:09 +0000 |
commit | 1e5728d84c1b4b0d86bf745ce253aa458575df20 (patch) | |
tree | b05d280fa7dec2fe9c56cba0c8e0143984d947cd /src/usermanager.cpp | |
parent | bf77b312c8e15da249991cff43432c21b44807d7 (diff) |
Move a number of methods from class InspIRCd to class UserManager
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8726 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r-- | src/usermanager.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp index c980e0eb3..bc5eb01a9 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -237,3 +237,41 @@ unsigned long UserManager::LocalCloneCount(User *user) else return 0; } + +/* this function counts all users connected, wether they are registered or NOT. */ +unsigned int UserManager::UserCount() +{ + /* + * XXX: Todo: + * As part of this restructuring, move clientlist/etc fields into usermanager. + * -- w00t + */ + return ServerInstance->clientlist->size(); +} + +/* this counts only registered users, so that the percentages in /MAP don't mess up */ +unsigned int UserManager::RegisteredUserCount() +{ + return ServerInstance->clientlist->size() - this->UnregisteredUserCount(); +} + +/* return how many users are opered */ +unsigned int UserManager::OperCount() +{ + return ServerInstance->all_opers.size(); +} + +/* return how many users are unregistered */ +unsigned int UserManager::UnregisteredUserCount() +{ + return ServerInstance->unregistered_count; +} + +/* return how many local registered users there are */ +unsigned int UserManager::LocalUserCount() +{ + /* Doesnt count unregistered clients */ + return (ServerInstance->local_users.size() - this->UnregisteredUserCount()); +} + + |