From 195956147e458d63e20308402e3485b170d49de7 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 28 Sep 2011 08:57:06 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : authoriz Ricompilazione Demo : [ ] Commento : Migliorato conteggio utenti git-svn-id: svn://10.65.10.50/branches/R_10_00@22431 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- server/authoriz.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/server/authoriz.cpp b/server/authoriz.cpp index ab88bf8ad..1dba764f0 100755 --- a/server/authoriz.cpp +++ b/server/authoriz.cpp @@ -40,7 +40,7 @@ public: bool Kill(TUserInfo* ui); void KillSession(wxSocketBase& sock, int session); - size_t GetCount() const { return size(); } + size_t GetCount() const; size_t GetLicenses() const; TUserTable(); @@ -48,13 +48,24 @@ public: WX_DECLARE_HASH_SET( wxString, wxStringHash, wxStringEqual, THostSet ); +size_t TUserTable::GetCount() const +{ + size_t n = 0; + for (TUsersHashMap::const_iterator it = begin(); it != end(); ++it) + { + const TUserInfo* ui = it->second; + n += (ui && ui->m_nPrograms > 0) ? 1 : 0; + } + return n; +} + size_t TUserTable::GetLicenses() const { THostSet hsHosts; - for( TUsersHashMap::const_iterator it = begin(); it != end(); ++it ) + for (TUsersHashMap::const_iterator it = begin(); it != end(); ++it) { TUserInfo* ui = it->second; - if (ui != NULL) + if (ui && ui->m_nPrograms > 0) hsHosts.insert(ui->m_strHost); } return hsHosts.size();