summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-10-07 12:26:42 -0700
committerRick Pasetto <rick@lindenlab.com>2009-10-07 12:26:42 -0700
commitdf48e66f7cc6711f1738e3a2817cf3b9a810c088 (patch)
treec9a660eab1d800081547e644cd39c4cfc52d541f /indra/newview/llvovolume.cpp
parentd2464757c6fa86caa30a13071cb43047de2dd2ff (diff)
DEV-39168 - bounce back to the current URL (or, the home URL if current URL is "") if the server denies navigation
This refactors some of the bounceBack code into LLVOVolume. It also changes an important rule: the edit panel now *will* send the current URL to the server when you hit "OK". This change was done so that if autoplay is on, we make sure the server gets the right data.
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp73
1 files changed, 71 insertions, 2 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 428de078de..83e65af054 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1713,6 +1713,72 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m
// << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl;
}
+void LLVOVolume::mediaNavigateBounceBack(U8 texture_index)
+{
+ // Find the media entry for this navigate
+ const LLMediaEntry* mep = NULL;
+ viewer_media_t impl = getMediaImpl(texture_index);
+ LLTextureEntry *te = getTE(texture_index);
+ if(te)
+ {
+ mep = te->getMediaData();
+ }
+
+ if (mep && impl)
+ {
+ std::string url = mep->getCurrentURL();
+ if (url.empty())
+ {
+ url = mep->getHomeURL();
+ }
+ if (! url.empty())
+ {
+ LL_INFOS("LLMediaDataClient") << "bouncing back to URL: " << url << LL_ENDL;
+ impl->navigateTo(url, "", false, true);
+ }
+ }
+}
+
+bool LLVOVolume::hasNavigatePermission(const LLMediaEntry* media_entry)
+{
+ // 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?
+
+ // The agent has permissions to navigate if:
+ // - agent has edit permissions, or
+ // - world permissions are on, or
+ // - group permissions are on, and agent_id is in the group, or
+ // - agent permissions are on, and agent_id is the owner
+
+ if (permModify())
+ {
+ return true;
+ }
+
+ U8 media_perms = media_entry->getPermsInteract();
+
+ // World permissions
+ if (0 != (media_perms & LLMediaEntry::PERM_ANYONE))
+ {
+ return true;
+ }
+
+ // Group permissions
+ else if (0 != (media_perms & LLMediaEntry::PERM_GROUP) && permGroupOwner())
+ {
+ return true;
+ }
+
+ // Owner permissions
+ else if (0 != (media_perms & LLMediaEntry::PERM_OWNER) && permYouOwner())
+ {
+ return true;
+ }
+
+ return false;
+
+}
+
void LLVOVolume::mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event)
{
switch(event)
@@ -1746,6 +1812,10 @@ void LLVOVolume::mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin,
{
block_navigation = true;
}
+ if (!block_navigation && !hasNavigatePermission(mep))
+ {
+ block_navigation = true;
+ }
}
else
{
@@ -1757,8 +1827,7 @@ void LLVOVolume::mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin,
llinfos << "blocking navigate to URI " << new_location << llendl;
// "bounce back" to the current URL from the media entry
- // NOTE: the only way block_navigation can be true is if we found the media entry, so we're guaranteed here that mep is not NULL.
- impl->navigateTo(mep->getCurrentURL());
+ mediaNavigateBounceBack(face_index);
}
else
{