void LLFloaterChatterBox::draw()
{
	// clear new im notifications when chatterbox is visible
	if (!isMinimized()) 
	{
		gIMMgr->clearNewIMNotification();
	}
	LLFloater* current_active_floater = getCurrentVoiceFloater();
	// set icon on tab for floater currently associated with active voice channel
	if(mActiveVoiceFloater != current_active_floater)
	{
		// remove image from old floater's tab
		if (mActiveVoiceFloater)
		{
			mTabContainer->setTabImage(mActiveVoiceFloater, "");
		}
	}

	// update image on current active tab
	if (current_active_floater)
	{
		LLColor4 icon_color = LLColor4::white;
		LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
		if (channelp)
		{
			if (channelp->isActive())
			{
				icon_color = LLColor4::green;
			}
			else if (channelp->getState() == LLVoiceChannel::STATE_ERROR)
			{
				icon_color = LLColor4::red;
			}
			else // active, but not connected
			{
				icon_color = LLColor4::yellow;
			}
		}
		mTabContainer->setTabImage(current_active_floater, "active_voice_tab.tga", icon_color);
	}

	mActiveVoiceFloater = current_active_floater;

	LLMultiFloater::draw();
}
Exemple #2
0
void LLVoiceCallCapResponder::result(const LLSD& content)
{
	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
	if (channelp)
	{
		//*TODO: DEBUG SPAM
		LLSD::map_const_iterator iter;
		for(iter = content.beginMap(); iter != content.endMap(); ++iter)
		{
			LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got " 
				<< iter->first << LL_ENDL;
		}

		channelp->setChannelInfo(
			content["voice_credentials"]["channel_uri"].asString(),
			content["voice_credentials"]["channel_credentials"].asString());
	}
}
Exemple #3
0
void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
{
	LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
		<< status << ": " << reason << ")"
		<< LL_ENDL;
	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
	if ( channelp )
	{
		if ( 403 == status )
		{
			//403 == no ability
			LLNotificationsUtil::add(
				"VoiceNotAllowed",
				channelp->getNotifyArgs());
		}
		else
		{
			LLNotificationsUtil::add(
				"VoiceCallGenericError",
				channelp->getNotifyArgs());
		}
		channelp->deactivate();
	}
}
void LLVoiceRemoteCtrl::draw()
{
	BOOL voice_active = FALSE;
	LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
	if (channelp)
	{
		voice_active = channelp->isActive();
	}

	mTalkBtn->setEnabled(voice_active);
	mPosLockBtn->setEnabled(voice_active);
	mTalkLockBtn->setEnabled(voice_active);

	// propagate ptt state to button display,
	if (!mTalkBtn->hasMouseCapture())
	{
		// not in push to talk mode, or push to talk is active means I'm talking
		mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState());
	}
	mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
	mPosLockBtn->setToggleState(gVoiceClient->getPosLocked());
	mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
	

	std::string talk_blip_image;
	if (gVoiceClient->getIsSpeaking(gAgent.getID()))
	{
		F32 voice_power = gVoiceClient->getCurrentPower(gAgent.getID());

		if (voice_power > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
		{
			talk_blip_image = "icn_voice_ptt-on-lvl3.tga";
		}
		else
		{
			F32 power = gVoiceClient->getCurrentPower(gAgent.getID());
			S32 icon_image_idx = llmin(2, llfloor((power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f));

			switch(icon_image_idx)
			{
			case 0:
				talk_blip_image = "icn_voice_ptt-on.tga";
				break;
			case 1:
				talk_blip_image = "icn_voice_ptt-on-lvl1.tga";
				break;
			case 2:
				talk_blip_image = "icn_voice_ptt-on-lvl2.tga";
				break;
			}
		}
	}
	else
	{
		talk_blip_image = "icn_voice_ptt-off.tga";
	}

	LLIconCtrl* icon = getChild<LLIconCtrl>("voice_volume");
	if (icon)
	{
		icon->setImage(talk_blip_image);
	}

	LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
	std::string active_channel_name;
	if (voice_floater)
	{
		active_channel_name = voice_floater->getShortTitle();
	}

	LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
	childSetEnabled("end_call_btn", LLVoiceClient::voiceEnabled() 
								&& current_channel
								&& current_channel->isActive()
								&& current_channel != LLVoiceChannelProximal::getInstance());



	LLButton* expand_button = getChild<LLButton>("show_channel");
	if (expand_button)
	{
		if (expand_button->getToggleState())
		{
			expand_button->setImageOverlay(std::string("arrow_down.tga"));
		}
		else
		{
			expand_button->setImageOverlay(std::string("arrow_up.tga"));
		}
	}

	LLPanel::draw();
}
void LLVoiceRemoteCtrl::draw()
{
	BOOL voice_active = FALSE;
	LLVoiceChannel* channelp = LLVoiceChannel::getCurrentVoiceChannel();
	if (channelp)
	{
		voice_active = channelp->isActive();
	}

	mTalkBtn->setEnabled(voice_active);
	mTalkLockBtn->setEnabled(voice_active);

	static LLCachedControl<bool> ptt_currently_enabled("PTTCurrentlyEnabled",false);
	// propagate ptt state to button display,
	if (!mTalkBtn->hasMouseCapture())
	{
		// not in push to talk mode, or push to talk is active means I'm talking
		mTalkBtn->setToggleState(!ptt_currently_enabled || gVoiceClient->getUserPTTState());
	}
	mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
	mTalkLockBtn->setToggleState(!ptt_currently_enabled);

	std::string talk_blip_image;
	if (gVoiceClient->getIsSpeaking(gAgent.getID()))
	{
		F32 voice_power = gVoiceClient->getCurrentPower(gAgent.getID());

		if (voice_power > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
		{
			talk_blip_image = "icn_voice_ptt-on-lvl3.tga";
		}
		else
		{
			F32 power = gVoiceClient->getCurrentPower(gAgent.getID());
			S32 icon_image_idx = llmin(2, llfloor((power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f));

			switch(icon_image_idx)
			{
			case 0:
				talk_blip_image = "icn_voice_ptt-on.tga";
				break;
			case 1:
				talk_blip_image = "icn_voice_ptt-on-lvl1.tga";
				break;
			case 2:
				talk_blip_image = "icn_voice_ptt-on-lvl2.tga";
				break;
			}
		}
	}
	else
	{
		talk_blip_image = "icn_voice_ptt-off.tga";
	}

	LLIconCtrl* icon = mVoiceVolIcon;
	if (icon)
	{
		icon->setImage(talk_blip_image);
	}

	LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
	std::string active_channel_name;
	if (voice_floater)
	{
		active_channel_name = voice_floater->getShortTitle();
	}

	LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel();
	mEndCallBtn->setEnabled(LLVoiceClient::voiceEnabled() 
								&& current_channel
								&& current_channel->isActive()
								&& current_channel != LLVoiceChannelProximal::getInstance());

	mChanLabelTextBox->setValue(active_channel_name);
	mVoiceChanBgBtn->setToolTip(active_channel_name);

	if (current_channel)
	{
		LLIconCtrl* voice_channel_icon = mVoiceChanIcon;
		if (voice_channel_icon && voice_floater)
		{
			voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
		}

		LLButton* voice_channel_bg = mVoiceChanBgBtn;
		if (voice_channel_bg)
		{
			LLColor4 bg_color;
			if (current_channel->isActive())
			{
				bg_color = lerp(LLColor4::green, LLColor4::white, 0.7f);
			}
			else if (current_channel->getState() == LLVoiceChannel::STATE_ERROR)
			{
				bg_color = lerp(LLColor4::red, LLColor4::white, 0.7f);
			}
			else // active, but not connected
			{
				bg_color = lerp(LLColor4::yellow, LLColor4::white, 0.7f);
			}
			voice_channel_bg->setImageColor(bg_color);
		}
	}

	LLButton* expand_button = mShowChanBtn;
	if (expand_button)
	{
		if (expand_button->getToggleState())
		{
			expand_button->setImageOverlay(std::string("arrow_down.tga"));
		}
		else
		{
			expand_button->setImageOverlay(std::string("arrow_up.tga"));
		}
	}

	LLPanel::draw();
}
void LLIMMgr::inviteToSession(
	const LLUUID& session_id, 
	const std::string& session_name, 
	const LLUUID& caller_id, 
	const std::string& caller_name,
	EInstantMessage type,
	EInvitationType inv_type,
	const std::string& session_handle,
	const std::string& session_uri)
{
	//ignore invites from muted residents
	if (LLMuteList::getInstance()->isMuted(caller_id))
	{
		return;
	}

	std::string notify_box_type;

	BOOL ad_hoc_invite = FALSE;
	if(type == IM_SESSION_P2P_INVITE)
	{
		//P2P is different...they only have voice invitations
		notify_box_type = "VoiceInviteP2P";
	}
	else if ( gAgent.isInGroup(session_id) )
	{
		//only really old school groups have voice invitations
		notify_box_type = "VoiceInviteGroup";
	}
	else if ( inv_type == INVITATION_TYPE_VOICE )
	{
		//else it's an ad-hoc
		//and a voice ad-hoc
		notify_box_type = "VoiceInviteAdHoc";
		ad_hoc_invite = TRUE;
	}
	else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
	{
		notify_box_type = "InviteAdHoc";
		ad_hoc_invite = TRUE;
	}

	LLSD payload;
	payload["session_id"] = session_id;
	payload["session_name"] = session_name;
	payload["caller_id"] = caller_id;
	payload["caller_name"] = caller_name;
	payload["type"] = type;
	payload["inv_type"] = inv_type;
	payload["session_handle"] = session_handle;
	payload["session_uri"] = session_uri;
	payload["notify_box_type"] = notify_box_type;
	
	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
	if (channelp && channelp->callStarted())
	{
		// you have already started a call to the other user, so just accept the invite
		LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0);
		return;
	}

	if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite)
	{
		// is the inviter a friend?
		if (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)
		{
			// if not, and we are ignoring voice invites from non-friends
			// then silently decline
			if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly"))
			{
				// invite not from a friend, so decline
				LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1);
				return;
			}
		}
	}

	if ( !mPendingInvitations.has(session_id.asString()) )
	{
		if (caller_name.empty())
		{
			gCacheName->get(caller_id, true, boost::bind(&LLIMMgr::onInviteNameLookup,_1,_2,_3,payload));
		}
		else
		{
			LLSD args;
			args["NAME"] = caller_name;
			args["GROUP"] = session_name;

			LLNotifications::instance().add(notify_box_type, 
					     args, 
						 payload,
						 &inviteUserResponse);

		}
		mPendingInvitations[session_id.asString()] = LLSD();
	}
}