Example #1
0
void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on)
{
	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
	LLUUID session_id;
	if (voice_channel)
	{
		session_id = voice_channel->getSessionID();
	}

	speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin(); 
	for (; it_uuid != speakers_uuids.end(); ++it_uuid)
	{
		LL_DEBUGS("SpeakingIndicator") << "Looking for indicator: " << *it_uuid << LL_ENDL;
		indicator_range_t it_range = mSpeakingIndicators.equal_range(*it_uuid);
		indicator_const_iterator it_indicator = it_range.first;
		bool was_found = false;
		bool was_switched_on = false;
		for (; it_indicator != it_range.second; ++it_indicator)
		{
			was_found = true;
			LLSpeakingIndicator* indicator = (*it_indicator).second;

			BOOL switch_current_on = switch_on;

			// we should show indicator for specified voice session only if this is current channel. EXT-5562.
			if (switch_current_on && indicator->getTargetSessionID().notNull())
			{
				switch_current_on = indicator->getTargetSessionID() == session_id;
				LL_DEBUGS("SpeakingIndicator") << "Session: " << session_id << ", target: " << indicator->getTargetSessionID() << ", the same? = " << switch_current_on << LL_ENDL;
			}
			was_switched_on = was_switched_on || switch_current_on;

			indicator->switchIndicator(switch_current_on);

		}

		if (was_found)
		{
			LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators where found" << LL_ENDL;

			if (switch_on && !was_switched_on)
			{
				LL_DEBUGS("SpeakingIndicator") << "but non of them where switched on" << LL_ENDL;
			}

			if (was_switched_on)
			{
				// store switched on indicator to be able switch it off
				mSwitchedIndicatorsOn.insert(*it_uuid);
			}
		}
	}
}
void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on)
{
	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
	LLUUID session_id;
	if (voice_channel)
	{
		session_id = voice_channel->getSessionID();
	}

	speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin(); 
	for (; it_uuid != speakers_uuids.end(); ++it_uuid)
	{
		LL_DEBUGS("SpeakingIndicator") << "Looking for indicator: " << *it_uuid << LL_ENDL;
		indicator_range_t it_range = mSpeakingIndicators.equal_range(*it_uuid);
		indicator_const_iterator it_indicator = it_range.first;
		bool was_found = false;
		bool was_switched_on = false;
		for (; it_indicator != it_range.second; ++it_indicator)
		{
			was_found = true;
			LLSpeakingIndicator* indicator = (*it_indicator).second;
			was_switched_on = was_switched_on || switch_on;

			indicator->switchIndicator(switch_on);
		}

		if (was_found)
		{
			LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators were found" << LL_ENDL;

			if (switch_on && !was_switched_on)
			{
				LL_DEBUGS("SpeakingIndicator") << "but none of them were switched on" << LL_ENDL;
			}

			if (was_switched_on)
			{
				// store switched on indicator to be able switch it off
				mSwitchedIndicatorsOn.insert(*it_uuid);
			}
		}
	}
}