aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--linden/indra/newview/app_settings/settings.xml11
-rw-r--r--linden/indra/newview/llfloaterpreference.cpp1
-rw-r--r--linden/indra/newview/llpanelaudioprefs.cpp19
-rw-r--r--linden/indra/newview/llpanelaudioprefs.h4
-rw-r--r--linden/indra/newview/llviewerparcelmedia.cpp158
-rw-r--r--linden/indra/newview/llviewerparcelmedia.h40
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_media_filter.xml26
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml15
-rw-r--r--linden/indra/newview/slfloatermediafilter.cpp116
-rw-r--r--linden/indra/newview/slfloatermediafilter.h7
10 files changed, 308 insertions, 89 deletions
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 2a508ee..5bd8c7e 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -8017,6 +8017,17 @@
8017 <integer>100</integer> 8017 <integer>100</integer>
8018 </array> 8018 </array>
8019 </map> 8019 </map>
8020 <key>MediaFilterOnlyRemoteCommands</key>
8021 <map>
8022 <key>Comment</key>
8023 <string>Whether Media Filter should only filter actions initiated remotely</string>
8024 <key>Persist</key>
8025 <integer>1</integer>
8026 <key>Type</key>
8027 <string>Boolean</string>
8028 <key>Value</key>
8029 <integer>1</integer>
8030 </map>
8020 <key>MediaOnAPrimUI</key> 8031 <key>MediaOnAPrimUI</key>
8021 <map> 8032 <map>
8022 <key>Comment</key> 8033 <key>Comment</key>
diff --git a/linden/indra/newview/llfloaterpreference.cpp b/linden/indra/newview/llfloaterpreference.cpp
index 0f81be6..02c2014 100644
--- a/linden/indra/newview/llfloaterpreference.cpp
+++ b/linden/indra/newview/llfloaterpreference.cpp
@@ -365,6 +365,7 @@ void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_vi
365void LLPreferenceCore::updateIsLoggedIn(bool enable) 365void LLPreferenceCore::updateIsLoggedIn(bool enable)
366{ 366{
367 mPrefsIM->preparePerAccountPrefs(enable); 367 mPrefsIM->preparePerAccountPrefs(enable);
368 mAudioPanel->updateIsLoggedIn(enable);
368} 369}
369 370
370void LLPreferenceCore::refreshEnabledGraphics() 371void LLPreferenceCore::refreshEnabledGraphics()
diff --git a/linden/indra/newview/llpanelaudioprefs.cpp b/linden/indra/newview/llpanelaudioprefs.cpp
index 1acfcbb..fab2771 100644
--- a/linden/indra/newview/llpanelaudioprefs.cpp
+++ b/linden/indra/newview/llpanelaudioprefs.cpp
@@ -55,12 +55,14 @@
55#include "llslider.h" 55#include "llslider.h"
56#include "llsliderctrl.h" 56#include "llsliderctrl.h"
57#include "llspinctrl.h" 57#include "llspinctrl.h"
58#include "llstartup.h"
58#include "lltextbox.h" 59#include "lltextbox.h"
59#include "llui.h" 60#include "llui.h"
60#include "llviewerparcelmgr.h" 61#include "llviewerparcelmgr.h"
61#include "lluictrlfactory.h" 62#include "lluictrlfactory.h"
62#include "llviewerwindow.h" 63#include "llviewerwindow.h"
63#include "llviewercontrol.h" 64#include "llviewercontrol.h"
65#include "slfloatermediafilter.h"
64 66
65#include "hippogridmanager.h" 67#include "hippogridmanager.h"
66 68
@@ -92,6 +94,8 @@ BOOL LLPanelAudioPrefs::postBuild()
92 refreshValues(); // initialize member data from saved settings 94 refreshValues(); // initialize member data from saved settings
93 childSetLabelArg("L$ Change Threshold", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); 95 childSetLabelArg("L$ Change Threshold", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
94 childSetValue("mute_wind_check", !gSavedSettings.getBOOL("MuteWind")); 96 childSetValue("mute_wind_check", !gSavedSettings.getBOOL("MuteWind"));
97 childSetAction("show_media_filter", onShowMediaFilter, this);
98 updateIsLoggedIn(LLStartUp::isLoggedIn());
95 99
96 return TRUE; 100 return TRUE;
97} 101}
@@ -112,7 +116,7 @@ void LLPanelAudioPrefs::refreshValues()
112 116
113 mPreviousStreamingMusic = gSavedSettings.getBOOL("AudioStreamingMusic"); 117 mPreviousStreamingMusic = gSavedSettings.getBOOL("AudioStreamingMusic");
114 mPreviousStreamingVideo = gSavedSettings.getBOOL("AudioStreamingVideo"); 118 mPreviousStreamingVideo = gSavedSettings.getBOOL("AudioStreamingVideo");
115 119 mPreviousEnableMediaFilter = gSavedSettings.getBOOL("MediaEnableFilter");
116 mPreviousMuteAudio = gSavedSettings.getBOOL("MuteAudio"); 120 mPreviousMuteAudio = gSavedSettings.getBOOL("MuteAudio");
117 mPreviousMuteWhenMinimized = gSavedSettings.getBOOL("MuteWhenMinimized"); 121 mPreviousMuteWhenMinimized = gSavedSettings.getBOOL("MuteWhenMinimized");
118} 122}
@@ -140,8 +144,19 @@ void LLPanelAudioPrefs::cancel()
140 144
141 gSavedSettings.setBOOL("AudioStreamingMusic", mPreviousStreamingMusic ); 145 gSavedSettings.setBOOL("AudioStreamingMusic", mPreviousStreamingMusic );
142 gSavedSettings.setBOOL("AudioStreamingVideo", mPreviousStreamingVideo ); 146 gSavedSettings.setBOOL("AudioStreamingVideo", mPreviousStreamingVideo );
147 gSavedSettings.setBOOL("MediaEnableFilter", mPreviousEnableMediaFilter );
143 148
144
145 gSavedSettings.setBOOL("MuteAudio", mPreviousMuteAudio ); 149 gSavedSettings.setBOOL("MuteAudio", mPreviousMuteAudio );
146 gSavedSettings.setBOOL("MuteWhenMinimized", mPreviousMuteWhenMinimized ); 150 gSavedSettings.setBOOL("MuteWhenMinimized", mPreviousMuteWhenMinimized );
147} 151}
152
153//static
154void LLPanelAudioPrefs::onShowMediaFilter(void* data)
155{
156 SLFloaterMediaFilter::toggleInstance();
157}
158
159void LLPanelAudioPrefs::updateIsLoggedIn(const bool enable)
160{
161 childSetEnabled("show_media_filter", enable);
162}
diff --git a/linden/indra/newview/llpanelaudioprefs.h b/linden/indra/newview/llpanelaudioprefs.h
index 21d2f59..a0733ba 100644
--- a/linden/indra/newview/llpanelaudioprefs.h
+++ b/linden/indra/newview/llpanelaudioprefs.h
@@ -54,6 +54,9 @@ public:
54 virtual BOOL postBuild(); 54 virtual BOOL postBuild();
55 55
56 static void* createVolumePanel(void* data); 56 static void* createVolumePanel(void* data);
57 static void onShowMediaFilter(void* data);
58
59 void updateIsLoggedIn(const bool);
57 60
58private: 61private:
59 void refreshValues(); 62 void refreshValues();
@@ -75,6 +78,7 @@ private:
75 78
76 BOOL mPreviousStreamingMusic; 79 BOOL mPreviousStreamingMusic;
77 BOOL mPreviousStreamingVideo; 80 BOOL mPreviousStreamingVideo;
81 BOOL mPreviousEnableMediaFilter;
78 BOOL mPreviousMuteAudio; 82 BOOL mPreviousMuteAudio;
79 BOOL mPreviousMuteWhenMinimized; 83 BOOL mPreviousMuteWhenMinimized;
80}; 84};
diff --git a/linden/indra/newview/llviewerparcelmedia.cpp b/linden/indra/newview/llviewerparcelmedia.cpp
index 01e86e2..386a86e 100644
--- a/linden/indra/newview/llviewerparcelmedia.cpp
+++ b/linden/indra/newview/llviewerparcelmedia.cpp
@@ -49,6 +49,7 @@
49#include "llpluginclassmedia.h" 49#include "llpluginclassmedia.h"
50#include "llnotify.h" 50#include "llnotify.h"
51#include "llsdserialize.h" 51#include "llsdserialize.h"
52#include "llmemory.h"
52 53
53#include "lloverlaybar.h" 54#include "lloverlaybar.h"
54#include "slfloatermediafilter.h" 55#include "slfloatermediafilter.h"
@@ -64,6 +65,7 @@ LLSD LLViewerParcelMedia::sMediaFilterList;
64std::set<std::string> LLViewerParcelMedia::sMediaQueries; 65std::set<std::string> LLViewerParcelMedia::sMediaQueries;
65std::set<std::string> LLViewerParcelMedia::sAllowedMedia; 66std::set<std::string> LLViewerParcelMedia::sAllowedMedia;
66std::set<std::string> LLViewerParcelMedia::sDeniedMedia; 67std::set<std::string> LLViewerParcelMedia::sDeniedMedia;
68LLPointer<LLViewerParcelMediaInfo> LLViewerParcelMedia::sSavedMediaInfo;
67 69
68// Local functions 70// Local functions
69bool callback_play_media(const LLSD& notification, const LLSD& response, LLParcel* parcel); 71bool callback_play_media(const LLSD& notification, const LLSD& response, LLParcel* parcel);
@@ -186,7 +188,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
186} 188}
187 189
188// static 190// static
189void LLViewerParcelMedia::play(LLParcel* parcel, bool filter) 191void LLViewerParcelMedia::play(LLParcel* parcel, bool filter, const ECommandOrigin origin)
190{ 192{
191 lldebugs << "LLViewerParcelMedia::play" << llendl; 193 lldebugs << "LLViewerParcelMedia::play" << llendl;
192 194
@@ -198,12 +200,13 @@ void LLViewerParcelMedia::play(LLParcel* parcel, bool filter)
198 std::string media_url = parcel->getMediaURL(); 200 std::string media_url = parcel->getMediaURL();
199 LLStringUtil::trim(media_url); 201 LLStringUtil::trim(media_url);
200 202
201 if (!media_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && (filter || !allowedMedia(media_url))) 203 if (!media_url.empty() && gSavedSettings.getBOOL("MediaEnableFilter") && filter
204 && (!allowedMedia(media_url) || origin == COMMAND_ORIGIN_REMOTE))
202 { 205 {
203 // If filtering is needed or in case media_url just changed 206 // If filtering is needed or in case media_url just changed
204 // to something we did not yet approve. 207 // to something we did not yet approve.
205 LLViewerParcelMediaAutoPlay::playStarted(); 208 LLViewerParcelMediaAutoPlay::playStarted();
206 filterMedia(parcel, 0); 209 filterMedia(parcel, 0, origin);
207 return; 210 return;
208 } 211 }
209 212
@@ -384,7 +387,7 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg
384 else 387 else
385 { 388 {
386 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); 389 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
387 play(parcel); 390 play(parcel, true, COMMAND_ORIGIN_REMOTE);
388 } 391 }
389 } 392 }
390 else 393 else
@@ -400,7 +403,7 @@ void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg
400 if(sMediaImpl.isNull()) 403 if(sMediaImpl.isNull())
401 { 404 {
402 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); 405 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
403 play(parcel); 406 play(parcel, true, COMMAND_ORIGIN_REMOTE);
404 } 407 }
405 seek(time); 408 seek(time);
406 } 409 }
@@ -437,33 +440,38 @@ void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void *
437 } 440 }
438 441
439 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); 442 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
440 BOOL same = FALSE;
441 if (parcel) 443 if (parcel)
442 { 444 {
443 same = ((parcel->getMediaURL() == media_url) && 445 LLViewerParcelMediaInfo* new_info = new LLViewerParcelMediaInfo(media_url, media_type, media_id, media_width, media_height, media_auto_scale, media_loop);
444 (parcel->getMediaType() == media_type) && 446 LLViewerParcelMediaInfo* current_info = new LLViewerParcelMediaInfo(parcel);
445 (parcel->getMediaID() == media_id) && 447 if (new_info != current_info)
446 (parcel->getMediaWidth() == media_width) &&
447 (parcel->getMediaHeight() == media_height) &&
448 (parcel->getMediaAutoScale() == media_auto_scale) &&
449 (parcel->getMediaLoop() == media_loop));
450
451 if (!same)
452 { 448 {
449 if (!sSavedMediaInfo || (sSavedMediaInfo && !sSavedMediaInfo->sameParcel(parcel)))
450 {
451 // only save if no previously saved media info, because
452 // we want to remeber the original parcel media info.
453 sSavedMediaInfo = current_info;
454 }
453 // temporarily store these new values in the parcel 455 // temporarily store these new values in the parcel
454 parcel->setMediaURL(media_url); 456 new_info->applyToParcel(parcel);
455 parcel->setMediaType(media_type); 457
456 parcel->setMediaID(media_id); 458 play(parcel, true, COMMAND_ORIGIN_REMOTE);
457 parcel->setMediaWidth(media_width);
458 parcel->setMediaHeight(media_height);
459 parcel->setMediaAutoScale(media_auto_scale);
460 parcel->setMediaLoop(media_loop);
461
462 play(parcel);
463 } 459 }
464 460
465 } 461 }
466} 462}
463
464//static
465void LLViewerParcelMedia::undoParcelMediaUpdate()
466{
467 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
468 if (sSavedMediaInfo.notNull() && parcel)
469 {
470 sSavedMediaInfo->applyToParcel(parcel);
471 }
472 sSavedMediaInfo = NULL;
473}
474
467// Static 475// Static
468///////////////////////////////////////////////////////////////////////////////////////// 476/////////////////////////////////////////////////////////////////////////////////////////
469void LLViewerParcelMedia::sendMediaNavigateMessage(const std::string& url) 477void LLViewerParcelMedia::sendMediaNavigateMessage(const std::string& url)
@@ -619,7 +627,7 @@ void LLViewerParcelMedia::playStreamingMusic(LLParcel* parcel, bool filter)
619 { 627 {
620 // If filtering is needed or in case music_url just changed 628 // If filtering is needed or in case music_url just changed
621 // to something we did not yet approve. 629 // to something we did not yet approve.
622 filterMedia(parcel, 1); 630 filterMedia(parcel, 1, COMMAND_ORIGIN_LOCAL);
623 } 631 }
624 else if (gAudioStream) 632 else if (gAudioStream)
625 { 633 {
@@ -675,13 +683,13 @@ bool LLViewerParcelMedia::allowedMedia(std::string media_url)
675 return false; 683 return false;
676} 684}
677 685
678void LLViewerParcelMedia::filterMedia(LLParcel* parcel, U32 type) 686void LLViewerParcelMedia::filterMedia(LLParcel* parcel, U32 type, const ECommandOrigin origin)
679{ 687{
680 std::string media_action; 688 std::string media_action;
681 std::string media_url; 689 std::string media_url;
682 std::string domain; 690 std::string domain;
683 std::string ip; 691 std::string ip;
684 692
685 if (parcel != LLViewerParcelMgr::getInstance()->getAgentParcel()) 693 if (parcel != LLViewerParcelMgr::getInstance()->getAgentParcel())
686 { 694 {
687 // The parcel just changed (may occur right out after a TP) 695 // The parcel just changed (may occur right out after a TP)
@@ -775,12 +783,33 @@ void LLViewerParcelMedia::filterMedia(LLParcel* parcel, U32 type)
775 } 783 }
776 if (media_action == "ignore") 784 if (media_action == "ignore")
777 { 785 {
778 if (type == 1) 786 if (type == 0)
787 {
788 undoParcelMediaUpdate();
789 }
790 else if (type == 1)
779 { 791 {
780 LLViewerParcelMedia::stopStreamingMusic(); 792 LLViewerParcelMedia::stopStreamingMusic();
781 } 793 }
782 return; 794 return;
783 } 795 }
796 // skip local-originating play commands, unless the url is blacklisted.
797 if (gSavedSettings.getBOOL("MediaFilterOnlyRemoteCommands")
798 && (origin != COMMAND_ORIGIN_REMOTE)
799 && (media_action != "ignore"))
800 {
801 sAllowedMedia.insert(domain);
802 SLFloaterMediaFilter::setDirty();
803 if (type == 0)
804 {
805 play(parcel, false);
806 }
807 else
808 {
809 playStreamingMusic(parcel, false);
810 }
811 return;
812 }
784 813
785 LLSD args; 814 LLSD args;
786 if (ip != domain && domain.find('/') == std::string::npos) 815 if (ip != domain && domain.find('/') == std::string::npos)
@@ -795,6 +824,10 @@ void LLViewerParcelMedia::filterMedia(LLParcel* parcel, U32 type)
795 if (media_action == "deny") 824 if (media_action == "deny")
796 { 825 {
797 LLNotifications::instance().add("MediaBlocked", args); 826 LLNotifications::instance().add("MediaBlocked", args);
827 if (type == 0)
828 {
829 undoParcelMediaUpdate();
830 }
798 if (type == 1) 831 if (type == 1)
799 { 832 {
800 LLViewerParcelMedia::stopStreamingMusic(); 833 LLViewerParcelMedia::stopStreamingMusic();
@@ -873,10 +906,15 @@ void callback_media_alert(const LLSD &notification, const LLSD &response, LLParc
873 { 906 {
874 LLViewerParcelMedia::sDeniedMedia.insert(ip); 907 LLViewerParcelMedia::sDeniedMedia.insert(ip);
875 } 908 }
876 if (type == 1) 909 if (type == 0)
910 {
911 LLViewerParcelMedia::undoParcelMediaUpdate();
912 }
913 else if (type == 1)
877 { 914 {
878 LLViewerParcelMedia::stopStreamingMusic(); 915 LLViewerParcelMedia::stopStreamingMusic();
879 } 916 }
917
880 if (option == 1) // Deny 918 if (option == 1) // Deny
881 { 919 {
882 LLNotifications::instance().add("MediaBlocked", args); 920 LLNotifications::instance().add("MediaBlocked", args);
@@ -1040,3 +1078,65 @@ std::string LLViewerParcelMedia::extractDomain(std::string url)
1040 return url; 1078 return url;
1041} 1079}
1042 1080
1081LLViewerParcelMediaInfo::LLViewerParcelMediaInfo(const std::string url,
1082 const std::string type,
1083 const LLUUID media_id,
1084 const S32 width,
1085 const S32 height,
1086 const U8 scale,
1087 const U8 loop)
1088 :
1089 mMediaURL(url),
1090 mMediaType(type),
1091 mMediaID(media_id),
1092 mMediaWidth(width),
1093 mMediaHeight(height),
1094 mMediaAutoScale(scale),
1095 mMediaLoop(loop)
1096{
1097 LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
1098 mParcelLocalID = parcel ? parcel->getLocalID() : 0;
1099}
1100
1101LLViewerParcelMediaInfo::LLViewerParcelMediaInfo(const LLParcel* parcel)
1102{
1103 mMediaURL = parcel->getMediaURL();
1104 mMediaType = parcel->getMediaType();
1105 mMediaID = parcel->getMediaID();
1106 mMediaWidth = parcel->getMediaWidth();
1107 mMediaHeight = parcel->getMediaHeight();
1108 mMediaAutoScale = parcel->getMediaAutoScale();
1109 mMediaLoop = parcel->getMediaLoop();
1110 mParcelLocalID = parcel->getLocalID();
1111}
1112
1113void LLViewerParcelMediaInfo::applyToParcel(LLParcel* parcel)
1114{
1115 if (parcel && sameParcel(parcel))
1116 {
1117 parcel->setMediaURL(mMediaURL);
1118 parcel->setMediaType(mMediaType);
1119 parcel->setMediaID(mMediaID);
1120 parcel->setMediaWidth(mMediaWidth);
1121 parcel->setMediaHeight(mMediaHeight);
1122 parcel->setMediaAutoScale(mMediaAutoScale);
1123 parcel->setMediaLoop(mMediaLoop);
1124 }
1125}
1126
1127bool LLViewerParcelMediaInfo::sameParcel(const LLParcel* parcel) const
1128{
1129 return parcel && (parcel->getLocalID() == mParcelLocalID);
1130}
1131
1132bool LLViewerParcelMediaInfo::operator==(const LLViewerParcelMediaInfo &rhs) const
1133{
1134 return (mMediaURL == rhs.mMediaURL) &&
1135 (mMediaType == rhs.mMediaType) &&
1136 (mMediaID == rhs.mMediaID) &&
1137 (mMediaWidth == rhs.mMediaWidth) &&
1138 (mMediaHeight == rhs.mMediaHeight) &&
1139 (mMediaAutoScale == rhs.mMediaAutoScale) &&
1140 (mMediaLoop == rhs.mMediaLoop) &&
1141 (mParcelLocalID == rhs.mParcelLocalID);
1142} \ No newline at end of file
diff --git a/linden/indra/newview/llviewerparcelmedia.h b/linden/indra/newview/llviewerparcelmedia.h
index 7531a0f..f4c4312 100644
--- a/linden/indra/newview/llviewerparcelmedia.h
+++ b/linden/indra/newview/llviewerparcelmedia.h
@@ -34,6 +34,7 @@
34#define LLVIEWERPARCELMEDIA_H 34#define LLVIEWERPARCELMEDIA_H
35 35
36#include "llviewermedia.h" 36#include "llviewermedia.h"
37#include "llmemory.h"
37 38
38// For use by other patches so they know that media filtering is implemented. 39// For use by other patches so they know that media filtering is implemented.
39#define MEDIA_FILTERING 1 40#define MEDIA_FILTERING 1
@@ -41,6 +42,7 @@
41class LLMessageSystem; 42class LLMessageSystem;
42class LLParcel; 43class LLParcel;
43class LLViewerParcelMediaNavigationObserver; 44class LLViewerParcelMediaNavigationObserver;
45class LLViewerParcelMediaInfo;
44 46
45 47
46// This class understands land parcels, network traffic, LSL media 48// This class understands land parcels, network traffic, LSL media
@@ -49,6 +51,13 @@ class LLViewerParcelMediaNavigationObserver;
49class LLViewerParcelMedia : public LLViewerMediaObserver 51class LLViewerParcelMedia : public LLViewerMediaObserver
50{ 52{
51 LOG_CLASS(LLViewerParcelMedia); 53 LOG_CLASS(LLViewerParcelMedia);
54 private:
55 typedef enum e_command_origin
56 {
57 COMMAND_ORIGIN_LOCAL,
58 COMMAND_ORIGIN_REMOTE
59 } ECommandOrigin;
60
52 public: 61 public:
53 static void initClass(); 62 static void initClass();
54 static void cleanupClass(); 63 static void cleanupClass();
@@ -57,14 +66,14 @@ class LLViewerParcelMedia : public LLViewerMediaObserver
57 // called when the agent's parcel has a new URL, or the agent has 66 // called when the agent's parcel has a new URL, or the agent has
58 // walked on to a new parcel with media 67 // walked on to a new parcel with media
59 68
60 static void play(LLParcel* parcel, bool filter = true); 69 static void play(LLParcel* parcel, bool filter = true, const ECommandOrigin origin = COMMAND_ORIGIN_LOCAL);
61 // user clicked play button in media transport controls 70 // user clicked play button in media transport controls
62 static void playStreamingMusic(LLParcel* parcel, bool filter = true); 71 static void playStreamingMusic(LLParcel* parcel, bool filter = true);
63 // play the parcel music stream 72 // play the parcel music stream
64 static void stopStreamingMusic(); 73 static void stopStreamingMusic();
65 // stop the parcel music stream 74 // stop the parcel music stream
66 75
67 static void filterMedia(LLParcel* parcel, U32 type); // type: 0 = media, 1 = streaming music 76 static void filterMedia(LLParcel* parcel, U32 type, const ECommandOrigin origin); // type: 0 = media, 1 = streaming music
68 static bool allowedMedia(std::string media_url); 77 static bool allowedMedia(std::string media_url);
69 78
70 static bool loadDomainFilterList(); 79 static bool loadDomainFilterList();
@@ -90,6 +99,7 @@ class LLViewerParcelMedia : public LLViewerMediaObserver
90 99
91 static void processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ); 100 static void processParcelMediaCommandMessage( LLMessageSystem *msg, void ** );
92 static void processParcelMediaUpdate( LLMessageSystem *msg, void ** ); 101 static void processParcelMediaUpdate( LLMessageSystem *msg, void ** );
102 static void undoParcelMediaUpdate(); // reset the parcel's media to what it was before ParcelMediaUpdate
93 static void sendMediaNavigateMessage(const std::string& url); 103 static void sendMediaNavigateMessage(const std::string& url);
94 104
95 // inherited from LLViewerMediaObserver 105 // inherited from LLViewerMediaObserver
@@ -107,6 +117,7 @@ class LLViewerParcelMedia : public LLViewerMediaObserver
107 static std::set<std::string> sMediaQueries; 117 static std::set<std::string> sMediaQueries;
108 static std::set<std::string> sAllowedMedia; 118 static std::set<std::string> sAllowedMedia;
109 static std::set<std::string> sDeniedMedia; 119 static std::set<std::string> sDeniedMedia;
120 static LLPointer<LLViewerParcelMediaInfo> sSavedMediaInfo; // The parcel original media (before a remote command is applied)
110}; 121};
111 122
112 123
@@ -120,4 +131,29 @@ public:
120 131
121}; 132};
122 133
134class LLViewerParcelMediaInfo : public LLRefCount
135{
136public:
137 LLViewerParcelMediaInfo(const std::string url,
138 const std::string type,
139 const LLUUID media_id,
140 const S32 width,
141 const S32 height,
142 const U8 scale,
143 const U8 loop);
144 LLViewerParcelMediaInfo(const LLParcel* parcel);
145 ~LLViewerParcelMediaInfo() {}
146 void applyToParcel(LLParcel* parcel);
147 bool sameParcel(const LLParcel* parcel) const;
148 bool operator==(const LLViewerParcelMediaInfo &rhs) const;
149private:
150 std::string mMediaURL;
151 std::string mMediaType;
152 LLUUID mMediaID;
153 S32 mMediaWidth;
154 S32 mMediaHeight;
155 U8 mMediaAutoScale;
156 U8 mMediaLoop;
157 S32 mParcelLocalID;
158};
123#endif 159#endif
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_media_filter.xml b/linden/indra/newview/skins/default/xui/en-us/floater_media_filter.xml
index 5faaf1a..f0fb3a3 100644
--- a/linden/indra/newview/skins/default/xui/en-us/floater_media_filter.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_media_filter.xml
@@ -1,9 +1,22 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<floater name="floatermediafilter" title="Media Filter" rect_control="MediaFilterRect" 2<floater name="floatermediafilter" title="Media Filter" rect_control="MediaFilterRect"
3 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true" 3 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
4 height="350" width="600" min_height="350" min_width="600"> 4 height="410" width="600" min_height="350" min_width="600">
5
6 <check_box control_name="MediaEnableFilter" name="enable_mediafilter" label="Enable Media Filter"
7 initial_value="true" tool_tip="Enables filtering media URLs by domain names."
8 font="SansSerifSmall" mouse_opaque="true"
9 left="14" height="16" bottom_delta="-45" width="4500" follows="left|top" />
10
11 <check_box control_name="MediaFilterOnlyRemoteCommands" name="filter_only_remote"
12 label="Filter only when a script initiates the stream (less secure)" initial_value="false"
13 tool_tip="This will prevent popups asking about URLs that are permanently set on a parcel.
14Only scripted changes to the media URL and scripted requests to start playing a stream will be filtered."
15 font="SansSerifSmall" mouse_opaque="true"
16 left_delta="14" height="16" width="450" follows="left|top" />
17
5 <text name="info1" font="SansSerif" mouse_opaque="true" halign="center" 18 <text name="info1" font="SansSerif" mouse_opaque="true" halign="center"
6 bottom_delta="-45" left="20" height="20" width="560" follows="left|right|top"> 19 bottom_delta="-40" left="20" height="20" width="560" follows="left|right|top">
7 Domains in bold are in the persistent list (i.e. they are whitelisted or blacklisted). 20 Domains in bold are in the persistent list (i.e. they are whitelisted or blacklisted).
8 </text> 21 </text>
9 <text name="info2" font="SansSerif" mouse_opaque="true" halign="center" 22 <text name="info2" font="SansSerif" mouse_opaque="true" halign="center"
@@ -14,7 +27,7 @@
14 <scroll_list name="whitelist_list" follows="top|bottom|left" 27 <scroll_list name="whitelist_list" follows="top|bottom|left"
15 background_visible="true" mouse_opaque="true" 28 background_visible="true" mouse_opaque="true"
16 multi_select="false" column_padding="5" draw_border="true" draw_heading="true" 29 multi_select="false" column_padding="5" draw_border="true" draw_heading="true"
17 bottom_delta="-205" left="15" height="200" width="280"> 30 bottom_delta="-200" left="15" height="200" width="280">
18 <column name="whitelist_col" label="Allowed domains or server objects" dynamicwidth="true" /> 31 <column name="whitelist_col" label="Allowed domains or server objects" dynamicwidth="true" />
19 </scroll_list> 32 </scroll_list>
20 33
@@ -69,10 +82,13 @@
69 tool_tip="Enter the new URL, domain name, IP or scripted object HTTP server path here" 82 tool_tip="Enter the new URL, domain name, IP or scripted object HTTP server path here"
70 select_all_on_focus_received="true" select_on_focus="true" 83 select_all_on_focus_received="true" select_on_focus="true"
71 bevel_style="in" border_style="line" border_thickness="1" 84 bevel_style="in" border_style="line" border_thickness="1"
72 bottom_delta="-22" right="-100" height="20" left="15" follows="left|bottom|right"/> 85 bottom_delta="-22" right="-180" height="20" left="15" follows="left|bottom|right"/>
73 86
87 <button name="cancel_domain" font="SansSerif" label="Cancel" halign="center" enabled="false"
88 mouse_opaque="true" follows="bottom|right"
89 bottom_delta="0" right="-15" height="20" width="80"/>
74 <button name="commit_domain" font="SansSerif" label="Add" halign="center" enabled="false" 90 <button name="commit_domain" font="SansSerif" label="Add" halign="center" enabled="false"
75 tool_tip="Add to the list" 91 tool_tip="Add to the list"
76 mouse_opaque="true" follows="bottom|right" 92 mouse_opaque="true" follows="bottom|right"
77 bottom_delta="0" right="-15" height="20" width="80"/> 93 bottom_delta="0" right="-95" height="20" width="80"/>
78</floater> 94</floater>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
index c6bb938..3415b1b 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
@@ -9,13 +9,13 @@
9 Volume: 9 Volume:
10 </text> 10 </text>
11 <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" 11 <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
12 bottom="-190" drop_shadow_visible="true" enabled="true" follows="left|top" 12 bottom="-202" drop_shadow_visible="true" enabled="true" follows="left|top"
13 font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10" 13 font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
14 mouse_opaque="true" name="streaming_prefs_text" v_pad="0" width="128"> 14 mouse_opaque="true" name="streaming_prefs_text" v_pad="0" width="128">
15 Streaming: 15 Streaming:
16 </text> 16 </text>
17 <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" 17 <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
18 bottom="-285" drop_shadow_visible="true" enabled="true" follows="left|top" 18 bottom="-315" drop_shadow_visible="true" enabled="true" follows="left|top"
19 font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10" 19 font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
20 mouse_opaque="true" name="audio_prefs_text" v_pad="0" width="128"> 20 mouse_opaque="true" name="audio_prefs_text" v_pad="0" width="128">
21 Audio: 21 Audio:
@@ -42,7 +42,16 @@
42 initial_value="true" label="Automatically play media" left="162" 42 initial_value="true" label="Automatically play media" left="162"
43 mouse_opaque="true" name="auto_streaming_video" radio_style="false" 43 mouse_opaque="true" name="auto_streaming_video" radio_style="false"
44 width="338" /> 44 width="338" />
45 <check_box bottom_delta="-27" control_name="MuteWhenMinimized" enabled="true" 45 <check_box bottom_delta="-20" control_name="MediaEnableFilter" enabled="true"
46 follows="left|top" font="SansSerifSmall" height="16"
47 initial_value="true" label="Filter media URLs" left="142"
48 mouse_opaque="true" name="enable_media_filter" radio_style="false"
49 width="200" />
50 <button name="show_media_filter" font="SansSerif" label="Media Filter Settings" halign="center"
51 tool_tip="Edit settings and the blocked and allowed lists for the Media Filter."
52 enabled="false" mouse_opaque="true" follows="top|right"
53 bottom_delta="-2" right="-15" height="20" width="180" />
54 <check_box bottom_delta="-33" control_name="MuteWhenMinimized" enabled="true"
46 follows="left|top" font="SansSerifSmall" height="16" initial_value="true" 55 follows="left|top" font="SansSerifSmall" height="16" initial_value="true"
47 label="Mute audio when window minimized" left="142" mouse_opaque="true" 56 label="Mute audio when window minimized" left="142" mouse_opaque="true"
48 name="mute_when_minimized" radio_style="false" width="215" /> 57 name="mute_when_minimized" radio_style="false" width="215" />
diff --git a/linden/indra/newview/slfloatermediafilter.cpp b/linden/indra/newview/slfloatermediafilter.cpp
index 7b287e0..b0d9c26 100644
--- a/linden/indra/newview/slfloatermediafilter.cpp
+++ b/linden/indra/newview/slfloatermediafilter.cpp
@@ -43,6 +43,7 @@
43 43
44SLFloaterMediaFilter* SLFloaterMediaFilter::sInstance = NULL; 44SLFloaterMediaFilter* SLFloaterMediaFilter::sInstance = NULL;
45bool SLFloaterMediaFilter::sIsWhitelist = false; 45bool SLFloaterMediaFilter::sIsWhitelist = false;
46bool SLFloaterMediaFilter::sIsAdding = false;
46bool SLFloaterMediaFilter::sShowIPs = false; 47bool SLFloaterMediaFilter::sShowIPs = false;
47 48
48SLFloaterMediaFilter::SLFloaterMediaFilter() : LLFloater(std::string("media filter")), mIsDirty(false) 49SLFloaterMediaFilter::SLFloaterMediaFilter() : LLFloater(std::string("media filter")), mIsDirty(false)
@@ -69,10 +70,12 @@ BOOL SLFloaterMediaFilter::postBuild()
69 childSetAction("add_blacklist", onBlacklistAdd, this); 70 childSetAction("add_blacklist", onBlacklistAdd, this);
70 childSetAction("remove_blacklist", onBlacklistRemove, this); 71 childSetAction("remove_blacklist", onBlacklistRemove, this);
71 childSetAction("commit_domain", onCommitDomain, this); 72 childSetAction("commit_domain", onCommitDomain, this);
73 childSetAction("cancel_domain", onCancelDomain, this);
72 childSetUserData("whitelist_list", this); 74 childSetUserData("whitelist_list", this);
73 childSetUserData("blacklist_list", this); 75 childSetUserData("blacklist_list", this);
74 mIsDirty = true; 76 mIsDirty = true;
75 } 77 }
78 gSavedSettings.getControl("MediaEnableFilter")->getSignal()->connect(boost::bind(&onMediaEnableFilterChanged, _1));
76 79
77 return TRUE; 80 return TRUE;
78} 81}
@@ -174,21 +177,7 @@ void SLFloaterMediaFilter::draw()
174 mWhitelistSLC->setScrollPos(whitescrollpos); 177 mWhitelistSLC->setScrollPos(whitescrollpos);
175 mBlacklistSLC->setScrollPos(blackscrollpos); 178 mBlacklistSLC->setScrollPos(blackscrollpos);
176 179
177 if (!gSavedSettings.getBOOL("MediaEnableFilter")) 180 updateWidgets();
178 {
179 childDisable("clear_lists");
180 childDisable("show_ips");
181 childDisable("blacklist_list");
182 childDisable("whitelist_list");
183 childDisable("remove_whitelist");
184 childDisable("add_whitelist");
185 childDisable("remove_blacklist");
186 childDisable("add_blacklist");
187 childDisable("match_ip");
188 childDisable("input_domain");
189 childDisable("commit_domain");
190 childSetText("add_text", std::string("****** WARNING: media filtering is currently DISABLED ******"));
191 }
192 181
193 mIsDirty = false; 182 mIsDirty = false;
194 sShowIPs = false; 183 sShowIPs = false;
@@ -197,6 +186,47 @@ void SLFloaterMediaFilter::draw()
197 LLFloater::draw(); 186 LLFloater::draw();
198} 187}
199 188
189void SLFloaterMediaFilter::updateWidgets()
190{
191 bool enabled = gSavedSettings.getBOOL("MediaEnableFilter");
192 childSetEnabled("clear_lists", enabled && !sIsAdding);
193 childSetEnabled("show_ips", enabled && !sIsAdding);
194 childSetEnabled("blacklist_list", enabled && !sIsAdding);
195 childSetEnabled("whitelist_list", enabled && !sIsAdding);
196 childSetEnabled("remove_whitelist", enabled && !sIsAdding);
197 childSetEnabled("add_whitelist", enabled && !sIsAdding);
198 childSetEnabled("remove_blacklist", enabled && !sIsAdding);
199 childSetEnabled("add_blacklist", enabled && !sIsAdding);
200 childSetEnabled("match_ip", enabled);
201 childSetEnabled("input_domain", enabled && sIsAdding);
202 childSetEnabled("commit_domain", enabled && sIsAdding);
203 childSetEnabled("cancel_domain", enabled && sIsAdding);
204 childSetEnabled("filter_only_remote", enabled);
205 childSetEnabled("info1", enabled);
206 childSetEnabled("info2", enabled);
207
208 std::string add_text("****** Media filtering is currently DISABLED ******");
209 if (enabled)
210 {
211 if (sIsAdding)
212 {
213 if (sIsWhitelist)
214 {
215 add_text = "Enter the domain/url to add to the white list:";
216 }
217 else
218 {
219 add_text = "Enter the domain/url to add to the black list:";
220 }
221 }
222 else
223 {
224 add_text = "New Domain:";
225 }
226 }
227 childSetText("add_text", add_text);
228}
229
200void SLFloaterMediaFilter::setDirty() 230void SLFloaterMediaFilter::setDirty()
201{ 231{
202 if (sInstance) 232 if (sInstance)
@@ -255,18 +285,9 @@ void SLFloaterMediaFilter::onWhitelistAdd(void* data)
255 { 285 {
256 return; 286 return;
257 } 287 }
258 sInstance->childDisable("clear_lists");
259 sInstance->childDisable("show_ips");
260 sInstance->childDisable("blacklist_list");
261 sInstance->childDisable("whitelist_list");
262 sInstance->childDisable("remove_whitelist");
263 sInstance->childDisable("add_whitelist");
264 sInstance->childDisable("remove_blacklist");
265 sInstance->childDisable("add_blacklist");
266 sInstance->childEnable("input_domain");
267 sInstance->childEnable("commit_domain");
268 sInstance->childSetText("add_text", std::string("Enter the domain/url to add to the white list:"));
269 sIsWhitelist = true; 288 sIsWhitelist = true;
289 sIsAdding = true;
290 sInstance->updateWidgets();
270} 291}
271 292
272void SLFloaterMediaFilter::onWhitelistRemove(void* data) 293void SLFloaterMediaFilter::onWhitelistRemove(void* data)
@@ -329,18 +350,9 @@ void SLFloaterMediaFilter::onBlacklistAdd(void* data)
329 { 350 {
330 return; 351 return;
331 } 352 }
332 sInstance->childDisable("clear_lists");
333 sInstance->childDisable("show_ips");
334 sInstance->childDisable("blacklist_list");
335 sInstance->childDisable("whitelist_list");
336 sInstance->childDisable("remove_whitelist");
337 sInstance->childDisable("add_whitelist");
338 sInstance->childDisable("remove_blacklist");
339 sInstance->childDisable("add_blacklist");
340 sInstance->childEnable("input_domain");
341 sInstance->childEnable("commit_domain");
342 sInstance->childSetText("add_text", std::string("Enter the domain/url to add to the black list:"));
343 sIsWhitelist = false; 353 sIsWhitelist = false;
354 sIsAdding = true;
355 sInstance->updateWidgets();
344} 356}
345 357
346void SLFloaterMediaFilter::onBlacklistRemove(void* data) 358void SLFloaterMediaFilter::onBlacklistRemove(void* data)
@@ -452,17 +464,25 @@ void SLFloaterMediaFilter::onCommitDomain(void* data)
452 LLViewerParcelMedia::saveDomainFilterList(); 464 LLViewerParcelMedia::saveDomainFilterList();
453 } 465 }
454 466
455 sInstance->childEnable("clear_lists");
456 sInstance->childEnable("show_ips");
457 sInstance->childEnable("blacklist_list");
458 sInstance->childEnable("whitelist_list");
459 sInstance->childEnable("remove_whitelist");
460 sInstance->childEnable("add_whitelist");
461 sInstance->childEnable("remove_blacklist");
462 sInstance->childEnable("add_blacklist");
463 sInstance->childDisable("input_domain");
464 sInstance->childDisable("commit_domain");
465 sInstance->childSetText("add_text", std::string("New domain:"));
466 sInstance->childSetText("input_domain", std::string("")); 467 sInstance->childSetText("input_domain", std::string(""));
468 sIsAdding = false;
469 setDirty();
470}
471
472//static
473void SLFloaterMediaFilter::onCancelDomain(void* data)
474{
475 if (!sInstance)
476 {
477 return;
478 }
479 sInstance->childSetText("input_domain", std::string(""));
480 sIsAdding = false;
481 setDirty();
482}
483
484//static
485void SLFloaterMediaFilter::onMediaEnableFilterChanged(const LLSD& newvalue)
486{
467 setDirty(); 487 setDirty();
468} 488}
diff --git a/linden/indra/newview/slfloatermediafilter.h b/linden/indra/newview/slfloatermediafilter.h
index aafa5a2..9067c74 100644
--- a/linden/indra/newview/slfloatermediafilter.h
+++ b/linden/indra/newview/slfloatermediafilter.h
@@ -38,6 +38,7 @@
38 38
39class LLScrollListCtrl; 39class LLScrollListCtrl;
40class LLButton; 40class LLButton;
41class LLSD;
41 42
42class SLFloaterMediaFilter : public LLFloater 43class SLFloaterMediaFilter : public LLFloater
43{ 44{
@@ -58,10 +59,16 @@ public:
58 static void onBlacklistAdd(void*); 59 static void onBlacklistAdd(void*);
59 static void onBlacklistRemove(void*); 60 static void onBlacklistRemove(void*);
60 static void onCommitDomain(void*); 61 static void onCommitDomain(void*);
62 static void onCancelDomain(void*);
63 static void onMediaEnableFilterChanged(const LLSD& newvalue);
64
65private:
66 void updateWidgets();
61 67
62private: 68private:
63 static bool sIsWhitelist; 69 static bool sIsWhitelist;
64 static bool sShowIPs; 70 static bool sShowIPs;
71 static bool sIsAdding;
65 LLScrollListCtrl* mWhitelistSLC; 72 LLScrollListCtrl* mWhitelistSLC;
66 LLScrollListCtrl* mBlacklistSLC; 73 LLScrollListCtrl* mBlacklistSLC;
67 bool mIsDirty; 74 bool mIsDirty;