From 257f75d7a31d68ade0ee981546f5afa8bd762f1d Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Fri, 14 Jan 2022 15:36:00 +0200
Subject: SL-16638 don't allow downloading files from the built-in browser

---
 indra/newview/llviewermedia.cpp | 45 ++++-------------------------------------
 1 file changed, 4 insertions(+), 41 deletions(-)

(limited to 'indra/newview/llviewermedia.cpp')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 54c2099ac9..b314c78839 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -78,41 +78,12 @@
 #include <boost/bind.hpp>	// for SkinFolder listener
 #include <boost/signals2.hpp>
 
-class LLMediaFilePicker : public LLFilePickerThread // deletes itself when done
-{
-public:
-    LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
-        : LLFilePickerThread(filter, get_multiple),
-        mPlugin(plugin->getSharedPrt())
-    {
-    }
-
-    LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
-        : LLFilePickerThread(filter, proposed_name),
-        mPlugin(plugin->getSharedPrt())
-    {
-    }
-
-    virtual void notify(const std::vector<std::string>& filenames)
-    {
-        mPlugin->sendPickFileResponse(mResponses);
-        mPlugin = NULL;
-    }
-
-private:
-    boost::shared_ptr<LLPluginClassMedia> mPlugin;
-};
 
 void init_threaded_picker_load_dialog(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
 {
     (new LLMediaFilePicker(plugin, filter, get_multiple))->getFile(); // will delete itself
 }
 
-void init_threaded_picker_save_dialog(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, std::string &proposed_name)
-{
-    (new LLMediaFilePicker(plugin, filter, proposed_name))->getFile(); // will delete itself
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 // Move this to its own file.
@@ -3237,18 +3208,10 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
 		case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
 		{
 			LL_DEBUGS("Media") << "Media event - file download requested - filename is " << plugin->getFileDownloadFilename() << LL_ENDL;
-			// pick a file from SAVE FILE dialog
-
-			// need a better algorithm that this or else, pass in type of save type
-			// from event that initiated it - this is okay for now - only thing
-			// that saves is 360s
-			std::string suggested_filename = plugin->getFileDownloadFilename();
-			LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL;
-			if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos)
-				filter = LLFilePicker::FFSAVE_JPEG;
-			if (suggested_filename.find(".png") != std::string::npos)
-				filter = LLFilePicker::FFSAVE_PNG;
-			init_threaded_picker_save_dialog(plugin, filter, suggested_filename);
+
+            //unblock media plugin
+            const std::vector<std::string> empty_response;
+            plugin->sendPickFileResponse(empty_response);
 		}
 		break;
 
-- 
cgit v1.2.3


From ccb191e3bfa1c10b0e5d6845d7be4c6e35fe269f Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Wed, 2 Feb 2022 00:10:52 +0200
Subject: SL-16755 Show alert that download is not supported instead of failing
 silently

---
 indra/newview/llviewermedia.cpp | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra/newview/llviewermedia.cpp')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index b314c78839..da1d029bdb 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -3212,6 +3212,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
             //unblock media plugin
             const std::vector<std::string> empty_response;
             plugin->sendPickFileResponse(empty_response);
+            LLNotificationsUtil::add("MediaFileDownloadUnsupported");
 		}
 		break;
 
-- 
cgit v1.2.3


From 26e03f0c65c0b36705e468687553bbf54cca77be Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 3 Feb 2022 02:57:29 +0200
Subject: SL-16755 Show alert that download is not supported instead of failing
 silently

---
 indra/newview/llviewermedia.cpp | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra/newview/llviewermedia.cpp')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index da1d029bdb..b314c78839 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -3212,7 +3212,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
             //unblock media plugin
             const std::vector<std::string> empty_response;
             plugin->sendPickFileResponse(empty_response);
-            LLNotificationsUtil::add("MediaFileDownloadUnsupported");
 		}
 		break;
 
-- 
cgit v1.2.3


From 1e09d25d9ce8b7ec8da28ad5364d81c0faab9d0a Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Mon, 30 May 2022 19:07:29 +0300
Subject: SL-16297 Don't play moap located outside the parcel, If an agent is
 standing in a parcel with this flag set

---
 indra/newview/llviewermedia.cpp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'indra/newview/llviewermedia.cpp')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 29c926ca64..2f2dc2bcba 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -3103,7 +3103,7 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
 	}
 
 	// If this media's class is not supposed to be shown, unload
-	if (!shouldShowBasedOnClass())
+	if (!shouldShowBasedOnClass() || isObscured())
 	{
 		return true;
 	}
@@ -3788,6 +3788,26 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
 	}
 }
 
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+bool LLViewerMediaImpl::isObscured() const
+{
+    if (getUsedInUI() || isParcelMedia()) return false;
+
+    LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+    if (!agent_parcel)
+    {
+        return false;
+    }
+    
+    if (agent_parcel->getObscureMOAP() && !isInAgentParcel())
+    {
+        return true;
+    }
+
+    return false;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 //
 bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
-- 
cgit v1.2.3