Get guest users from session manager

This commit is contained in:
Albert Medela
2016-07-18 19:35:59 +02:00
parent 21003da510
commit 1abc9dc452
6 changed files with 25 additions and 42 deletions
+18
View File
@@ -432,3 +432,21 @@ SessionManager::SendToAllButOneSessions(SenderHelper &sender, boost::shared_ptr<
++i;
}
}
unsigned
SessionManager::GetGuestsCount() const
{
unsigned counter = 0;
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
SessionMap::const_iterator i = m_sessionMap.begin();
SessionMap::const_iterator end = m_sessionMap.end();
while (i != end) {
if (i->second && i->second->GetPlayerData() &&
i->second->GetPlayerData()->GetRights() == PLAYER_RIGHTS_GUEST)
++counter;
++i;
}
return counter;
}