aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llinventory/llparcel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llinventory/llparcel.cpp')
-rw-r--r--linden/indra/llinventory/llparcel.cpp138
1 files changed, 132 insertions, 6 deletions
diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp
index 9c27476..39605eb 100644
--- a/linden/indra/llinventory/llparcel.cpp
+++ b/linden/indra/llinventory/llparcel.cpp
@@ -199,6 +199,12 @@ void LLParcel::init(const LLUUID &owner_id,
199 mObscureMusic = 1; 199 mObscureMusic = 1;
200 mMediaWidth = 0; 200 mMediaWidth = 0;
201 mMediaHeight = 0; 201 mMediaHeight = 0;
202 setMediaCurrentURL(LLStringUtil::null);
203 mMediaURLFilterEnable = FALSE;
204 mMediaURLFilterList = LLSD::emptyArray();
205 mMediaAllowNavigate = TRUE;
206 mMediaURLTimeout = 0.0f;
207 mMediaPreventCameraZoom = FALSE;
202 208
203 mGroupID.setNull(); 209 mGroupID.setNull();
204 210
@@ -300,11 +306,11 @@ void LLParcel::setMediaType(const std::string& type)
300 mMediaType = type; 306 mMediaType = type;
301 mMediaType = rawstr_to_utf8(mMediaType); 307 mMediaType = rawstr_to_utf8(mMediaType);
302 308
303 // This code attempts to preserve legacy movie functioning 309// // This legacy code prevents any media different from video from working on OpenSim
304 if(mMediaType.empty() && ! mMediaURL.empty()) 310// if(mMediaType.empty() && ! mMediaURL.empty())
305 { 311// {
306 setMediaType(std::string("video/vnd.secondlife.qt.legacy")); 312// setMediaType(std::string("video/vnd.secondlife.qt.legacy"));
307 } 313// }
308} 314}
309void LLParcel::setMediaWidth(S32 width) 315void LLParcel::setMediaWidth(S32 width)
310{ 316{
@@ -314,6 +320,56 @@ void LLParcel::setMediaHeight(S32 height)
314{ 320{
315 mMediaHeight = height; 321 mMediaHeight = height;
316} 322}
323
324void LLParcel::setMediaCurrentURL(const std::string& url)
325{
326 mMediaCurrentURL = url;
327 // The escaping here must match the escaping in the database
328 // abstraction layer if it's ever added.
329 // This should really filter the url in some way. Other than
330 // simply requiring non-printable.
331 LLStringFn::replace_nonprintable_in_ascii(mMediaCurrentURL, LL_UNKNOWN_CHAR);
332
333}
334
335void LLParcel::setMediaURLResetTimer(F32 time)
336{
337 mMediaResetTimer.start();
338 mMediaResetTimer.setTimerExpirySec(time);
339}
340
341void LLParcel::setMediaURLFilterList(LLSD list)
342{
343 // sanity check LLSD
344 // must be array of strings
345 if (!list.isArray())
346 {
347 return;
348 }
349
350 for (S32 i = 0; i < list.size(); i++)
351 {
352 if (!list[i].isString())
353 return;
354 }
355
356 // can't be too big
357 const S32 MAX_SIZE = 50;
358 if (list.size() > MAX_SIZE)
359 {
360 LLSD new_list = LLSD::emptyArray();
361
362 for (S32 i = 0; i < llmin(list.size(), MAX_SIZE); i++)
363 {
364 new_list.append(list[i]);
365 }
366
367 list = new_list;
368 }
369
370 mMediaURLFilterList = list;
371}
372
317// virtual 373// virtual
318void LLParcel::setLocalID(S32 local_id) 374void LLParcel::setLocalID(S32 local_id)
319{ 375{
@@ -568,6 +624,34 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr
568 return input_stream.good(); 624 return input_stream.good();
569} 625}
570 626
627BOOL LLParcel::importMediaURLFilter(std::istream& input_stream, std::string& url)
628{
629 skip_to_end_of_next_keyword("{", input_stream);
630
631 while(input_stream.good())
632 {
633 skip_comments_and_emptyspace(input_stream);
634 std::string line, keyword, value;
635 get_line(line, input_stream, MAX_STRING);
636 get_keyword_and_value(keyword, value, line);
637
638 if ("}" == keyword)
639 {
640 break;
641 }
642 else if ("url" == keyword)
643 {
644 url = value;
645 }
646 else
647 {
648 llwarns << "Unknown keyword in parcel media url filter section: <"
649 << keyword << ">" << llendl;
650 }
651 }
652 return input_stream.good();
653}
654
571// Assumes we are in a block "ParcelData" 655// Assumes we are in a block "ParcelData"
572void LLParcel::packMessage(LLMessageSystem* msg) 656void LLParcel::packMessage(LLMessageSystem* msg)
573{ 657{
@@ -606,9 +690,15 @@ void LLParcel::packMessage(LLSD& msg)
606 msg["media_height"] = getMediaHeight(); 690 msg["media_height"] = getMediaHeight();
607 msg["auto_scale"] = getMediaAutoScale(); 691 msg["auto_scale"] = getMediaAutoScale();
608 msg["media_loop"] = getMediaLoop(); 692 msg["media_loop"] = getMediaLoop();
693 msg["media_current_url"] = getMediaCurrentURL();
609 msg["obscure_media"] = getObscureMedia(); 694 msg["obscure_media"] = getObscureMedia();
610 msg["obscure_music"] = getObscureMusic(); 695 msg["obscure_music"] = getObscureMusic();
611 msg["media_id"] = getMediaID(); 696 msg["media_id"] = getMediaID();
697 msg["media_allow_navigate"] = getMediaAllowNavigate();
698 msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom();
699 msg["media_url_timeout"] = getMediaURLTimeout();
700 msg["media_url_filter_enable"] = getMediaURLFilterEnable();
701 msg["media_url_filter_list"] = getMediaURLFilterList();
612 msg["group_id"] = getGroupID(); 702 msg["group_id"] = getGroupID();
613 msg["pass_price"] = mPassPrice; 703 msg["pass_price"] = mPassPrice;
614 msg["pass_hours"] = mPassHours; 704 msg["pass_hours"] = mPassHours;
@@ -672,12 +762,28 @@ void LLParcel::unpackMessage(LLMessageSystem* msg)
672 } 762 }
673 else 763 else
674 { 764 {
675 setMediaType(std::string("video/vnd.secondlife.qt.legacy")); 765 setMediaType(std::string("")); //having mMediaType empty causes autodetect,
766 // thats what we want -- AW
676 setMediaDesc(std::string("No Description available without Server Upgrade")); 767 setMediaDesc(std::string("No Description available without Server Upgrade"));
677 mMediaLoop = true; 768 mMediaLoop = true;
678 mObscureMedia = true; 769 mObscureMedia = true;
679 mObscureMusic = true; 770 mObscureMusic = true;
680 } 771 }
772
773 if(msg->getNumberOfBlocks("MediaLinkSharing") > 0)
774 {
775 msg->getString("MediaLinkSharing", "MediaCurrentURL", buffer);
776 setMediaCurrentURL(buffer);
777 msg->getU8 ( "MediaLinkSharing", "MediaAllowNavigate", mMediaAllowNavigate );
778 msg->getU8 ( "MediaLinkSharing", "MediaURLFilterEnable", mMediaURLFilterEnable );
779 msg->getU8 ( "MediaLinkSharing", "MediaPreventCameraZoom", mMediaPreventCameraZoom );
780 msg->getF32( "MediaLinkSharing", "MediaURLTimeout", mMediaURLTimeout);
781 }
782 else
783 {
784 setMediaCurrentURL(LLStringUtil::null);
785 }
786
681} 787}
682 788
683void LLParcel::packAccessEntries(LLMessageSystem* msg, 789void LLParcel::packAccessEntries(LLMessageSystem* msg,
@@ -994,6 +1100,20 @@ BOOL LLParcel::isSaleTimerExpired(const U64& time)
994 return expired; 1100 return expired;
995} 1101}
996 1102
1103BOOL LLParcel::isMediaResetTimerExpired(const U64& time)
1104{
1105 if (mMediaResetTimer.getStarted() == FALSE)
1106 {
1107 return FALSE;
1108 }
1109 BOOL expired = mMediaResetTimer.checkExpirationAndReset(0.0);
1110 if (expired)
1111 {
1112 mMediaResetTimer.stop();
1113 }
1114 return expired;
1115}
1116
997 1117
998void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) 1118void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group)
999{ 1119{
@@ -1117,6 +1237,12 @@ void LLParcel::clearParcel()
1117 mObscureMusic = 1; 1237 mObscureMusic = 1;
1118 mMediaWidth = 0; 1238 mMediaWidth = 0;
1119 mMediaHeight = 0; 1239 mMediaHeight = 0;
1240 setMediaCurrentURL(LLStringUtil::null);
1241 setMediaURLFilterList(LLSD::emptyArray());
1242 setMediaURLFilterEnable(FALSE);
1243 setMediaAllowNavigate(TRUE);
1244 setMediaPreventCameraZoom(FALSE);
1245 setMediaURLTimeout(0.0f);
1120 setMusicURL(LLStringUtil::null); 1246 setMusicURL(LLStringUtil::null);
1121 setInEscrow(FALSE); 1247 setInEscrow(FALSE);
1122 setAuthorizedBuyerID(LLUUID::null); 1248 setAuthorizedBuyerID(LLUUID::null);