From 54517fc696a2bd18018880f0f0a2b4cd2544afbe Mon Sep 17 00:00:00 2001
From: Rick Pasetto <rick@lindenlab.com>
Date: Wed, 21 Oct 2009 14:43:00 -0700
Subject: [PATCH] DEV-41600 Refactored my previous change based on review
 feedback from monroe

---
 indra/newview/llvovolume.cpp | 6 +++---
 indra/newview/llvovolume.h   | 8 ++++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 98b3ba8f452..4a7bb6a1082 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1794,7 +1794,7 @@ void LLVOVolume::mediaNavigateBounceBack(U8 texture_index)
     }
 }
 
-bool LLVOVolume::hasNavigatePermission(const LLMediaEntry* media_entry)
+bool LLVOVolume::hasMediaPermission(const LLMediaEntry* media_entry, MediaPermType perm_type)
 {
     // NOTE: This logic duplicates the logic in the server (in particular, in llmediaservice.cpp).
     if (NULL == media_entry ) return false; // XXX should we assert here?
@@ -1810,7 +1810,7 @@ bool LLVOVolume::hasNavigatePermission(const LLMediaEntry* media_entry)
         return true;
     }
     
-    U8 media_perms = media_entry->getPermsInteract();
+    U8 media_perms = (perm_type == INTERACT) ? media_entry->getPermsInteract() : media_entry->getPermsControl();
     
     // World permissions
     if (0 != (media_perms & LLMediaEntry::PERM_ANYONE)) 
@@ -1855,7 +1855,7 @@ void LLVOVolume::mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plu
 		{
 			block_navigation = true;
 		}
-		if (!block_navigation && !hasNavigatePermission(mep))
+		if (!block_navigation && !hasMediaPermission(mep, INTERACT))
 		{
 			block_navigation = true;
 		}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index d8ae9a54531..e4a6ec4b320 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -242,8 +242,12 @@ class LLVOVolume : public LLViewerObject
     // Bounce back media at the given index to its current URL (or home URL, if current URL is empty)
 	void mediaNavigateBounceBack(U8 texture_index);
     
-    // Returns whether or not this object has permission to navigate the given media entry
-    bool hasNavigatePermission(const LLMediaEntry* media_entry);
+    // Returns whether or not this object has permission to navigate or control 
+	// the given media entry
+	enum MediaPermType {
+		INTERACT, CONTROL
+	};
+    bool hasMediaPermission(const LLMediaEntry* media_entry, MediaPermType perm_type);
     
 	void mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, std::string new_location);
 	void mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event);
-- 
GitLab