From bc730a5d1a6df1c3ff5000a96eda6e153134ae04 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 25 Mar 2014 11:02:44 +0100 Subject: [PATCH] Add typedef OperList to UserManager for use with all_opers --- include/usermanager.h | 6 +++++- src/coremods/core_stats.cpp | 3 ++- src/coremods/core_who.cpp | 3 ++- src/snomasks.cpp | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/usermanager.h b/include/usermanager.h index eb1d75e8d..57306c8fb 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -35,6 +35,10 @@ class CoreExport UserManager */ typedef std::map CloneMap; + /** Sequence container in which each element is a User* + */ + typedef std::list OperList; + private: /** Map of IP addresses for clone counting */ @@ -68,7 +72,7 @@ class CoreExport UserManager /** Oper list, a vector containing all local and remote opered users */ - std::list all_opers; + OperList all_opers; /** Number of unregistered users online right now. * (Unregistered means before USER/NICK/dns) diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 4f53f3270..a593ac94d 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -146,7 +146,8 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) case 'P': { unsigned int idx = 0; - for (std::list::const_iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); ++i) + const UserManager::OperList& opers = ServerInstance->Users->all_opers; + for (UserManager::OperList::const_iterator i = opers.begin(); i != opers.end(); ++i) { User* oper = *i; if (!oper->server->IsULine()) diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index 523d857ce..670f05a90 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -347,7 +347,8 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * if (opt_viewopersonly) { /* Showing only opers */ - for (std::list::iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); i++) + const UserManager::OperList& opers = ServerInstance->Users->all_opers; + for (UserManager::OperList::const_iterator i = opers.begin(); i != opers.end(); ++i) { User* oper = *i; diff --git a/src/snomasks.cpp b/src/snomasks.cpp index e0305ea06..738d0970d 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -132,8 +132,8 @@ void Snomask::Send(char letter, const std::string& desc, const std::string& msg) std::string finalmsg = "*** "; finalmsg.append(log); /* Only opers can receive snotices, so we iterate the oper list */ - const std::list& opers = ServerInstance->Users->all_opers; - for (std::list::const_iterator i = opers.begin(); i != opers.end(); ++i) + const UserManager::OperList& opers = ServerInstance->Users->all_opers; + for (UserManager::OperList::const_iterator i = opers.begin(); i != opers.end(); ++i) { User* user = *i; // IsNoticeMaskSet() returns false for opers who aren't +s, no need to check for it seperately -- 2.39.2