From 7d7101a62db0f8c23004297779f0d9ae27fbd534 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Jan 2012 13:00:57 +0000 Subject: [PATCH] improved counting method for public lobbies git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4802 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3chatservice.cc | 10 +++++++++- libretroshare/src/services/p3chatservice.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index d44c89cea..49ea858e0 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -58,6 +58,7 @@ p3ChatService::p3ChatService(p3LinkMgr *lm, p3HistoryMgr *historyMgr) _own_avatar = NULL ; _custom_status_string = "" ; _default_nick_name = rsPeers->getPeerName(rsPeers->getOwnId()); + _should_reset_lobby_counts = false ; last_public_lobby_info_request_time = 0 ; } @@ -687,12 +688,18 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item) rec.lobby_id = item->lobby_ids[i] ; rec.lobby_name = item->lobby_names[i] ; rec.participating_friends.insert(item->PeerId()) ; - rec.total_number_of_peers = item->lobby_counts[i] ; + + if(_should_reset_lobby_counts) + rec.total_number_of_peers = item->lobby_counts[i] ; + else + rec.total_number_of_peers = std::max(rec.total_number_of_peers,item->lobby_counts[i]) ; + rec.last_report_time = now ; } } rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ; + _should_reset_lobby_counts = false ; } void p3ChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item) @@ -929,6 +936,7 @@ void p3ChatService::getListOfNearbyChatLobbies(std::vector