diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-04-01 16:42:04 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-01 16:42:04 +0200 |
commit | 153bd37b598373f4f52024747ee3bc2cbb76f629 (patch) | |
tree | eacb36ec4ecd4b84928070e1147494ab2eb96a4f /src | |
parent | 157d9445f53ff63cfabf19d5f16ebdf84e6e0454 (diff) |
cmd_stats List opers without iterating the whole userlist
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_stats.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 9a5bfc52d..898e89a7d 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -161,13 +161,14 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) case 'P': { - int idx = 0; - for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++) + unsigned int idx = 0; + for (std::list<User*>::const_iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); ++i) { - if (IS_OPER(i->second) && !ServerInstance->ULine(i->second->server)) + User* oper = *i; + if (!ServerInstance->ULine(oper->server)) { - results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+ - (IS_LOCAL(i->second) ? ConvToStr(ServerInstance->Time() - i->second->idle_lastmsg) + " secs" : "unavailable")); + results.push_back(sn+" 249 " + user->nick + " :" + oper->nick + " (" + oper->ident + "@" + oper->dhost + ") Idle: " + + (IS_LOCAL(oper) ? ConvToStr(ServerInstance->Time() - oper->idle_lastmsg) + " secs" : "unavailable")); idx++; } } |