@@ -66,6 +66,7 @@ DistributedChatService::DistributedChatService(uint32_t serv_type,p3ServiceContr
6666{
6767 _time_shift_average = 0 .0f ;
6868 _should_reset_lobby_counts = false ;
69+ _allow_history_sharing = false ;
6970 last_visible_lobby_info_request_time = 0 ;
7071}
7172
@@ -2149,6 +2150,15 @@ void DistributedChatService::addToSaveList(std::list<RsItem*>& list) const
21492150 list.push_back (vitem);
21502151 }
21512152
2153+ /* Save Allow History Sharing */
2154+ {
2155+ RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
2156+ RsTlvKeyValue kv;
2157+ kv.key = " ALLOW_HISTORY_SHARING" ;
2158+ kv.value = _allow_history_sharing ? " 1" : " 0" ;
2159+ vitem->tlvkvs .pairs .push_back (kv);
2160+ list.push_back (vitem);
2161+ }
21522162}
21532163
21542164bool DistributedChatService::processLoadListItem (const RsItem *item)
@@ -2174,6 +2184,12 @@ bool DistributedChatService::processLoadListItem(const RsItem *item)
21742184 return true ;
21752185 }
21762186
2187+ if ( kit->key == " ALLOW_HISTORY_SHARING" )
2188+ {
2189+ _allow_history_sharing = (kit->value == " 1" ) ;
2190+ return true ;
2191+ }
2192+
21772193 if ( kit->key .compare (0 , strldID.length (), strldID) == 0 )
21782194 {
21792195#ifdef DEBUG_CHAT_LOBBIES
@@ -2324,6 +2340,13 @@ void DistributedChatService::handleRecvLobbyHistoryProbe(RsChatLobbyHistoryProbe
23242340 }
23252341 }
23262342
2343+ // Check if we allow sharing history
2344+ if (!_allow_history_sharing)
2345+ {
2346+ std::cerr << " handleRecvLobbyHistoryProbe(): history sharing is disabled. Ignoring." << std::endl;
2347+ return ;
2348+ }
2349+
23272350 // Retrieve our local history for this lobby
23282351 std::list<HistoryMsg> msgs ;
23292352 mHistMgr ->getMessages (ChatId (item->lobby_id ), msgs, 0 ) ; // 0 = get all available
@@ -2408,6 +2431,13 @@ void DistributedChatService::handleRecvLobbyHistoryRequest(RsChatLobbyHistoryReq
24082431 }
24092432 }
24102433
2434+ // Check if we allow sharing history
2435+ if (!_allow_history_sharing)
2436+ {
2437+ std::cerr << " handleRecvLobbyHistoryRequest(): history sharing is disabled. Ignoring." << std::endl;
2438+ return ;
2439+ }
2440+
24112441 // Retrieve local history
24122442 std::list<HistoryMsg> msgs ;
24132443 mHistMgr ->getMessages (ChatId (item->lobby_id ), msgs, item->max_count ) ;
0 commit comments