From e2885d1c56d08c34029e21ddaa63acd8fc8e7a67 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Thu, 25 Jul 2013 17:06:34 -0700 Subject: [PATCH] Added option for Phoenix style media filter prompts --- indra/newview/app_settings/settings.xml | 11 + .../newview/app_settings/settings_latency.xml | 13 +- indra/newview/llviewerparcelmedia.cpp | 220 +++++++++++++++++- .../skins/default/xui/en/notifications.xml | 56 +++++ 4 files changed, 297 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c5d617e3ca..333721bbb8 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -20833,5 +20833,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + MediaFilterSinglePrompt + + Comment + Use a single legacy style dialog for media filter prompt, instead of two seperate allow/deny and whitelist/blacklist prompts. + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/app_settings/settings_latency.xml b/indra/newview/app_settings/settings_latency.xml index 780a3c8189..b2d6ee3212 100644 --- a/indra/newview/app_settings/settings_latency.xml +++ b/indra/newview/app_settings/settings_latency.xml @@ -662,7 +662,18 @@ 0 - + + MediaFilterSinglePrompt + + Persist + 1 + Comment + Use a single legacy style dialog for media filter prompt, instead of two seperate allow/deny and whitelist/blacklist prompts. + Type + Boolean + Value + 1 + diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index f897db5053..55d743547d 100755 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -87,9 +87,11 @@ bool callback_play_media(const LLSD& notification, const LLSD& response, LLParce bool callback_enable_media_filter(const LLSD& notification, const LLSD& response, LLParcel* parcel); void callback_media_alert(const LLSD& notification, const LLSD& response, LLParcel* parcel); void callback_media_alert2(const LLSD& notification, const LLSD& response, LLParcel* parcel, bool allow); +void callback_media_alert_single(const LLSD& notification, const LLSD& response, LLParcel* parcel); bool callback_enable_audio_filter(const LLSD& notification, const LLSD& response, std::string media_url); void callback_audio_alert(const LLSD& notification, const LLSD& response, std::string media_url); void callback_audio_alert2(const LLSD& notification, const LLSD& response, std::string media_url, bool allow); +void callback_audio_alert_single(const LLSD& notification, const LLSD& response, std::string media_url); bool callback_enable_MOAP_filter(const LLSD& notification, const LLSD& response, LLMediaDataClientObject *object, LLObjectMediaNavigateClient *nav_object, U8 texture_index, std::string media_url); void callback_MOAP_alert(const LLSD& notification, const LLSD& response, LLMediaDataClientObject *object, LLObjectMediaNavigateClient *nav_object, U8 texture_index, std::string media_url); void callback_MOAP_alert2(const LLSD& notification, const LLSD& response, LLMediaDataClientObject *object, LLObjectMediaNavigateClient *nav_object, U8 texture_index, std::string media_url, bool allow); @@ -937,7 +939,14 @@ void LLViewerParcelMedia::filterMediaUrl(LLParcel* parcel) LLViewerParcelMedia::sMediaFilterAlertActive = true; LLViewerParcelMedia::sCurrentAlertMedia = *parcel; LLParcel* pParcel = &LLViewerParcelMedia::sCurrentAlertMedia; - LLNotifications::instance().add("MediaAlert", args,LLSD(),boost::bind(callback_media_alert, _1, _2, pParcel)); + if (gSavedSettings.getBOOL("MediaFilterSinglePrompt")) + { + LLNotifications::instance().add("MediaAlertSingle", args,LLSD(),boost::bind(callback_media_alert_single, _1, _2, pParcel)); + } + else + { + LLNotifications::instance().add("MediaAlert", args,LLSD(),boost::bind(callback_media_alert, _1, _2, pParcel)); + } } // No need to refilter now. @@ -1094,6 +1103,103 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar } +} + +void callback_media_alert_single(const LLSD ¬ification, const LLSD &response, LLParcel* parcel) +{ + LLParcel *currentparcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + std::string media_url = parcel->getMediaURL(); + std::string domain = LLViewerParcelMedia::extractDomain(media_url); + + LLViewerParcelMedia::sMediaLastActionPlay = false; + if (option == 0) //allow now + { + LLViewerParcelMedia::sCurrentMedia = *parcel; + if (parcel->getName() == currentparcel->getName()) + { + LLViewerParcelMedia::play(parcel); + } + LLViewerParcelMedia::sMediaLastActionPlay = true; + } + else if (option == 2) //Blacklist domain + { + LLSD newmedia; + newmedia["domain"] = domain; + newmedia["action"] = "deny"; + LLViewerParcelMedia::sMediaFilterList.append(newmedia); + LLViewerParcelMedia::saveDomainFilterList(); + LLStringUtil::format_map_t format_args; + format_args["[DOMAIN]"] = domain; + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentDomainAlwaysBlocked", format_args)); + } + else if (option == 3) // Whitelist domain + { + LLSD newmedia; + newmedia["domain"] = domain; + newmedia["action"] = "allow"; + LLViewerParcelMedia::sMediaFilterList.append(newmedia); + LLViewerParcelMedia::saveDomainFilterList(); + LLStringUtil::format_map_t format_args; + format_args["[DOMAIN]"] = domain; + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentDomainAlwaysAllowed", format_args)); + LLViewerParcelMedia::sCurrentMedia = *parcel; + if (parcel->getName() == currentparcel->getName()) + { + LLViewerParcelMedia::play(parcel); + } + LLViewerParcelMedia::sMediaLastActionPlay = true; + } + + // We've dealt with the alert, so mark it as inactive. + LLViewerParcelMedia::sMediaFilterAlertActive = false; + + // Check for any queued alerts. + if (LLViewerParcelMedia::sMusicQueueEmpty == false) + { + // There's a queued audio stream. Ask about it. + LLViewerParcelMedia::filterAudioUrl(LLViewerParcelMedia::sQueuedMusic); + } + else if (LLViewerParcelMedia::sMediaQueueEmpty == false) + { + // There's a queued media stream. Ask about it. + LLParcel* pParcel = &LLViewerParcelMedia::sQueuedMedia; + LLViewerParcelMedia::filterMediaUrl(pParcel); + } + else if (LLViewerParcelMedia::sMOAPQueueEmpty == false) + { + LLMediaDataClientObject* pObject = LLViewerParcelMedia::sQueuedMOAPObject; + LLObjectMediaNavigateClient* pNavObject = LLViewerParcelMedia::sQueuedMOAPNavObject; + LLViewerParcelMedia::filterMOAPUrl(pObject, pNavObject, LLViewerParcelMedia::sQueuedMOAPTextureIndex, LLViewerParcelMedia::sQueuedMOAPUrl); + } + else if (LLViewerParcelMedia::sMediaCommandQueue != 0) + { + // There's a queued media command. Process it. + if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_STOP) + { + llinfos << "Executing Queued PARCEL_MEDIA_STOP command." << llendl; + LLViewerParcelMedia::stop(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_PAUSE) + { + llinfos << "Executing Queued PARCEL_MEDIA_PAUSE command." << llendl; + LLViewerParcelMedia::pause(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_UNLOAD) + { + llinfos << "Executing Queued PARCEL_MEDIA_UNLOAD command." << llendl; + LLViewerParcelMedia::stop(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_TIME) + { + llinfos << "Executing Queued PARCEL_MEDIA_TIME command." << llendl; + LLViewerParcelMedia::seek(LLViewerParcelMedia::sMediaCommandTime); + } + LLViewerParcelMedia::sMediaCommandQueue = 0; + } + + } bool callback_enable_audio_filter(const LLSD& notification, const LLSD& response, std::string media_url) @@ -1251,7 +1357,14 @@ void LLViewerParcelMedia::filterAudioUrl(std::string media_url) args["AUDIOURL"] = media_url; args["AUDIODOMAIN"] = domain; LLViewerParcelMedia::sMediaFilterAlertActive = true; - LLNotifications::instance().add("AudioAlert", args,LLSD(),boost::bind(callback_audio_alert, _1, _2, media_url)); + if (gSavedSettings.getBOOL("MediaFilterSinglePrompt")) + { + LLNotifications::instance().add("AudioAlertSingle", args,LLSD(),boost::bind(callback_audio_alert_single, _1, _2, media_url)); + } + else + { + LLNotifications::instance().add("AudioAlert", args,LLSD(),boost::bind(callback_audio_alert, _1, _2, media_url)); + } } // No need to refilter now. @@ -1421,6 +1534,109 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: } } +void callback_audio_alert_single(const LLSD ¬ification, const LLSD &response, std::string media_url) +{ + LLViewerParcelMedia::sMediaFilterAlertActive = true; + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + std::string domain = LLViewerParcelMedia::extractDomain(media_url); + + if (option== 0) // allow now + { + if (gAudiop != NULL) + { + LLViewerParcelMedia::sCurrentMusic = media_url; + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(media_url); + } + LLViewerParcelMedia::sAudioLastActionPlay = true; + } + else if (option==1) //deny now + { + if (gAudiop != NULL) + { + LLViewerParcelMedia::sCurrentMusic = ""; + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); + } + LLViewerParcelMedia::sAudioLastActionPlay = false; + } + else if (option== 3) // Whitelist domain + { + LLSD newmedia; + newmedia["domain"] = domain; + newmedia["action"] = "allow"; + LLViewerParcelMedia::sMediaFilterList.append(newmedia); + LLViewerParcelMedia::saveDomainFilterList(); + LLStringUtil::format_map_t format_args; + format_args["[DOMAIN]"] = domain; + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentDomainAlwaysAllowed", format_args)); + if (gAudiop != NULL) + { + LLViewerParcelMedia::sCurrentMusic = media_url; + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(media_url); + } + LLViewerParcelMedia::sAudioLastActionPlay = true; + } + else if (option== 4) //Blacklist domain + { + LLSD newmedia; + newmedia["domain"] = domain; + newmedia["action"] = "deny"; + LLViewerParcelMedia::sMediaFilterList.append(newmedia); + LLViewerParcelMedia::saveDomainFilterList(); + LLStringUtil::format_map_t format_args; + format_args["[DOMAIN]"] = domain; + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentDomainAlwaysBlocked", format_args)); + if (gAudiop != NULL) + { + LLViewerParcelMedia::sCurrentMusic = ""; + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); + } + LLViewerParcelMedia::sAudioLastActionPlay = false; + } + LLViewerParcelMedia::sMediaFilterAlertActive = false; + + // Check for queues + if (LLViewerParcelMedia::sMusicQueueEmpty == false) + { + LLViewerParcelMedia::filterAudioUrl(LLViewerParcelMedia::sQueuedMusic); + } + else if (LLViewerParcelMedia::sMediaQueueEmpty == false) + { + LLParcel* pParcel = &LLViewerParcelMedia::sQueuedMedia; + LLViewerParcelMedia::filterMediaUrl(pParcel); + } + else if (LLViewerParcelMedia::sMOAPQueueEmpty == false) + { + LLMediaDataClientObject* pObject = LLViewerParcelMedia::sQueuedMOAPObject; + LLObjectMediaNavigateClient* pNavObject = LLViewerParcelMedia::sQueuedMOAPNavObject; + LLViewerParcelMedia::filterMOAPUrl(pObject, pNavObject, LLViewerParcelMedia::sQueuedMOAPTextureIndex, LLViewerParcelMedia::sQueuedMOAPUrl); + } + else if (LLViewerParcelMedia::sMediaCommandQueue != 0) + { + // There's a queued media command. Process it. + if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_STOP) + { + llinfos << "Executing Queued PARCEL_MEDIA_STOP command." << llendl; + LLViewerParcelMedia::stop(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_PAUSE) + { + llinfos << "Executing Queued PARCEL_MEDIA_PAUSE command." << llendl; + LLViewerParcelMedia::pause(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_UNLOAD) + { + llinfos << "Executing Queued PARCEL_MEDIA_UNLOAD command." << llendl; + LLViewerParcelMedia::stop(); + } + else if (LLViewerParcelMedia::sMediaCommandQueue == PARCEL_MEDIA_COMMAND_TIME) + { + llinfos << "Executing Queued PARCEL_MEDIA_TIME command." << llendl; + LLViewerParcelMedia::seek(LLViewerParcelMedia::sMediaCommandTime); + } + LLViewerParcelMedia::sMediaCommandQueue = 0; + } +} + bool callback_enable_MOAP_filter(const LLSD& notification, const LLSD& response, LLMediaDataClientObject *object, LLObjectMediaNavigateClient *nav_object, U8 texture_index, std::string media_url) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index cbdcfe4d6c..dc55f566b1 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5859,6 +5859,34 @@ URL: [MEDIAURL] + +This parcel provides media from: + +Domain: [MEDIADOMAIN] +URL: [MEDIAURL] +
+