diff options
author | Armin Weatherwax | 2010-06-14 12:04:49 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:38:25 +0200 |
commit | 35df5441d3e2789663532c948731aff3a1e04728 (patch) | |
tree | ac7674289784a5f96106ea507637055a8dada78a /linden/indra/llinventory/llparcel.cpp | |
parent | Changed version to Experimental 2010.09.18 (diff) | |
download | meta-impy-35df5441d3e2789663532c948731aff3a1e04728.zip meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.gz meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.bz2 meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.xz |
llmediaplugins first step
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llinventory/llparcel.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp index 9c27476..547862f 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 | ||
@@ -314,6 +320,56 @@ void LLParcel::setMediaHeight(S32 height) | |||
314 | { | 320 | { |
315 | mMediaHeight = height; | 321 | mMediaHeight = height; |
316 | } | 322 | } |
323 | |||
324 | void 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 | |||
335 | void LLParcel::setMediaURLResetTimer(F32 time) | ||
336 | { | ||
337 | mMediaResetTimer.start(); | ||
338 | mMediaResetTimer.setTimerExpirySec(time); | ||
339 | } | ||
340 | |||
341 | void 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 |
318 | void LLParcel::setLocalID(S32 local_id) | 374 | void 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 | ||
627 | BOOL 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" |
572 | void LLParcel::packMessage(LLMessageSystem* msg) | 656 | void 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; |
@@ -678,6 +768,21 @@ void LLParcel::unpackMessage(LLMessageSystem* msg) | |||
678 | mObscureMedia = true; | 768 | mObscureMedia = true; |
679 | mObscureMusic = true; | 769 | mObscureMusic = true; |
680 | } | 770 | } |
771 | |||
772 | if(msg->getNumberOfBlocks("MediaLinkSharing") > 0) | ||
773 | { | ||
774 | msg->getString("MediaLinkSharing", "MediaCurrentURL", buffer); | ||
775 | setMediaCurrentURL(buffer); | ||
776 | msg->getU8 ( "MediaLinkSharing", "MediaAllowNavigate", mMediaAllowNavigate ); | ||
777 | msg->getU8 ( "MediaLinkSharing", "MediaURLFilterEnable", mMediaURLFilterEnable ); | ||
778 | msg->getU8 ( "MediaLinkSharing", "MediaPreventCameraZoom", mMediaPreventCameraZoom ); | ||
779 | msg->getF32( "MediaLinkSharing", "MediaURLTimeout", mMediaURLTimeout); | ||
780 | } | ||
781 | else | ||
782 | { | ||
783 | setMediaCurrentURL(LLStringUtil::null); | ||
784 | } | ||
785 | |||
681 | } | 786 | } |
682 | 787 | ||
683 | void LLParcel::packAccessEntries(LLMessageSystem* msg, | 788 | void LLParcel::packAccessEntries(LLMessageSystem* msg, |
@@ -994,6 +1099,20 @@ BOOL LLParcel::isSaleTimerExpired(const U64& time) | |||
994 | return expired; | 1099 | return expired; |
995 | } | 1100 | } |
996 | 1101 | ||
1102 | BOOL LLParcel::isMediaResetTimerExpired(const U64& time) | ||
1103 | { | ||
1104 | if (mMediaResetTimer.getStarted() == FALSE) | ||
1105 | { | ||
1106 | return FALSE; | ||
1107 | } | ||
1108 | BOOL expired = mMediaResetTimer.checkExpirationAndReset(0.0); | ||
1109 | if (expired) | ||
1110 | { | ||
1111 | mMediaResetTimer.stop(); | ||
1112 | } | ||
1113 | return expired; | ||
1114 | } | ||
1115 | |||
997 | 1116 | ||
998 | void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) | 1117 | void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) |
999 | { | 1118 | { |
@@ -1117,6 +1236,12 @@ void LLParcel::clearParcel() | |||
1117 | mObscureMusic = 1; | 1236 | mObscureMusic = 1; |
1118 | mMediaWidth = 0; | 1237 | mMediaWidth = 0; |
1119 | mMediaHeight = 0; | 1238 | mMediaHeight = 0; |
1239 | setMediaCurrentURL(LLStringUtil::null); | ||
1240 | setMediaURLFilterList(LLSD::emptyArray()); | ||
1241 | setMediaURLFilterEnable(FALSE); | ||
1242 | setMediaAllowNavigate(TRUE); | ||
1243 | setMediaPreventCameraZoom(FALSE); | ||
1244 | setMediaURLTimeout(0.0f); | ||
1120 | setMusicURL(LLStringUtil::null); | 1245 | setMusicURL(LLStringUtil::null); |
1121 | setInEscrow(FALSE); | 1246 | setInEscrow(FALSE); |
1122 | setAuthorizedBuyerID(LLUUID::null); | 1247 | setAuthorizedBuyerID(LLUUID::null); |