From bb395883ccb295111885a9bd5ad19750376155b4 Mon Sep 17 00:00:00 2001 From: Testy Date: Wed, 26 Feb 2020 14:41:47 -0400 Subject: [PATCH 1/2] Fixes FIRE-29157, invalid parcel music URLs. --- indra/newview/llpanellandaudio.cpp | 38 ++++++++++++++++++++++++++++-- indra/newview/llpanellandaudio.h | 4 ++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index e76543a585..4c17a8476a 100644 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -169,7 +169,10 @@ void LLPanelLandAudio::refresh() std::string current_url = parcel->getMusicURL(); mMusicURLEdit->clearRows(); LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); - LLSD streams = streamlist["audio"]; + // FIRE-29157 - Remove invalid URLs that were rejected by the server + //LLSD streams = streamlist["audio"]; + LLSD& streams = streamlist["audio"]; + // for(LLSD::array_iterator s_itr = streams.beginArray(); s_itr != streams.endArray(); ++s_itr) { @@ -186,6 +189,23 @@ void LLPanelLandAudio::refresh() // mMusicURLEdit->setEnabled( can_change_media ); + // FIRE-29157 - Remove invalid URLs that were rejected by the server + if (current_url != mLastSetURL) + { + mMusicURLEdit->remove(mLastSetURL); + LLSD::Integer index = 0; + for (LLSD::array_iterator iter = streams.beginArray(), end = streams.endArray(); iter != end; ++iter, ++index) + { + if ((*iter).asString() == mLastSetURL) + { + streams.erase(index); + break; + } + } + gSavedSettings.setLLSD("FSStreamList", streamlist); + } + // + BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData(); mCheckAVSoundAny->set(parcel->getAllowAnyAVSounds()); mCheckAVSoundAny->setEnabled(can_change_av_sounds); @@ -232,6 +252,10 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata) } // + // FIRE-29157 - Remove invalid URLs that were rejected by the server + self->mLastSetURL = music_url; + // + // Push data into current parcel parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled); parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan); @@ -281,6 +305,13 @@ void LLPanelLandAudio::onBtnStreamDelete() { std::string music_url = mMusicURLEdit->getSimple(); LLStringUtil::trim(music_url); + // FIRE-29157 - Stream can't be deleted if onCommitAny() prepended "http://" to the URL since it doesn't match in the list. + std::string music_url_no_http; + if (music_url.find("http://") == 0) + { + music_url_no_http = music_url.substr(7, music_url.size() - 7); + } + // LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); LLSD streamlist_new; @@ -289,10 +320,13 @@ void LLPanelLandAudio::onBtnStreamDelete() for (LLSD::array_const_iterator it = streamlist["audio"].beginArray(); it != streamlist["audio"].endArray(); ++it) { std::string current_url = (*it).asString(); - if (current_url != music_url) + // FIRE-29157 - Stream can't be deleted if onCommitAny() prepended "http://" to the URL since it doesn't match in the list. + //if (current_url != music_url) + if (current_url != music_url && !music_url_no_http.empty() && current_url != music_url_no_http) { streamlist_new["audio"].append(current_url); } + // } gSavedSettings.setLLSD("FSStreamList", streamlist_new); diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h index b4673467c0..54a636c88e 100644 --- a/indra/newview/llpanellandaudio.h +++ b/indra/newview/llpanellandaudio.h @@ -70,6 +70,10 @@ private: LLCheckBoxCtrl* mCheckAVSoundGroup; LLSafeHandle& mParcel; + + // FIRE-29157 - Remove invalid URLs that were rejected by the server + std::string mLastSetURL; + // }; #endif From 1e89a44f45543484e799e5345295aa14cb1f0d8a Mon Sep 17 00:00:00 2001 From: Testy Date: Thu, 27 Feb 2020 18:37:38 -0400 Subject: [PATCH 2/2] Fixed newly introduced bug where only http:// prefixed URLs could only be deleted. --- indra/newview/llpanellandaudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index 4c17a8476a..a6f320c964 100644 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -322,7 +322,7 @@ void LLPanelLandAudio::onBtnStreamDelete() std::string current_url = (*it).asString(); // FIRE-29157 - Stream can't be deleted if onCommitAny() prepended "http://" to the URL since it doesn't match in the list. //if (current_url != music_url) - if (current_url != music_url && !music_url_no_http.empty() && current_url != music_url_no_http) + if (current_url != music_url && !(current_url.find("://") == std::string::npos && current_url == music_url_no_http)) { streamlist_new["audio"].append(current_url); }