From 7f090f7bec5264ca9e203c27dfb6b2992bb2bcbd Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 14 Sep 2009 17:52:41 -0700 Subject: Merged in jacek/next --- linden/indra/llcommon/llchat.h | 8 + linden/indra/newview/CMakeLists.txt | 13 + linden/indra/newview/app_settings/settings.xml | 117 +- .../newview/app_settings/settings_per_account.xml | 13 +- linden/indra/newview/llagent.cpp | 186 +- linden/indra/newview/llagent.h | 4 + linden/indra/newview/llappviewer.cpp | 17 + linden/indra/newview/llchatbar.cpp | 76 +- linden/indra/newview/llfloaterabout.cpp | 10 +- linden/indra/newview/llfloateractivespeakers.cpp | 19 + linden/indra/newview/llfloaterbeacons.cpp | 10 + linden/indra/newview/llfloaterchat.cpp | 59 +- linden/indra/newview/llfloaterinspect.cpp | 24 +- linden/indra/newview/llfloaterland.cpp | 44 + linden/indra/newview/llfloaterland.h | 4 + linden/indra/newview/llfloatermap.cpp | 10 + linden/indra/newview/llfloatermap.h | 4 + linden/indra/newview/llfloateropenobject.cpp | 13 +- linden/indra/newview/llfloaterproperties.cpp | 16 +- linden/indra/newview/llfloaterregioninfo.cpp | 19 + linden/indra/newview/llfloaterregioninfo.h | 3 + linden/indra/newview/llfloaterreporter.cpp | 35 + linden/indra/newview/llfloatersettingsdebug.cpp | 31 + linden/indra/newview/llfloaterwindlight.cpp | 2 + linden/indra/newview/llfloaterworldmap.cpp | 28 +- linden/indra/newview/llglsandbox.cpp | 28 + linden/indra/newview/llhoverview.cpp | 38 +- linden/indra/newview/llhudtext.cpp | 39 + linden/indra/newview/llhudtext.h | 8 + linden/indra/newview/llimpanel.cpp | 36 + linden/indra/newview/llimview.cpp | 13 + linden/indra/newview/llinventorybridge.cpp | 139 +- linden/indra/newview/llinventorymodel.cpp | 25 + linden/indra/newview/llinventoryview.cpp | 19 +- linden/indra/newview/llinventoryview.h | 28 + linden/indra/newview/llmaniptranslate.cpp | 11 +- linden/indra/newview/llnetmap.cpp | 38 +- linden/indra/newview/llnotify.cpp | 11 + linden/indra/newview/lloverlaybar.cpp | 12 +- linden/indra/newview/llpanelavatar.cpp | 20 +- linden/indra/newview/llpanelclassified.cpp | 11 +- linden/indra/newview/llpanelcontents.cpp | 38 + linden/indra/newview/llpaneldisplay.cpp | 14 +- linden/indra/newview/llpanelinventory.cpp | 86 +- linden/indra/newview/llpanelland.cpp | 6 + linden/indra/newview/llpanellogin.cpp | 16 + linden/indra/newview/llpanelobject.cpp | 13 + linden/indra/newview/llpanelpermissions.cpp | 27 +- linden/indra/newview/llpanelpick.cpp | 16 +- linden/indra/newview/llprefsim.cpp | 6 + linden/indra/newview/llpreviewscript.cpp | 20 + linden/indra/newview/llselectmgr.cpp | 12 +- linden/indra/newview/llstartup.cpp | 22 + linden/indra/newview/llstatusbar.cpp | 15 + linden/indra/newview/lltoolbar.cpp | 22 + linden/indra/newview/lltooldraganddrop.cpp | 85 +- linden/indra/newview/lltoolface.cpp | 10 + linden/indra/newview/lltoolgrab.cpp | 24 +- linden/indra/newview/lltoolpie.cpp | 61 +- linden/indra/newview/lltoolplacer.cpp | 20 +- linden/indra/newview/lltoolselect.cpp | 49 + linden/indra/newview/lltracker.cpp | 24 +- linden/indra/newview/llviewercontrol.cpp | 21 + linden/indra/newview/llviewerdisplay.cpp | 12 +- linden/indra/newview/llviewermenu.cpp | 800 +++++- linden/indra/newview/llviewermessage.cpp | 403 +++- linden/indra/newview/llviewerobject.cpp | 17 +- linden/indra/newview/llviewerobjectlist.cpp | 26 +- linden/indra/newview/llviewertexteditor.cpp | 7 + linden/indra/newview/llviewerwindow.cpp | 10 + linden/indra/newview/llvoavatar.cpp | 115 +- linden/indra/newview/llvovolume.cpp | 16 +- linden/indra/newview/llworldmapview.cpp | 19 +- linden/indra/newview/pipeline.cpp | 9 +- linden/indra/newview/primbackup.cpp | 1105 +++++++++ linden/indra/newview/primbackup.h | 132 + linden/indra/newview/rlvevent.h | 224 ++ linden/indra/newview/rlvextensions.cpp | 454 ++++ linden/indra/newview/rlvextensions.h | 43 + linden/indra/newview/rlvfloaterbehaviour.cpp | 152 ++ linden/indra/newview/rlvfloaterbehaviour.h | 49 + linden/indra/newview/rlvhandler.cpp | 2549 ++++++++++++++++++++ linden/indra/newview/rlvhandler.h | 462 ++++ linden/indra/newview/rlvhelper.cpp | 674 ++++++ linden/indra/newview/rlvhelper.h | 579 +++++ linden/indra/newview/rlvmultistringsearch.cpp | 196 ++ linden/indra/newview/rlvmultistringsearch.h | 191 ++ .../default/xui/en-us/floater_prim_import.xml | 5 + .../default/xui/en-us/floater_rlv_behaviour.xml | 11 + .../skins/default/xui/en-us/menu_pie_object.xml | 6 +- .../skins/default/xui/en-us/menu_viewer.xml | 51 + 91 files changed, 10021 insertions(+), 144 deletions(-) create mode 100644 linden/indra/newview/primbackup.cpp create mode 100644 linden/indra/newview/primbackup.h create mode 100644 linden/indra/newview/rlvevent.h create mode 100644 linden/indra/newview/rlvextensions.cpp create mode 100644 linden/indra/newview/rlvextensions.h create mode 100644 linden/indra/newview/rlvfloaterbehaviour.cpp create mode 100644 linden/indra/newview/rlvfloaterbehaviour.h create mode 100644 linden/indra/newview/rlvhandler.cpp create mode 100644 linden/indra/newview/rlvhandler.h create mode 100644 linden/indra/newview/rlvhelper.cpp create mode 100644 linden/indra/newview/rlvhelper.h create mode 100644 linden/indra/newview/rlvmultistringsearch.cpp create mode 100644 linden/indra/newview/rlvmultistringsearch.h create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_prim_import.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_rlv_behaviour.xml (limited to 'linden') diff --git a/linden/indra/llcommon/llchat.h b/linden/indra/llcommon/llchat.h index ec86450..6c75a25 100644 --- a/linden/indra/llcommon/llchat.h +++ b/linden/indra/llcommon/llchat.h @@ -72,6 +72,10 @@ public: : mText(text), mFromName(), mFromID(), +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + mRlvLocFiltered(FALSE), + mRlvNamesFiltered(FALSE), +// [/RLVa:KB] mSourceType(CHAT_SOURCE_AGENT), mChatType(CHAT_TYPE_NORMAL), mAudible(CHAT_AUDIBLE_FULLY), @@ -84,6 +88,10 @@ public: std::string mText; // UTF-8 line of text std::string mFromName; // agent or object name LLUUID mFromID; // agent id or object id +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + BOOL mRlvLocFiltered; + BOOL mRlvNamesFiltered; +// [/RLVa:KB] EChatSourceType mSourceType; EChatType mChatType; EChatAudible mAudible; diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 6f54a41..bb07922 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -435,6 +435,12 @@ set(viewer_SOURCE_FILES llxmlrpctransaction.cpp noise.cpp pipeline.cpp + primbackup.cpp + rlvhandler.cpp + rlvhelper.cpp + rlvmultistringsearch.cpp + rlvextensions.cpp + rlvfloaterbehaviour.cpp ) set(VIEWER_BINARY_NAME "imprudence-bin" CACHE STRING @@ -839,9 +845,16 @@ set(viewer_HEADER_FILES macmain.h noise.h pipeline.h + primbackup.h randgauss.h VertexCache.h VorbisFramework.h + rlvevent.h + rlvhandler.h + rlvhelper.h + rlvmultistringsearch.h + rlvextensions.h + rlvfloaterbehaviour.h ) source_group("CMake Rules" FILES ViewerInstall.cmake) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 149eefa..6d2f0c5 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -1,7 +1,106 @@ - AFKTimeout + RestrainedLife + + Comment + Toggles the RestrainedLife features (BDSM lockable toys support). Needs a restart of the viewer. + Persist + 1 + Type + Boolean + Value + 0 + + RestrainedLifeDebug + + Comment + Toggles the RestrainedLife debug mode (displays the commands when in debug mode). + Persist + 1 + Type + Boolean + Value + 0 + + RestrainedLifeNoSetEnv + + Comment + When TRUE, forbids to set the environment (time of day and Windlight settings) via RestrainedLife. Needs a restart of the viewer. + Persist + 1 + Type + Boolean + Value + 0 + + RestrainedLifeForbidGiveToRLV + + Comment + When FALSE, allows to give sub-folders to the #RLV RestrainedLife folder. + Persist + 1 + Type + Boolean + Value + 1 + + RLVaEnableLegacyNaming + + Comment + Enables legacy naming convention for folders + Persist + 1 + Type + Boolean + Value + 1 + + RLVaEnableWear + + Comment + When TRUE, enables the "Wear" option on the inventory item context menu for attachments. + Persist + 1 + Type + Boolean + Value + 0 + + RLVaHideLockedLayers + + Comment + When TRUE, hides worn but "remove outfit" restricted clothing layers from @getoufit + Persist + 1 + Type + Boolean + Value + 0 + + RLVaHideLockedAttachments + + Comment + When TRUE, hides worn but "no detach" restricted attachments from @getattach + Persist + 1 + Type + Boolean + Value + 0 + + RLVaShowNameTags + + Comment + Display of names above avatars is subject to the general "Show Names" setting when @shownames=n restricted + Persist + 1 + Type + Boolean + Value + 0 + + AFKTimeout Comment Time before automatically setting AFK (away from keyboard) mode (seconds) @@ -3177,6 +3276,22 @@ 0 + FloaterPrimImport + + Comment + Rectangle for import/export + Persist + 1 + Type + Rect + Value + + 0 + 25 + 400 + 0 + + FloaterRegionInfo Comment diff --git a/linden/indra/newview/app_settings/settings_per_account.xml b/linden/indra/newview/app_settings/settings_per_account.xml index 90c7b11..59caac4 100644 --- a/linden/indra/newview/app_settings/settings_per_account.xml +++ b/linden/indra/newview/app_settings/settings_per_account.xml @@ -1,6 +1,17 @@ - BusyModeResponse + RLVaLoginLastLocation + + Comment + Determines whether the next login will be forced to the last logoff location (set by the viewer) + Persist + 1 + Type + Boolean + Value + 1 + + BusyModeResponse Comment Auto response to instant messages while in busy mode. diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 7a70316..d73ddb6 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -758,6 +758,9 @@ void LLAgent::movePitch(S32 direction) // Does this parcel allow you to fly? BOOL LLAgent::canFly() { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) + if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) return FALSE; +// [/RLVa:KB] if (isGodlike()) return TRUE; LLViewerRegion* regionp = getRegion(); @@ -797,6 +800,13 @@ void LLAgent::setFlying(BOOL fly) if (fly) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) + if (gRlvHandler.hasBehaviour(RLV_BHVR_FLY)) + { + return; + } +// [/RLVa:KB] + BOOL was_flying = getFlying(); if (!canFly() && !was_flying) { @@ -4243,6 +4253,13 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani return; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) ) + { + return; + } +// [/RLVa:KB] + setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up gViewerWindow->getWindow()->resetBusyCount(); @@ -5037,6 +5054,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO // utility to build a location string void LLAgent::buildLocationString(std::string& str) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + str = rlv_handler_t::cstrHidden; + return; + } +// [/RLVa:KB] + const LLVector3& agent_pos_region = getPositionAgent(); S32 pos_x = S32(agent_pos_region.mV[VX]); S32 pos_y = S32(agent_pos_region.mV[VY]); @@ -5919,6 +5944,15 @@ void LLAgent::teleportRequest( // Landmark ID = LLUUID::null means teleport home void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) { +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) + if ( (rlv_handler_t::isEnabled()) && + ( (gRlvHandler.hasBehaviour("tplm")) || + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting)) )) + { + return; + } +// [/RLVa:KB] + LLViewerRegion *regionp = getRegion(); if(regionp && teleportCore()) { @@ -5983,6 +6017,17 @@ void LLAgent::teleportCancel() void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { +// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-07 (RLVa-1.0.0d) + // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object + if ( (rlv_handler_t::isEnabled()) && + ( (gRlvHandler.hasBehaviourExcept("tploc", gRlvHandler.getCurrentObject())) || + ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) && + (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) ) + { + return; + } +// [/RLVa:KB] + LLViewerRegion* regionp = getRegion(); LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); if(regionp && info) @@ -6057,6 +6102,13 @@ void LLAgent::setTeleportState(ETeleportState state) // We're outa here. Save "back" slurl. mTeleportSourceSLURL = getSLURL(); } + +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b + if ( (rlv_handler_t::isEnabled()) && (TELEPORT_NONE == mTeleportState) ) + { + gRlvHandler.setCanCancelTp(true); + } +// [/RLVa:KB] } void LLAgent::stopCurrentAnimations() @@ -6684,10 +6736,17 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void } // now that we have the asset ids...request the wearable assets +// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g + LLInventoryFetchObserver::item_ref_t rlvItems; +// [/RLVa:KB] for( i = 0; i < WT_COUNT; i++ ) { if( !gAgent.mWearableEntry[i].mItemID.isNull() ) { +// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g + if (rlv_handler_t::isEnabled()) + rlvItems.push_back(gAgent.mWearableEntry[i].mItemID); +// [/RLVa:KB] gWearableList.getAsset( asset_id_array[i], LLStringUtil::null, @@ -6695,6 +6754,15 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); } } + +// [RLVa:KB] - Checked: 2009-08-08 (RLVa-1.0.1g) | Added: RLVa-1.0.1g + // TODO-RLVa: checking that we're in STATE_STARTED is probably not needed, but leave it until we can be absolutely sure + if ( (rlv_handler_t::isEnabled()) && (LLStartUp::getStartupState() == STATE_STARTED) ) + { + RlvCurrentlyWorn f; + f.fetchItems(rlvItems); + } +// [/RLVa:KB] } } @@ -7192,6 +7260,13 @@ void LLAgent::removeWearable( EWearableType type ) return; } +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isRemovable(type)) ) + { + return; + } +// [/RLVa:KB] + if( old_wearable ) { if( old_wearable->isDirty() ) @@ -7314,15 +7389,17 @@ void LLAgent::setWearableOutfit( wearables_to_remove[WT_SKIN] = FALSE; wearables_to_remove[WT_HAIR] = FALSE; wearables_to_remove[WT_EYES] = FALSE; - wearables_to_remove[WT_SHIRT] = remove; - wearables_to_remove[WT_PANTS] = remove; - wearables_to_remove[WT_SHOES] = remove; - wearables_to_remove[WT_SOCKS] = remove; - wearables_to_remove[WT_JACKET] = remove; - wearables_to_remove[WT_GLOVES] = remove; - wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_SKIRT] = remove; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a + wearables_to_remove[WT_SHIRT] = remove && gRlvHandler.isRemovable(WT_SHIRT); + wearables_to_remove[WT_PANTS] = remove && gRlvHandler.isRemovable(WT_PANTS); + wearables_to_remove[WT_SHOES] = remove && gRlvHandler.isRemovable(WT_SHOES); + wearables_to_remove[WT_SOCKS] = remove && gRlvHandler.isRemovable(WT_SOCKS); + wearables_to_remove[WT_JACKET] = remove && gRlvHandler.isRemovable(WT_JACKET); + wearables_to_remove[WT_GLOVES] = remove && gRlvHandler.isRemovable(WT_GLOVES); + wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERSHIRT); + wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvHandler.isRemovable(WT_UNDERPANTS); + wearables_to_remove[WT_SKIRT] = remove && gRlvHandler.isRemovable(WT_SKIRT); +// [/RLVa:KB] S32 count = wearables.count(); llassert( items.count() == count ); @@ -7414,6 +7491,15 @@ void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable ) EWearableType type = new_wearable->getType(); LLWearable* old_wearable = mWearableEntry[ type ].mWearable; + +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) + // Block if: we can't wear on that layer; or we're already wearing something there we can't take off + if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.isWearable(type)) || ((old_wearable) && (!gRlvHandler.isRemovable(type)))) ) + { + return; + } +// [/RLVa:KB] + if( old_wearable ) { const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; @@ -7622,10 +7708,13 @@ void LLAgent::userRemoveAllAttachments( void* userdata ) return; } - gMessageSystem->newMessage("ObjectDetach"); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.0c + // NOTE-RLVa: This function is called from inside RlvHandler as well, hence the rather heavy modifications + std::list rlvAttachments; + // TODO-RLVa: Once we have the improved "removeWearable" logic implemented we can just get rid of the whole "rlvCompFolders" hassle + #ifdef RLV_EXPERIMENTAL_COMPOSITES + std::list rlvCompFolders; + #endif // RLV_EXPERIMENTAL_COMPOSITES for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) @@ -7635,11 +7724,78 @@ void LLAgent::userRemoveAllAttachments( void* userdata ) LLViewerObject* objectp = attachment->getObject(); if (objectp) { + if (rlv_handler_t::isEnabled()) + { + if (!gRlvHandler.isDetachable(curiter->first)) + continue; + + // Check if we're being called in response to an RLV command (that would be @detach=force) + if ( (gRlvHandler.getCurrentCommand()) && (attachment->getItemID().notNull()) ) + { + if (!gRlvHandler.isStrippable(attachment->getItemID())) // "nostrip" can be taken off by the user but not @detach + continue; + + #ifdef RLV_EXPERIMENTAL_COMPOSITES + LLViewerInventoryCategory* pFolder; + if (gRlvHandler.getCompositeInfo(attachment->getItemID(), NULL, &pFolder)) + { + #ifdef RLV_EXPERIMENTAL_COMPOSITE_LOCKING + if (!gRlvHandler.canTakeOffComposite(pFolder)) + continue; + #endif // RLV_EXPERIMENTAL_COMPOSITE_LOCKING + + // The attachment belongs to a composite folder so there may be additional things we need to take off + if (std::find(rlvCompFolders.begin(), rlvCompFolders.end(), pFolder->getUUID()) != rlvCompFolders.end()) + rlvCompFolders.push_back(pFolder->getUUID()); + } + #endif // RLV_EXPERIMENTAL_COMPOSITES + } + } + rlvAttachments.push_back(objectp->getLocalID()); + } + } + + // Only send the message if we actually have something to detach + if (rlvAttachments.size() > 0) + { + gMessageSystem->newMessage("ObjectDetach"); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + for (std::list::const_iterator itAttach = rlvAttachments.begin(); itAttach != rlvAttachments.end(); ++itAttach) + { gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); + gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, *itAttach); } + + gMessageSystem->sendReliable( gAgent.getRegionHost() ); } - gMessageSystem->sendReliable( gAgent.getRegionHost() ); + + #ifdef RLV_EXPERIMENTAL_COMPOSITES + if (rlv_handler_t::isEnabled) + { + // If we encountered any composite folders then we need to @detach all of them + for (std::list::const_iterator itFolder = rlvCompFolders.begin(); itFolder != rlvCompFolders.end(); ++itFolder) + { + std::string strFolder = gRlvHandler.getSharedPath(*itFolder); + + // It shouldn't happen but make absolutely sure that we don't issue @detach:=force and reenter this function + if (!strFolder.empty()) + { + std::string strCmd = "detach:" + strFolder + "=force"; + #ifdef RLV_DEBUG + RLV_INFOS << "\t- detaching composite folder: @" << strCmd << LL_ENDL; + #endif // RLV_DEBUG + + // HACK-RLV: executing a command while another command is currently executing isn't the best thing to do, however + // in this specific case it is safe (and still better than making processForceCommand public) + gRlvHandler.processCommand(gRlvHandler.getCurrentObject(), strCmd); + } + } + } + #endif // RLV_EXPERIMENTAL_COMPOSITES +// [/RLVa:KB] } void LLAgent::observeFriends() diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 0b8463f..d6854e4 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -67,6 +67,10 @@ #include "llfollowcam.h" // end Ventrella +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) +#include "rlvhandler.h" +// [/RLVa:KB] + const U8 AGENT_STATE_TYPING = 0x04; // Typing indication const U8 AGENT_STATE_EDITING = 0x10; // Set when agent has objects selected diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index 0f1bfb4..ab4d8a9 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -3834,4 +3834,21 @@ void LLAppViewer::handleLoginComplete() gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); } writeDebugInfo(); + +// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e + // TODO-RLVa: find some way to initialize the lookup table when we need them *and* support toggling RLVa at runtime + gRlvHandler.initLookupTables(); + + if (rlv_handler_t::isEnabled()) + { + RlvCurrentlyWorn::fetchWorn(); + rlv_handler_t::fetchSharedInventory(); + + #ifdef RLV_EXTENSION_STARTLOCATION + RlvSettings::updateLoginLastLocation(); + #endif // RLV_EXTENSION_STARTLOCATION + + gRlvHandler.processRetainedCommands(); + } +// [/RLVa:KB] } diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp index 1dffae3..1de3690 100644 --- a/linden/indra/newview/llchatbar.cpp +++ b/linden/indra/newview/llchatbar.cpp @@ -79,7 +79,10 @@ LLChatBar *gChatBar = NULL; // legacy calllback glue void toggleChatHistory(void* user_data); -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); +//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a +void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); +// [/RLVa:KB] class LLChatBarGestureObserver : public LLGestureManagerObserver @@ -516,7 +519,10 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) S32 length = raw_text.length(); - if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences + //if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) + if ( (length > 0) && (raw_text[0] != '/') && (!gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) +// [/RLVa:KB] { gAgent.startTyping(); } @@ -621,6 +627,21 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); } +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b + if ( (0 == channel) && (rlv_handler_t::isEnabled()) ) + { + // Adjust the (public) chat "volume" on chat and gestures (also takes care of playing the proper animation) + if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) ) + type = CHAT_TYPE_WHISPER; + else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) ) + type = CHAT_TYPE_NORMAL; + else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) ) + type = CHAT_TYPE_NORMAL; + + animate &= !gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT); + } +// [/RLVa:KB] + // Don't animate for chats people can't hear (chat to scripts) if (animate && (channel == 0)) { @@ -656,8 +677,57 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL send_chat_from_viewer(utf8_out_text, type, channel); } -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) +// void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a +void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) +// [/RLVa:KB] { +// [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e + // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) + if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) + { + if (0 == channel) + { + // (We already did this before, but LLChatHandler::handle() calls this directly) + if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour("chatnormal")) ) + type = CHAT_TYPE_WHISPER; + else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour("chatshout")) ) + type = CHAT_TYPE_NORMAL; + else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour("chatwhisper")) ) + type = CHAT_TYPE_NORMAL; + + // Redirect chat if needed + if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) && + (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) ) + { + return; + } + + // Filter public chat if sendchat restricted (and filter anything that redirchat didn't redirect) + if ( (gRlvHandler.hasBehaviour("sendchat")) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) + gRlvHandler.filterChat(utf8_out_text, true); + } + else + { + // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) + if ( (gRlvHandler.hasBehaviour("sendchannel")) && (!gRlvHandler.hasBehaviour("sendchannel", llformat("%d", channel))) ) + return; + + // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) + if (channel >= CHAT_CHANNEL_DEBUG) + { + bool fIsEmote = rlvIsEmote(utf8_out_text); + if ( (gRlvHandler.hasBehaviour("sendchat")) || + ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) || + ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) ) + { + return; + } + } + } + } +// [/RLVa:KB] + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); diff --git a/linden/indra/newview/llfloaterabout.cpp b/linden/indra/newview/llfloaterabout.cpp index 0954a70..57c5339 100644 --- a/linden/indra/newview/llfloaterabout.cpp +++ b/linden/indra/newview/llfloaterabout.cpp @@ -126,7 +126,15 @@ LLFloaterAbout::LLFloaterAbout() // Position LLViewerRegion* region = gAgent.getRegion(); - if (region) +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + support.append(rlv_handler_t::cstrHidden); + support.append("\n\n"); + } + else if (region) +// [/RLVa:KB] +// if (region) { LLStyleSP server_link_style(new LLStyle); server_link_style->setVisible(true); diff --git a/linden/indra/newview/llfloateractivespeakers.cpp b/linden/indra/newview/llfloateractivespeakers.cpp index a8f3f91..b4d402a 100644 --- a/linden/indra/newview/llfloateractivespeakers.cpp +++ b/linden/indra/newview/llfloateractivespeakers.cpp @@ -98,6 +98,11 @@ void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const std::string& first, c if (speaker_ptr) { speaker_ptr->mDisplayName = first + " " + last; +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g + // TODO-RLVa: this seems to get called per frame which is very likely an LL bug that will eventuall get fixed + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + speaker_ptr->mDisplayName = gRlvHandler.getAnonym(speaker_ptr->mDisplayName); +// [/RLVa:KB] } } @@ -710,6 +715,13 @@ void LLPanelActiveSpeakers::onVolumeChange(LLUICtrl* source, void* user_data) //static void LLPanelActiveSpeakers::onClickProfile(void* user_data) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return; + } +// [/RLVa:KB] + LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); @@ -719,6 +731,13 @@ void LLPanelActiveSpeakers::onClickProfile(void* user_data) //static void LLPanelActiveSpeakers::onDoubleClickSpeaker(void* user_data) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return; + } +// [/RLVa:KB] + LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); diff --git a/linden/indra/newview/llfloaterbeacons.cpp b/linden/indra/newview/llfloaterbeacons.cpp index d636776..7403df2 100644 --- a/linden/indra/newview/llfloaterbeacons.cpp +++ b/linden/indra/newview/llfloaterbeacons.cpp @@ -37,6 +37,9 @@ #include "llcheckboxctrl.h" #include "pipeline.h" +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) +#include "llagent.h" +// [/RLVa:KB] LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed) { @@ -72,6 +75,13 @@ BOOL LLFloaterBeacons::postBuild() // Too bad we can't just add control_name="BeaconsEnabled" to the XML. void LLFloaterBeacons::open() { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + return; + } +// [/RLVa:KB] + LLFloater::open(); gSavedSettings.setBOOL( "BeaconsEnabled", TRUE); } diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index d0713bc..1f51a21 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp @@ -202,7 +202,10 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& // If the msg is from an agent (not yourself though), // extract out the sender name and replace it with the hotlinked name. if (chat.mSourceType == CHAT_SOURCE_AGENT && - chat.mFromID != LLUUID::null) + chat.mFromID != LLUUID::null && +// [RLVa] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [/RLVa] { chat.mURL = llformat("secondlife:///app/agent/%s/about",chat.mFromID.asString().c_str()); } @@ -261,6 +264,30 @@ void LLFloaterChat::toggleHistoryChannelControl() // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (rlv_handler_t::isEnabled()) + { + // TODO-RLVa: we might cast too broad a net by filtering here, needs testing + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != chat.mSourceType) ) + { + LLChat& rlvChat = const_cast(chat); + gRlvHandler.filterLocation(rlvChat.mText); + rlvChat.mRlvLocFiltered = TRUE; + } + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!chat.mRlvNamesFiltered) ) + { + // NOTE: this will also filter inventory accepted/declined text in the chat history + LLChat& rlvChat = const_cast(chat); + if (CHAT_SOURCE_AGENT != chat.mSourceType) + { + // Filter object and system chat (names are filtered elsewhere to save ourselves an gObjectList lookup) + gRlvHandler.filterNames(rlvChat.mText); + } + rlvChat.mRlvNamesFiltered = TRUE; + } + } +// [/RLVa:KB] + if ( gSavedPerAccountSettings.getBOOL("LogChat") && log_to_file) { log_chat_text(chat); @@ -391,6 +418,30 @@ void LLFloaterChat::addChat(const LLChat& chat, chat.mChatType == CHAT_TYPE_DEBUG_MSG && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (rlv_handler_t::isEnabled()) + { + // TODO-RLVa: we might cast too broad a net by filtering here, needs testing + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (!chat.mRlvLocFiltered) && (CHAT_SOURCE_AGENT != chat.mSourceType) ) + { + LLChat& rlvChat = const_cast(chat); + if (!from_instant_message) + gRlvHandler.filterLocation(rlvChat.mText); + rlvChat.mRlvLocFiltered = TRUE; + } + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!chat.mRlvNamesFiltered) ) + { + LLChat& rlvChat = const_cast(chat); + if ( (!from_instant_message) && (CHAT_SOURCE_AGENT != chat.mSourceType) ) + { + // Filter object and system chat (names are filtered elsewhere to save ourselves an gObjectList lookup) + gRlvHandler.filterNames(rlvChat.mText); + } + rlvChat.mRlvNamesFiltered = TRUE; + } + } +// [/RLVa:KB] + #if LL_LCD_COMPILE // add into LCD displays if (!invisible_script_debug_chat) @@ -548,7 +599,11 @@ void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) { LLFloaterChat* self = (LLFloaterChat*)userdata; - self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + self->childSetVisible("active_speakers_panel", + (!self->childIsVisible("active_speakers_panel")) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ); +// [/RLVa:KB] + //self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); } //static diff --git a/linden/indra/newview/llfloaterinspect.cpp b/linden/indra/newview/llfloaterinspect.cpp index e1d3c4a..2367b48 100644 --- a/linden/indra/newview/llfloaterinspect.cpp +++ b/linden/indra/newview/llfloaterinspect.cpp @@ -42,6 +42,10 @@ #include "llviewerobject.h" #include "lluictrlfactory.h" +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) +#include "rlvhandler.h" +// [/RLVa:KB] + LLFloaterInspect* LLFloaterInspect::sInstance = NULL; LLFloaterInspect::LLFloaterInspect(void) : @@ -145,7 +149,13 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) if(node) { const LLUUID& owner_id = node->mPermissions->getOwner(); - LLFloaterAvatarInfo::showFromDirectory(owner_id); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + LLFloaterAvatarInfo::showFromDirectory(owner_id); + } +// [/RLVa:KB] +// LLFloaterAvatarInfo::showFromDirectory(owner_id); } } } @@ -163,7 +173,10 @@ void LLFloaterInspect::onSelectObject(LLUICtrl* ctrl, void* user_data) { if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) { - sInstance->childSetEnabled("button owner", true); + //sInstance->childSetEnabled("button owner", true); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e + sInstance->childSetEnabled("button owner", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] sInstance->childSetEnabled("button creator", true); } } @@ -223,6 +236,13 @@ void LLFloaterInspect::refresh() LLStringUtil::copy(time, ctime(×tamp), MAX_STRING); time[24] = '\0'; gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + // TODO-RLVa: shouldn't filter if this is a group-owned prim (will show "(nobody)") + owner_name = gRlvHandler.getAnonym(owner_name); + } +// [/RLVa:KB] gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; diff --git a/linden/indra/newview/llfloaterland.cpp b/linden/indra/newview/llfloaterland.cpp index 9707184..75c5782 100644 --- a/linden/indra/newview/llfloaterland.cpp +++ b/linden/indra/newview/llfloaterland.cpp @@ -813,6 +813,12 @@ void LLPanelLandGeneral::setGroup(const LLUUID& group_id) // static void LLPanelLandGeneral::onClickBuyLand(void* data) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + { + return; + } +// [/RLVa:KB] BOOL* for_group = (BOOL*)data; LLViewerParcelMgr::getInstance()->startBuyLand(*for_group); } @@ -2779,3 +2785,41 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) if (editor) editor->setText(name); } } + +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) +void LLFloaterLand::open() +{ + // We'll allow "About Land" as long as you have the ability to return prims (through ownership or through group powers) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + LLParcelSelection* pParcelSel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); + if ( (!pParcelSel) || (pParcelSel->hasOthersSelected()) ) + return; + LLParcel* pParcel = pParcelSel->getParcel(); + if (!pParcel) + return; + + // Ideally we could just use LLViewerParcelMgr::isParcelOwnedByAgent(), but that has that sneaky exemption + // for fake god like (aka View Admin Options) + const LLUUID& idOwner = pParcel->getOwnerID(); + if ( (idOwner != gAgent.getID()) ) + { + // *sighs* LLAgent::hasPowerInGroup() has it too so copy/paste from there + S32 count = gAgent.mGroups.count(); bool fShow = false; + for (S32 i = 0; i < count; ++i) + { + if (gAgent.mGroups.get(i).mID == idOwner) + { + fShow |= ((gAgent.mGroups.get(i).mPowers & GP_LAND_RETURN) > 0); + break; + } + } + + if (!fShow) + return; + } + } + + LLFloater::open(); +} +// [/RLVa:KB] diff --git a/linden/indra/newview/llfloaterland.h b/linden/indra/newview/llfloaterland.h index 5f2b970..6e26b93 100644 --- a/linden/indra/newview/llfloaterland.h +++ b/linden/indra/newview/llfloaterland.h @@ -82,6 +82,10 @@ public: virtual void onOpen(); virtual BOOL postBuild(); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + virtual void open(); +// [/RLVa:KB] + protected: // Does its own instance management, so clients not allowed diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 6115404..8714d4f 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -122,3 +122,13 @@ void LLFloaterMap::draw() } } + +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-05 (RLVa-1.0.0c) +void LLFloaterMap::open() +{ + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP)) + { + LLFloater::open(); + } +} +// [/RLVa:KB] diff --git a/linden/indra/newview/llfloatermap.h b/linden/indra/newview/llfloatermap.h index dd1cba8..857b1ed 100644 --- a/linden/indra/newview/llfloatermap.h +++ b/linden/indra/newview/llfloatermap.h @@ -52,6 +52,10 @@ public: /*virtual*/ void onOpen(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL canClose(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-05 (RLVa-1.0.0c) + /*virtual*/ void open(); +// [/RLVa:KB] + private: LLFloaterMap(const LLSD& key = LLSD()); diff --git a/linden/indra/newview/llfloateropenobject.cpp b/linden/indra/newview/llfloateropenobject.cpp index a83b0c9..fd4f9c6 100644 --- a/linden/indra/newview/llfloateropenobject.cpp +++ b/linden/indra/newview/llfloateropenobject.cpp @@ -207,7 +207,18 @@ void LLFloaterOpenObject::onClickMoveToInventory(void* data) void LLFloaterOpenObject::onClickMoveAndWear(void* data) { LLFloaterOpenObject* self = (LLFloaterOpenObject*)data; - self->moveToInventory(true); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Deprecated: RLVa-0.2.2a + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + // TODO-RLVa: once we have "Add to Outfit" and "Replace Outfit" working we don't need this anymore + self->moveToInventory(false); + } + else + { + self->moveToInventory(true); + } +// [/RLVa:KB] +// self->moveToInventory(true); self->close(); } diff --git a/linden/indra/newview/llfloaterproperties.cpp b/linden/indra/newview/llfloaterproperties.cpp index eddd56a..0af8ec3 100644 --- a/linden/indra/newview/llfloaterproperties.cpp +++ b/linden/indra/newview/llfloaterproperties.cpp @@ -354,8 +354,17 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) else { gCacheName->getFullName(perm.getOwner(), name); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + name = gRlvHandler.getAnonym(name); + } +// [/RLVa:KB] } - childSetEnabled("BtnOwner",TRUE); + //childSetEnabled("BtnOwner",TRUE); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e + childSetEnabled("BtnOwner", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] childSetEnabled("LabelOwnerTitle",TRUE); childSetEnabled("LabelOwnerName",TRUE); childSetText("LabelOwnerName",name); @@ -602,7 +611,10 @@ void LLFloaterProperties::onClickOwner(void* data) } else { - if(!item->getPermissions().getOwner().isNull()) +// if(!item->getPermissions().getOwner().isNull()) +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (!item->getPermissions().getOwner().isNull()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) +// [/RLVa:KB] { LLFloaterAvatarInfo::showFromObject(item->getPermissions().getOwner()); } diff --git a/linden/indra/newview/llfloaterregioninfo.cpp b/linden/indra/newview/llfloaterregioninfo.cpp index 6e0dba1..40907eb 100644 --- a/linden/indra/newview/llfloaterregioninfo.cpp +++ b/linden/indra/newview/llfloaterregioninfo.cpp @@ -3192,3 +3192,22 @@ bool LLDispatchSetEstateAccess::operator()( return true; } + +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) +void LLFloaterRegionInfo::open() +{ + // We'll allow access to the estate tools for estate managers (and for the sim owner) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + LLViewerRegion* pRegion = gAgent.getRegion(); + if (!pRegion) + return; + + // Should be able to call LLRegion::canManageEstate() but then we can fake god like + if ( (!pRegion->isEstateManager()) && (pRegion->getOwner() != gAgent.getID()) ) + return; + } + + LLFloater::open(); +} +// [/RLVa:KB] diff --git a/linden/indra/newview/llfloaterregioninfo.h b/linden/indra/newview/llfloaterregioninfo.h index 41a94ce..7b675de 100644 --- a/linden/indra/newview/llfloaterregioninfo.h +++ b/linden/indra/newview/llfloaterregioninfo.h @@ -66,6 +66,9 @@ public: /*virtual*/ void onOpen(); /*virtual*/ BOOL postBuild(); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + /*virtual*/ void open(); +// [/RLVa:KB] static void processEstateOwnerRequest(LLMessageSystem* msg, void**); diff --git a/linden/indra/newview/llfloaterreporter.cpp b/linden/indra/newview/llfloaterreporter.cpp index d2fcf01..0d3b101 100644 --- a/linden/indra/newview/llfloaterreporter.cpp +++ b/linden/indra/newview/llfloaterreporter.cpp @@ -132,6 +132,23 @@ LLFloaterReporter::LLFloaterReporter( childSetText("abuse_location_edit", gAgent.getSLURL() ); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0a + if (rlv_handler_t::isEnabled()) + { + // Can't filter these since they get sent as part of the report so just hide them instead + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + childSetVisible("abuse_location_edit", false); + childSetVisible("pos_field", false); + } + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + childSetVisible("owner_name", false); + childSetVisible("abuser_name_edit", false); + } + } +// [/RLVa:KB] + LLButton* pick_btn = getChild("pick_btn"); if (pick_btn) { @@ -299,6 +316,12 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) if (regionp) { childSetText("sim_field", regionp->getName()); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + { + childSetText("sim_field", rlv_handler_t::cstrHiddenRegion); + } +// [/RLVa:KB] LLVector3d global_pos; global_pos.setVec(objectp->getPositionRegion()); setPosBox(global_pos); @@ -322,6 +345,12 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) object_owner.append("Unknown"); } childSetText("object_name", object_owner); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RVLa-1.0.0e + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + childSetVisible("object_name", false); // Hide the object name if the picked object represents an avataz + } +// [/RLVa:KB] childSetText("owner_name", object_owner); childSetText("abuser_name_edit", object_owner); mAbuserID = object_id; @@ -594,6 +623,12 @@ LLFloaterReporter* LLFloaterReporter::createNewBugReporter() void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id) { childSetText("object_name", object_name); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RVLa-1.0.0e + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + childSetVisible("object_name", true); // Show the object name if the picked object is actually an object + } +// [/RLVa:KB] childSetText("owner_name", owner_name); childSetText("abuser_name_edit", owner_name); mAbuserID = owner_id; diff --git a/linden/indra/newview/llfloatersettingsdebug.cpp b/linden/indra/newview/llfloatersettingsdebug.cpp index e440c4a..58f37c5 100644 --- a/linden/indra/newview/llfloatersettingsdebug.cpp +++ b/linden/indra/newview/llfloatersettingsdebug.cpp @@ -39,6 +39,11 @@ #include "llcolorswatch.h" #include "llviewercontrol.h" +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0g) +#include "rlvhandler.h" +#include "rlvextensions.h" +// [/RLVa:KB] + LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL; LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) @@ -239,6 +244,32 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) if (controlp) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d + if (rlv_handler_t::isEnabled()) + { + // Don't allow changing DBG_WRITE debug settings under @setdebug=n + bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) && + (RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) ); + // Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n + fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) && + (("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName()))); + #ifdef RLV_EXTENSION_STARTLOCATION + // Don't allow toggling RestrainedLifeLoginLastLocation + fEnable &= !(RLV_SETTING_LOGINLASTLOCATION == controlp->getName()); + #endif // RLV_EXTENSION_STARTLOCATION + + // NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault() + spinner1->setEnabled(fEnable); + spinner2->setEnabled(fEnable); + spinner3->setEnabled(fEnable); + spinner4->setEnabled(fEnable); + color_swatch->setEnabled(fEnable); + childSetEnabled("val_text", fEnable); + childSetEnabled("boolean_combo", fEnable); + childSetEnabled("default_btn", fEnable); + } +// [/RLVa:KB] + eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 914513b..9936f3b 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp @@ -322,12 +322,14 @@ void LLFloaterWindLight::syncMenu() LLWLParamSet& currentParams = param_mgr->mCurParams; //std::map & currentParams = param_mgr->mCurParams.mParamValues; +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) // Fixes LL "bug" (preset name isn't kept synchronized) LLComboBox* comboBox = getChild("WLPresetsCombo"); if (comboBox->getSelectedItemLabel() != currentParams.mName) { comboBox->setSimple(currentParams.mName); } +// [/RLVa:KB] // blue horizon param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp index bc61d8a..a31dde5 100644 --- a/linden/indra/newview/llfloaterworldmap.cpp +++ b/linden/indra/newview/llfloaterworldmap.cpp @@ -280,6 +280,13 @@ void LLFloaterWorldMap::onClose(bool app_quitting) // static void LLFloaterWorldMap::show(void*, BOOL center_on_target) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP)) + { + return; + } +// [/RLVa:KB] + BOOL was_visible = gFloaterWorldMap->getVisible(); gFloaterWorldMap->mIsClosing = FALSE; @@ -641,7 +648,10 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); std::string full_name = llformat("%s (%d, %d, %d)", - sim_name.c_str(), +// sim_name.c_str(), +// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-04 (RLVa-1.0.0a) + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? sim_name.c_str() : rlv_handler_t::cstrHiddenRegion.c_str(), +// [/RLVa:KB] llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); @@ -695,6 +705,14 @@ void LLFloaterWorldMap::updateLocation() // Set the current SLURL mSLURL = LLURLDispatcher::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z); + +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + childSetValue("location", rlv_handler_t::cstrHiddenRegion); + mSLURL.clear(); + } +// [/RLVa:KB] } } @@ -737,6 +755,14 @@ void LLFloaterWorldMap::updateLocation() { // Empty SLURL will disable the "Copy SLURL to clipboard" button mSLURL = ""; } + +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + childSetValue("location", rlv_handler_t::cstrHiddenRegion); + mSLURL.clear(); + } +// [/RLVa:KB] } } diff --git a/linden/indra/newview/llglsandbox.cpp b/linden/indra/newview/llglsandbox.cpp index 2b51948..296cdaa 100644 --- a/linden/indra/newview/llglsandbox.cpp +++ b/linden/indra/newview/llglsandbox.cpp @@ -166,6 +166,13 @@ extern BOOL gDebugSelect; // Returns true if you got at least one object void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + return; + } +// [/RLVa:KB] + LLVector3 av_pos = gAgent.getPositionAgent(); F32 select_dist_squared = gSavedSettings.getF32("MaxSelectDistance"); select_dist_squared = select_dist_squared * select_dist_squared; @@ -230,6 +237,27 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) LLViewerCamera::getInstance()->setFar(new_far); LLViewerCamera::getInstance()->setNear(new_near); } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) + { + // We'll allow drag selection under fartouch, but only within the fartouch range + // (just copy/paste the code above us to make that work, thank you Lindens!) + LLVector3 relative_av_pos = av_pos; + relative_av_pos -= LLViewerCamera::getInstance()->getOrigin(); + + F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + 1.5f; + F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - 1.5f; + + new_near = llmax(new_near, 0.1f); + + LLViewerCamera::getInstance()->setFar(new_far); + LLViewerCamera::getInstance()->setNear(new_near); + + // Usurp these two + limit_select_distance = TRUE; + select_dist_squared = 1.5f * 1.5f; + } +// [/RLVa:KB] LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, center_x-width/2, center_y-height/2, width, height, limit_select_distance); diff --git a/linden/indra/newview/llhoverview.cpp b/linden/indra/newview/llhoverview.cpp index 8d033b2..e40ae10 100644 --- a/linden/indra/newview/llhoverview.cpp +++ b/linden/indra/newview/llhoverview.cpp @@ -244,14 +244,25 @@ void LLHoverView::updateText() LLNameValue* lastname = hit_object->getNVPair("LastName"); if (firstname && lastname) { - if (title) +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - line.append(title->getString()); + line = gRlvHandler.getAnonym(line.append(firstname->getString()).append(1, ' ').append(lastname->getString())); + } + else + { +// [/RLVa:KB] + if (title) + { + line.append(title->getString()); + line.append(1, ' '); + } + line.append(firstname->getString()); line.append(1, ' '); + line.append(lastname->getString()); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) } - line.append(firstname->getString()); - line.append(1, ' '); - line.append(lastname->getString()); +// [/RLVa:KB] } else { @@ -307,6 +318,13 @@ void LLHoverView::updateText() } else if(gCacheName->getFullName(owner, name)) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + name = gRlvHandler.getAnonym(name); + } +// [/RLVa:KB] + line.append(name); } else @@ -468,7 +486,10 @@ void LLHoverView::updateText() line.append(LLTrans::getString("TooltipLand")); if (hover_parcel) { - line.append(hover_parcel->getName()); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-0.2.0b + line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? hover_parcel->getName() : rlv_handler_t::cstrHiddenParcel ); +// [/RLVa:KB] + //line.append(hover_parcel->getName()); } mText.push_back(line); @@ -497,7 +518,10 @@ void LLHoverView::updateText() } else if(gCacheName->getFullName(owner, name)) { - line.append(name); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b + line.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? name : gRlvHandler.getAnonym(name)); +// [/RLVa:KB] + //line.append(name); } else { diff --git a/linden/indra/newview/llhudtext.cpp b/linden/indra/newview/llhudtext.cpp index 32323dc..ac48c6b 100644 --- a/linden/indra/newview/llhudtext.cpp +++ b/linden/indra/newview/llhudtext.cpp @@ -565,6 +565,30 @@ void LLHUDText::renderText(BOOL for_select) void LLHUDText::setStringUTF8(const std::string &wtext) { +// [RLVa:KB] - Checked: 2009-07-09 (RLVa-1.0.0f) + // NOTE: setString() is only called for debug beacons and the floating name tags (which we don't want to censor + // because you'd see "(Region hidden) LastName" if you happen to go to a sim who's name is your first name :p + if (rlv_handler_t::isEnabled()) + { + std::string text(wtext); + + if (gRlvHandler.canShowHoverText(mSourceObject)) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + gRlvHandler.filterLocation(text); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + gRlvHandler.filterNames(text); + } + else + { + text = ""; + } + + setString(utf8str_to_wstring(text)); + return; + } +// [/RLVa:KB] + setString(utf8str_to_wstring(wtext)); } @@ -1147,3 +1171,18 @@ F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font) return width; } } + +// [RLVa:KB] - Checked: 2009-07-09 (RLVa-1.0.0f) | Added: RLVa-1.0.0f +void LLHUDText::refreshAllObjectText() +{ + for (TextObjectIterator itText = sTextObjects.begin(); itText != sTextObjects.end(); itText++) + { + LLHUDText* pText = *itText; + if ( (pText) && (!pText->mObjText.empty() && ("" != pText->mObjText) ) && + (pText->mSourceObject) && (LL_PCODE_VOLUME == pText->mSourceObject->getPCode()) ) + { + pText->setStringUTF8(pText->mObjText); + } + } +} +// [/RLVa:KB] diff --git a/linden/indra/newview/llhudtext.h b/linden/indra/newview/llhudtext.h index 6e29d9d..c68a975 100644 --- a/linden/indra/newview/llhudtext.h +++ b/linden/indra/newview/llhudtext.h @@ -130,6 +130,11 @@ public: static void addPickable(std::set &pick_list); static void reshape(); static void setDisplayText(BOOL flag) { sDisplayText = flag ; } +// [RLVa:KB] - Checked: 2009-07-09 (RLVa-1.0.0f) | Added: RLVa-1.0.0f + const std::string& getObjectText() const { return mObjText; } + void setObjectText(const std::string &utf8string) { mObjText = utf8string; } + static void refreshAllObjectText(); +// [/RLVa:KB] protected: LLHUDText(const U8 type); @@ -175,6 +180,9 @@ private: EVertAlignment mVertAlignment; S32 mLOD; BOOL mHidden; +// [RLVa:KB] - Checked: 2009-07-09 (RLVa-1.0.0f) | Added: RLVa-1.0.0f + std::string mObjText; +// [/RLVa:KB] static BOOL sDisplayText ; static std::set > sTextObjects; diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index 16b0388..014c050 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp @@ -2009,6 +2009,42 @@ void LLFloaterIMPanel::sendMsg() std::string utf8_text = wstring_to_utf8str(text); utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-1.0.0g + if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) + { + if (IM_NOTHING_SPECIAL == mDialog) // One-on-one IM: allow if recipient is a sendim exception + { + if (!gRlvHandler.isException(RLV_BHVR_SENDIM, mOtherParticipantUUID)) + utf8_text = rlv_handler_t::cstrBlockedSendIM; + } + else if (gAgent.isInGroup(mSessionUUID)) // Group chat: allow if recipient is a sendim exception + { + if (!gRlvHandler.isException(RLV_BHVR_SENDIM, mSessionUUID)) + utf8_text = rlv_handler_t::cstrBlockedSendIM; + } + else if (mSpeakers) // Conference chat: allow if all participants are sendim exceptions + { + LLSpeakerMgr::speaker_list_t speakers; + mSpeakers->getSpeakerList(&speakers, TRUE); + + for (LLSpeakerMgr::speaker_list_t::const_iterator itSpeaker = speakers.begin(); + itSpeaker != speakers.end(); ++itSpeaker) + { + LLSpeaker* pSpeaker = *itSpeaker; + if ( (gAgent.getID() != pSpeaker->mID) && (!gRlvHandler.isException(RLV_BHVR_SENDIM, pSpeaker->mID)) ) + { + utf8_text = rlv_handler_t::cstrBlockedSendIM; + break; + } + } + } + else // Catch all fall-through + { + utf8_text = rlv_handler_t::cstrBlockedSendIM; + } + } +// [/RLVa:KB] + if ( mSessionInitialized ) { deliver_message(utf8_text, diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp index 1072b21..20de43e 100644 --- a/linden/indra/newview/llimview.cpp +++ b/linden/indra/newview/llimview.cpp @@ -1550,6 +1550,19 @@ public: { return; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // TODO-RLVa: duplicate from process_improved_im()? + if (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) + { + if (gAgent.isInGroup(session_id)) + { + if (!gRlvHandler.isException(RLV_BHVR_RECVIM, session_id)) + return; + } + else if (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) + message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM; + } +// [/RLVa:KB] // standard message, not from system std::string saved; diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index 3505bd3..19a5ade 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp @@ -1923,6 +1923,12 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // Fixes LL bug + mItems.clear(); + mDisabledItems.clear(); +// [/RLVa:KB] + if (lost_and_found_id == mUUID) { // This is the lost+found folder. @@ -2936,6 +2942,13 @@ void open_notecard(LLViewerInventoryItem* inv_item, const LLUUID& source_id, BOOL take_focus) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour("viewnote")) ) + { + return; + } +// [/RLVa:KB] + // See if we can bring an existing preview to the front if(!LLPreview::show(inv_item->getUUID(), take_focus)) { @@ -3261,7 +3274,14 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model item = (LLViewerInventoryItem*)gInventory.getItem(object_id); if(item && gInventory.isObjectDescendentOf(object_id, gAgent.getInventoryRootID())) { - rez_attachment(item, NULL); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // User picked "Wear" so either nothing is locked, or we need to look up the specific attach point from its name + // (NOTE: rez_attachment will take care of deciding whether or not we *can* attach) + rez_attachment(item, + ((!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedAttachment()) || (RlvSettings::getEnableWear())) + ? NULL : gRlvHandler.getAttachPoint(item, true)); +// [/RLVa:KB] +// rez_attachment(item, NULL); } else if(item && item->isComplete()) { @@ -3280,6 +3300,15 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model else if ("detach" == action) { LLInventoryItem* item = gInventory.getItem(mUUID); + +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // Fall-through: if there's a "Detach from yourself" code path we missed then we'll still disallow the detach here + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(item)) ) + { + return; + } +// [/RLVa:KB] + if( item ) { gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); @@ -3369,11 +3398,24 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach rez_action->mAttachPt = attach_pt; if (attachment && attachment->getObject()) { - gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.isDetachable(attach_pt)) ) + gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action); + else + delete rez_action; +// [/RLVa] +// gViewerWindow->alertXml("ReplaceAttachment", confirm_replace_attachment_rez, (void*)rez_action); } else { - confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) + // Don't allow wear to default attach point if there are any locked attachments + if ( (!rlv_handler_t::isEnabled()) || (0 != attach_pt) || (!gRlvHandler.hasLockedAttachment()) || (RlvSettings::getEnableWear()) ) + confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action); + else + delete rez_action; +// [/RLVa] +// confirm_replace_attachment_rez(0/*YES*/, (void*)rez_action); } } @@ -3442,6 +3484,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) if( avatarp->isWearingAttachment( mUUID ) ) { items.push_back(std::string("Detach From Yourself")); + +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(item)) ) + disabled_items.push_back(std::string("Detach From Yourself")); +// [/RLVa:KB] } else if( !isInTrash() ) @@ -3453,6 +3500,16 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("RestoreToWorld Separator")); items.push_back(std::string("Restore to Last Position")); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0c + // Only enable "Wear" if there is an attach point name *and* there isn't a worn attachment there that's currently locked + if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getEnableWear()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(item, true); + if ( (!pAttachPt) || (!gRlvHandler.isDetachable(pAttachPt->getObject())) ) + disabled_items.push_back(std::string("Object Wear")); + } +// [/RLVa:KB] + LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); LLVOAvatar *avatarp = gAgent.getAvatarObject(); @@ -3468,15 +3525,27 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLMenuItemCallGL *new_item; if (attachment->getIsHUDAttachment()) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) attach_hud_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), NULL, //&LLObjectBridge::attachToAvatar, - NULL, &attach_label, (void*)attachment)); + (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, + &attach_label, (void*)attachment)); +// [/RLVa:KB] + //attach_hud_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), + // NULL, //&LLObjectBridge::attachToAvatar, + // NULL, &attach_label, (void*)attachment)); } else { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) attach_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), NULL, //&LLObjectBridge::attachToAvatar, - NULL, &attach_label, (void*)attachment)); + (rlv_handler_t::isEnabled()) ? &rlvAttachToEnabler : NULL, + &attach_label, (void*)attachment)); +// [/RLVa:KB] + //attach_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), + // NULL, //&LLObjectBridge::attachToAvatar, + // NULL, &attach_label, (void*)attachment)); } LLSimpleListener* callback = mInventoryPanel->getListenerByName("Inventory.AttachObject"); @@ -3981,6 +4050,20 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) is_gesture); S32 gest_count = gest_item_array.count(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-1.0.0c + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) && (!RlvSettings::getEnableWear()) ) + { + // Filter anything that doesn't specify an attachment point (or that specifies one that's currently locked) + for (S32 idxObj = obj_item_array.count() - 1; idxObj >= 0; idxObj--) + { + LLViewerJointAttachment* pAttachPt = gRlvHandler.getAttachPoint(obj_item_array.get(idxObj).get(), true); + if ( ((!pAttachPt) || (!gRlvHandler.isDetachable(pAttachPt->getObject()))) ) + obj_item_array.remove(idxObj); + } + obj_count = obj_item_array.count(); + } +// [/RLVa:KB] + if( !wearable_count && !obj_count && !gest_count) { gViewerWindow->alertXml("CouldNotPutOnOutfit"); @@ -4118,6 +4201,13 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B // item->setAssetUUID(wearable->getID()); // item->updateAssetOnServer(); // } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-1.0.0c + if ( (!gRlvHandler.isWearable(wearable->getType())) || + ( (!gRlvHandler.isRemovable(wearable->getType())) && (gAgent.getWearable(wearable->getType())) ) ) + { + continue; + } +// [/RLVa:KB] items.put(item); wearables.put(wearable); } @@ -4210,14 +4300,24 @@ void wear_attachments_on_avatar(const LLInventoryModel::item_array_t& items, BOO msg->nextBlockFast(_PREHASH_HeaderData); msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); msg->addU8Fast(_PREHASH_TotalObjects, count ); - msg->addBOOLFast(_PREHASH_FirstDetachAll, remove ); - } +// msg->addBOOLFast(_PREHASH_FirstDetachAll, remove ); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a + // This really should just *always* be FALSE since TRUE can result in loss of the current asset state + msg->addBOOLFast(_PREHASH_FirstDetachAll, remove && (!gRlvHandler.hasLockedAttachment()) ); +// [/RLVa:KB] + } LLInventoryItem* item = items.get(i); msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getUUID() ); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); - msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point +// msg->addU8Fast(_PREHASH_AttachmentPt, 0 ); // Wear at the previous or default attachment point +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-0.2.2a + msg->addU8Fast(_PREHASH_AttachmentPt, + ( (!rlv_handler_t::isEnabled()) || (RlvSettings::getEnableWear()) || (!gRlvHandler.hasLockedAttachment()) ) + ? 0 + : gRlvHandler.getAttachPointIndex(gRlvHandler.getAttachPoint(item, true))); +// [/RLVa:KB] pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); msg->addStringFast(_PREHASH_Name, item->getName()); msg->addStringFast(_PREHASH_Description, item->getDescription()); @@ -4299,7 +4399,11 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) { for(i = 0; i < wearable_count; ++i) { - if( gAgent.isWearingItem (item_array.get(i)->getUUID()) ) +// if( gAgent.isWearingItem (item_array.get(i)->getUUID()) ) +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a + LLWearable* pWearable = gAgent.getWearableFromWearableItem(item_array.get(i)->getUUID()); + if ( (pWearable) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.isRemovable(pWearable->getType()))) ) +// [/RLVa:KB] { gWearableList.getAsset(item_array.get(i)->getAssetUUID(), item_array.get(i)->getName(), @@ -4316,6 +4420,18 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) { for(i = 0; i < obj_count; ++i) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.2a + // TODO-RLVa: is there a reason why LL doesn't bother checking to see if you're actually wearing the object? + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (!pAvatar) || (!pAvatar->isWearingAttachment(obj_item_array.get(i)->getUUID())) || + (!gRlvHandler.isDetachable(obj_item_array.get(i).get())) ) // Why does LLPointer have a cast to BOOL aka S32??? + { + continue; + } + } +// [/RVLa:KB] gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); gMessageSystem->nextBlockFast(_PREHASH_ObjectData ); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); @@ -4708,8 +4824,11 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, { EWearableType type = wearable->getType(); - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR ) ) //&& + //if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR ) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.2a | SL big fix + if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) +// [/RLVa:KB] { gAgent.removeWearable( type ); } diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 1029a3c..e662058 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -2876,6 +2876,14 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, llinfos << "LLInventoryModel::processSaveAssetIntoInventory item" " not found: " << item_id << llendl; } + +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0e + if (rlv_handler_t::isEnabled()) + { + gRlvHandler.onSavedAssetIntoInventory(item_id); + } +// [/RLVa:KB] + if(gViewerWindow) { gViewerWindow->getWindow()->decBusyCount(); @@ -2918,6 +2926,23 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) // << llendl; if(tfolder->getUUID().notNull()) { +// [RLVa:KB] - Checked: 2009-08-07 (RLVa-1.0.1f) | Added: RLVa-1.0.0f + // TODO-RLVa: this really shouldn't go here, but if the inventory offer spans multiple BulkUpdateInventory messages + // then the second message will cause the viewer to show the folder under its original name even though + // it is renamed properly on the inventory server + if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getForbidGiveToRLV()) ) + { + LLViewerInventoryCategory* pRlvRoot = gRlvHandler.getSharedRoot(); + std::string strName = tfolder->getName(); + if ((pRlvRoot) && (pRlvRoot->getUUID() == tfolder->getParentUUID() ) && (strName.find(RLV_PUTINV_PREFIX) == 0)) + { + strName.erase(0, strName.find(RLV_FOLDER_PREFIX_PUTINV)); // Strips the prefix while retaining while the '~' + tfolder->rename(strName); + tfolder->updateServer(FALSE); + } + } +// [/RLVa:KB] + folders.push_back(tfolder); LLViewerInventoryCategory* folderp = gInventory.getCategory(tfolder->getUUID()); if(folderp) diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index cc89ee1..a8d5045 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -774,7 +774,17 @@ void LLInventoryView::setVisible( BOOL visible ) // Destroy all but the last floater, which is made invisible. void LLInventoryView::onClose(bool app_quitting) { - S32 count = sActiveViews.count(); +// S32 count = sActiveViews.count(); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // See LLInventoryView::closeAll() on why we're doing it this way + S32 count = 0; + for (S32 idx = 0, cnt = sActiveViews.count(); idx < cnt; idx++) + { + if (!sActiveViews.get(idx)->isDead()) + count++; + } +// [/RLVa:KB] + if (count > 1) { destroy(); @@ -852,6 +862,13 @@ LLInventoryView* LLInventoryView::showAgentInventory(BOOL take_keyboard_focus) return NULL; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV)) + { + return NULL; + } +// [/RLVa:KB] + LLInventoryView* iv = LLInventoryView::getActiveInventory(); #if 0 && !LL_RELEASE_FOR_DOWNLOAD if (sActiveViews.count() == 1) diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index bdc24e0..1762165 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -225,6 +225,34 @@ public: static void toggleVisibility(); static void toggleVisibility(void*) { toggleVisibility(); } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + static void closeAll() + { + // If there are mulitple inventory floaters open then clicking the "Inventory" button will close + // them one by one (see LLToolBar::onClickInventory() => toggleVisibility() ) until we get to the + // last one which will just be hidden instead of closed/destroyed (see LLInventoryView::onClose) + // + // However the view isn't removed from sActiveViews until its destructor is called and since + // 'LLMortician::sDestroyImmediate == FALSE' while the viewer is running the destructor won't be + // called right away + // + // Result: we can't call close() on the last (sActiveViews.count() will still be > 1) because + // onClose() would take the wrong branch and destroy() it as well + // + // Workaround: "fix" onClose() to count only views that aren't marked as "dead" + + LLInventoryView* pView; U8 flagsSound; + for (S32 idx = sActiveViews.count() - 1; idx >= 0; idx--) + { + pView = sActiveViews.get(idx); + flagsSound = pView->getSoundFlags(); + pView->setSoundFlags(LLView::SILENT); // Suppress the window close sound + pView->close(); // onClose() protects against closing the last inventory floater + pView->setSoundFlags(flagsSound); // One view won't be destroy()'ed so it needs its sound flags restored + } + } +// [/RLVa:KB] + // Final cleanup, destroy all open inventory views. static void cleanup(); diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp index fd02be6..fa66b05 100644 --- a/linden/indra/newview/llmaniptranslate.cpp +++ b/linden/indra/newview/llmaniptranslate.cpp @@ -463,8 +463,15 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (mask == MASK_COPY) { // ...we're trying to make a copy - LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE); - mCopyMadeThisDrag = TRUE; +// LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE); +// mCopyMadeThisDrag = TRUE; +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + LLSelectMgr::getInstance()->selectDuplicate(LLVector3::zero, FALSE); + mCopyMadeThisDrag = TRUE; + } +// [/RLVa:KB] // When we make the copy, we don't want to do any other processing. // If so, the object will also be moved, and the copy will be offset. diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp index 6fa6745..8f5d90d 100644 --- a/linden/indra/newview/llnetmap.cpp +++ b/linden/indra/newview/llnetmap.cpp @@ -355,6 +355,16 @@ void LLNetMap::draw() glyph_color = avatar_color; } +// [RLVa:KB] + if ( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) ) + { + // User is not allowed to see who it is, or even if it's a friend, + // due to RLV settings. + glyph_color = avatar_color; + } +// [/RLVa:KB] + + LLWorldMapView::drawAvatar( pos_map.mV[VX], pos_map.mV[VY], glyph_color, @@ -551,11 +561,33 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec std::string fullname; if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) { - msg.append(fullname); - msg.append("\n"); +// [RLVa:KB] + if ( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) ) + { + // User is not allowed to see who it is, due to RLV settings. + msg.append(rlv_handler_t::cstrHidden); + } + else + { + msg.append(fullname); + msg.append("\n"); + } +// [/RLVa:KB] } - msg.append( region->getName() ); +// [RLVa:KB] + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + // User is not allowed to see where they are, due to RLV settings. + msg.append( rlv_handler_t::cstrHidden ); + } + else + { + msg.append( region->getName() ); + } +// [/RLVa:KB] + + msg.append("\n"); gSavedSettings.getBOOL( "MiniMapTeleport" ) ? msg.append(getString("tooltip_tp")) : msg.append(getString("tooltip_map")); diff --git a/linden/indra/newview/llnotify.cpp b/linden/indra/newview/llnotify.cpp index 9e837a6..5590ab1 100644 --- a/linden/indra/newview/llnotify.cpp +++ b/linden/indra/newview/llnotify.cpp @@ -54,6 +54,10 @@ #include "lloverlaybar.h" // for gOverlayBar #include "lluictrlfactory.h" +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0e) | Added: RLVa-0.2.0b +#include "rlvhandler.h" +// [/RLVa:KB] + // Globals LLNotifyBoxView* gNotifyBoxView = NULL; @@ -328,6 +332,13 @@ LLNotifyBox::LLNotifyBox(LLPointer xml_template, const LLSt // TODO: Make a separate archive for these. LLChat chat(mMessage); chat.mSourceType = CHAT_SOURCE_SYSTEM; +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0e) | Added: RLVa-0.2.0b + if (rlv_handler_t::isEnabled()) + { + // Notices should already have their contents filtered where necessary + chat.mRlvLocFiltered = chat.mRlvNamesFiltered = TRUE; + } +// [/RLVa:KB] LLFloaterChat::getInstance(LLSD())->addChatHistory(chat); } else diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 6b51b3a..12c001e 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp @@ -266,7 +266,10 @@ void LLOverlayBar::refresh() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; +// sitting = gAgent.getAvatarObject()->mIsSitting; +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + sitting = gAgent.getAvatarObject()->mIsSitting && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); +// [/RLVa:KB] } button = getChild("Stand Up"); @@ -349,6 +352,13 @@ void LLOverlayBar::onClickMouselook(void*) //static void LLOverlayBar::onClickStandUp(void*) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->mIsSitting) ) + { + return; + } +// [/RLVa:KB] + LLSelectMgr::getInstance()->deselectAllForStandingUp(); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); } diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp index fa1883d..e101ea2 100644 --- a/linden/indra/newview/llpanelavatar.cpp +++ b/linden/indra/newview/llpanelavatar.cpp @@ -792,6 +792,9 @@ void LLPanelAvatarClassified::refresh() S32 tab_count = tabs ? tabs->getTabCount() : 0; bool allow_new = tab_count < MAX_CLASSIFIEDS; +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + allow_new &= !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); +// [/RLVa:KB] bool allow_delete = (tab_count > 0); bool show_help = (tab_count == 0); @@ -927,6 +930,12 @@ void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, // static void LLPanelAvatarClassified::onClickNew(void* data) { +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; gViewerWindow->alertXml("AddClassified",callbackNew,self); @@ -1023,7 +1032,10 @@ void LLPanelAvatarPicks::refresh() BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); LLTabContainer* tabs = getChild("picks tab"); S32 tab_count = tabs ? tabs->getTabCount() : 0; - childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ); +// [/RLVa:KB] + //childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); childSetEnabled("Delete...", self && tab_count > 0); childSetVisible("New...", self && getPanelAvatar()->isEditable()); childSetVisible("Delete...", self && getPanelAvatar()->isEditable()); @@ -1101,6 +1113,12 @@ void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) // static void LLPanelAvatarPicks::onClickNew(void* data) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; LLPanelPick* panel_pick = new LLPanelPick(FALSE); LLTabContainer* tabs = self->getChild("picks tab"); diff --git a/linden/indra/newview/llpanelclassified.cpp b/linden/indra/newview/llpanelclassified.cpp index 4d28be5..3760815 100644 --- a/linden/indra/newview/llpanelclassified.cpp +++ b/linden/indra/newview/llpanelclassified.cpp @@ -760,7 +760,10 @@ void LLPanelClassified::refresh() mClickThroughText->setVisible(is_self); mSetBtn->setVisible(is_self); - mSetBtn->setEnabled(is_self); + //mSetBtn->setEnabled(is_self); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + mSetBtn->setEnabled(is_self && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ); +// [/RLVa:KB] mUpdateBtn->setEnabled(is_self && checkDirty()); mUpdateBtn->setVisible(is_self); @@ -964,6 +967,12 @@ void LLPanelClassified::onClickLandmark(void* data) // static void LLPanelClassified::onClickSet(void* data) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] LLPanelClassified* self = (LLPanelClassified*)data; // Save location for later. diff --git a/linden/indra/newview/llpanelcontents.cpp b/linden/indra/newview/llpanelcontents.cpp index d91790e..e13ec46 100644 --- a/linden/indra/newview/llpanelcontents.cpp +++ b/linden/indra/newview/llpanelcontents.cpp @@ -66,6 +66,10 @@ #include "lltoolcomp.h" #include "llpanelinventory.h" +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) +#include "llvoavatar.h" +// [/RLVa:KB] + // // Imported globals // @@ -117,6 +121,24 @@ void LLPanelContents::getState(LLViewerObject *objectp ) && ( objectp->permYouOwner() || ( !group_id.isNull() && gAgent.isInGroup(group_id) ))); // solves SL-23488 BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0g + if ( (rlv_handler_t::isEnabled()) && (editable) ) + { + // Don't allow creation of new scripts if it's undetachable + editable = gRlvHandler.isDetachable(objectp); + + // Don't allow creation of new scripts if we're @unsit=n or @sittp=n restricted and we're sitting on the selection + if ( (editable) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + // Only check the first (non-)root object because nothing else would result in enabling the button (see below) + LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(TRUE); + + editable = (pObj) && (pAvatar) && ((!pAvatar->mIsSitting) || (pAvatar->getRoot() != pObj->getRootEdit())); + } + } +// [/RLVa:KB] + // Edit script button - ok if object is editable and there's an // unambiguous destination for the object. if( editable && @@ -160,6 +182,22 @@ void LLPanelContents::onClickNewScript(void *userdata) LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if (rlv_handler_t::isEnabled()) // Fallback code [see LLPanelContents::getState()] + { + if (!gRlvHandler.isDetachable(object)) + { + return; // Disallow creating new scripts in a locked attachment + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) + return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n + } + } +// [/RLVa:KB] + LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); perm.initMasks( diff --git a/linden/indra/newview/llpaneldisplay.cpp b/linden/indra/newview/llpaneldisplay.cpp index 308f3df..e3da12a 100644 --- a/linden/indra/newview/llpaneldisplay.cpp +++ b/linden/indra/newview/llpaneldisplay.cpp @@ -478,7 +478,12 @@ void LLPanelDisplay::refreshEnabledState() } // Vertex Shaders - mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); +// mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a + // "Basic Shaders" can't be disabled - but can be enabled - under @setenv=n + bool fCtrlShaderEnable = LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"); + mCtrlShaderEnable->setEnabled(fCtrlShaderEnable && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) || !mShaderEnable)); +// [/RLVa:KB] BOOL shaders = mCtrlShaderEnable->get(); if (shaders) @@ -493,7 +498,12 @@ void LLPanelDisplay::refreshEnabledState() // *HACK just checks to see if we can use shaders... // maybe some cards that use shaders, but don't support windlight - mCtrlWindLight->setEnabled(mCtrlShaderEnable->getEnabled() && shaders); +// mCtrlWindLight->setEnabled(mCtrlShaderEnable->getEnabled() && shaders); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a + // "Atmospheric Shaders" can't be disabled - but can be enabled - under @setenv=n + bool fCtrlWindLightEnable = fCtrlShaderEnable && shaders; + mCtrlWindLight->setEnabled(fCtrlWindLightEnable && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETENV) || !mWindLight)); +// [/RLVa:KB] // turn off sky detail if atmostpherics isn't on mCtrlSkyFactor->setEnabled(gSavedSettings.getBOOL("WindLightUseAtmosShaders")); diff --git a/linden/indra/newview/llpanelinventory.cpp b/linden/indra/newview/llpanelinventory.cpp index c53395d..7ab850f 100644 --- a/linden/indra/newview/llpanelinventory.cpp +++ b/linden/indra/newview/llpanelinventory.cpp @@ -81,6 +81,10 @@ #include "llviewerwindow.h" #include "llwearable.h" +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) +#include "llvoavatar.h" +// [/RLVa:KB] + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -364,8 +368,16 @@ void LLTaskInvFVBridge::previewItem() BOOL LLTaskInvFVBridge::isItemRenameable() const { - if(gAgent.isGodlike()) return TRUE; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return FALSE; + } +// [/RLVa:KB] + + if(gAgent.isGodlike()) return TRUE; +// LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object) { LLInventoryItem* item; @@ -382,6 +394,12 @@ BOOL LLTaskInvFVBridge::isItemRenameable() const BOOL LLTaskInvFVBridge::renameItem(const std::string& new_name) { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return TRUE; // Fallback code [see LLTaskInvFVBridge::isItemRenameable()] + } +// [/RLVa:KB] if(object) { LLViewerInventoryItem* item = NULL; @@ -408,12 +426,47 @@ BOOL LLTaskInvFVBridge::isItemMovable() // return TRUE; //} //return FALSE; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0g + if (rlv_handler_t::isEnabled()) + { + LLViewerObject* pObj = gObjectList.findObject(mPanel->getTaskUUID()); + if (pObj) + { + if (!gRlvHandler.isDetachable(pObj)) + { + return FALSE; + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == pObj->getRootEdit()) ) + return FALSE; + } + } + } +// [/RLVa:KB] return TRUE; } BOOL LLTaskInvFVBridge::isItemRemovable() { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0g + if ( (object) && (rlv_handler_t::isEnabled()) ) + { + if (!gRlvHandler.isDetachable(object)) + { + return FALSE; + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) + return FALSE; + } + } +// [/RLVa:KB] + if(object && (object->permModify() || object->permYouOwner())) { @@ -558,6 +611,13 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const const LLPermissions& perm = inv->getPermissions(); bool can_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // Kind of redundant due to the note below, but in case that ever gets fixed + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return FALSE; + } +// [/RLVa:KB] if (object->isAttachment() && !can_copy) { //RN: no copy contents of attachments cannot be dragged out @@ -675,6 +735,14 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Task Open")); } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + else if ( (rlv_handler_t::isEnabled()) && + ((LLAssetType::AT_LSL_TEXT == item->getType()) || (LLAssetType::AT_NOTECARD == item->getType())) && + (!gRlvHandler.isDetachable(gObjectList.findObject(mPanel->getTaskUUID()))) ) + { + disabled_items.push_back(std::string("Task Open")); + } +// [/RLVa:KB] } items.push_back(std::string("Task Properties")); if(isItemRenameable()) @@ -1180,12 +1248,20 @@ LLTaskLSLBridge::LLTaskLSLBridge( void LLTaskLSLBridge::openItem() { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return; + } +// [/RLVa:KB] + llinfos << "LLTaskLSLBridge::openItem() " << mUUID << llendl; if(LLLiveLSLEditor::show(mUUID, mPanel->getTaskUUID())) { return; } - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); +// LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(!object || object->isInventoryPending()) { return; @@ -1300,6 +1376,12 @@ void LLTaskNotecardBridge::openItem() { return; } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour("viewnote")) || (!gRlvHandler.isDetachable(object))) ) + { + return; + } +// [/RLVa:KB] if(object->permModify() || gAgent.isGodlike()) { S32 left, top; diff --git a/linden/indra/newview/llpanelland.cpp b/linden/indra/newview/llpanelland.cpp index b40450c..c0b8e24 100644 --- a/linden/indra/newview/llpanelland.cpp +++ b/linden/indra/newview/llpanelland.cpp @@ -230,6 +230,12 @@ void LLPanelLandInfo::refresh() //static void LLPanelLandInfo::onClickClaim(void*) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] LLViewerParcelMgr::getInstance()->startBuyLand(); } diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index c26f70f..325fcbc 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp @@ -74,6 +74,10 @@ #include "llglheaders.h" +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) +#include "rlvhandler.h" +// [/RLVa:KB] + #define USE_VIEWER_AUTH 0 std::string load_password_from_disk(void); @@ -797,6 +801,18 @@ void LLPanelLogin::refreshLocation( bool force_visible ) if ( ! force_visible ) show_start = gSavedSettings.getBOOL("ShowStartLocation"); + +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) +// TODO-RLVa: figure out some way to make this work with RLV_EXTENSION_STARTLOCATION +#ifndef RLV_EXTENSION_STARTLOCATION + if (rlv_handler_t::isEnabled()) + { + show_start = FALSE; + } +#endif // RLV_EXTENSION_STARTLOCATION +// [/RLVa:KB] + + sInstance->childSetVisible("start_location_combo", show_start); sInstance->childSetVisible("start_location_text", show_start); diff --git a/linden/indra/newview/llpanelobject.cpp b/linden/indra/newview/llpanelobject.cpp index 5c70590..dd71a0e 100644 --- a/linden/indra/newview/llpanelobject.cpp +++ b/linden/indra/newview/llpanelobject.cpp @@ -75,6 +75,10 @@ #include "lldrawpool.h" +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) +#include "llvoavatar.h" +// [/RLVa:KB] + // // Constants // @@ -385,6 +389,15 @@ void LLPanelObject::getState( ) enable_rotate = FALSE; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == objectp->getRootEdit()) ) + enable_move = enable_scale = enable_rotate = FALSE; + } +// [/RLVa:KB] + LLVector3 vec; if (enable_move) { diff --git a/linden/indra/newview/llpanelpermissions.cpp b/linden/indra/newview/llpanelpermissions.cpp index 439d8b4..24bbab6 100644 --- a/linden/indra/newview/llpanelpermissions.cpp +++ b/linden/indra/newview/llpanelpermissions.cpp @@ -327,9 +327,26 @@ void LLPanelPermissions::refresh() } } +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + bool fRlvEnableOwner = true; + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) + { + // Only filter the owner name if: the selection is all owned by the same avie and not group owned + if ( (owners_identical) && (!LLSelectMgr::getInstance()->selectIsGroupOwned()) ) + { + owner_name = gRlvHandler.getAnonym(owner_name); + fRlvEnableOwner = false; + } + } +// [/RLVa:KB] + childSetText("Owner Name",owner_name); childSetEnabled("Owner Name",TRUE); - childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); +// childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + childSetEnabled("button owner profile", + fRlvEnableOwner && owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); +// [/RLVa:KB] if (owner_name != last_owner_name) { @@ -852,7 +869,13 @@ void LLPanelPermissions::onClickOwner(void *data) } else { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + } +// [/RLVa:KB] +// LLFloaterAvatarInfo::showFromObject(self->mOwnerID); } } diff --git a/linden/indra/newview/llpanelpick.cpp b/linden/indra/newview/llpanelpick.cpp index 480f703..57ce6d5 100644 --- a/linden/indra/newview/llpanelpick.cpp +++ b/linden/indra/newview/llpanelpick.cpp @@ -400,7 +400,10 @@ void LLPanelPick::refresh() mEnabledCheck->setEnabled(godlike); mSetBtn->setVisible(godlike); - mSetBtn->setEnabled(godlike); + //mSetBtn->setEnabled(godlike); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + mSetBtn->setEnabled(godlike && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ); +// [/RLVa:KB] } else { @@ -417,7 +420,10 @@ void LLPanelPick::refresh() mEnabledCheck->setEnabled(FALSE); mSetBtn->setVisible(is_self); - mSetBtn->setEnabled(is_self); + //mSetBtn->setEnabled(is_self); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + mSetBtn->setEnabled(is_self && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ); +// [/RLVa] } } @@ -455,6 +461,12 @@ void LLPanelPick::onClickLandmark(void* data) // static void LLPanelPick::onClickSet(void* data) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return; + } +// [/RLVa:KB] LLPanelPick* self = (LLPanelPick*)data; // Save location for later. diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp index 6115074..5cb14fc 100644 --- a/linden/indra/newview/llprefsim.cpp +++ b/linden/indra/newview/llprefsim.cpp @@ -259,6 +259,12 @@ void LLPrefsIMImpl::setPersonalInfo(const std::string& visibility, bool im_via_e LLWStringUtil::replaceChar(busy_response, '^', '\n'); LLWStringUtil::replaceChar(busy_response, '%', ' '); childSetText("busy_response", wstring_to_utf8str(busy_response)); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) + { + childDisable("busy_response"); + } +// [/RLVa:KB] enableHistory(); diff --git a/linden/indra/newview/llpreviewscript.cpp b/linden/indra/newview/llpreviewscript.cpp index af52a4b..1e9def3 100644 --- a/linden/indra/newview/llpreviewscript.cpp +++ b/linden/indra/newview/llpreviewscript.cpp @@ -1925,6 +1925,12 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) LLCheckBoxCtrl* runningCheckbox = self->getChild("running"); BOOL running = runningCheckbox->get(); //self->mRunningCheckbox->get(); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return; + } +// [/RLVa:KB] if( object ) { LLMessageSystem* msg = gMessageSystem; @@ -1950,6 +1956,12 @@ void LLLiveLSLEditor::onReset(void *userdata) LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; LLViewerObject* object = gObjectList.findObject( self->mObjectID ); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(object)) ) + { + return; + } +// [/RLV:KB] if(object) { LLMessageSystem* msg = gMessageSystem; @@ -2371,6 +2383,14 @@ void LLLiveLSLEditor::onLoad(void* userdata) void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) { LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; + +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(gObjectList.findObject(self->mObjectID))) ) + { + return; + } +// [/RLV:KB] + self->mCloseAfterSave = close_after_save; self->saveIfNeeded(); } diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp index f46f104..af97e2e 100644 --- a/linden/indra/newview/llselectmgr.cpp +++ b/linden/indra/newview/llselectmgr.cpp @@ -3451,12 +3451,20 @@ void LLSelectMgr::deselectAllIfTooFar() } LLVector3d selectionCenter = getSelectionCenterGlobal(); - if (gSavedSettings.getBOOL("LimitSelectDistance") + +// if (gSavedSettings.getBOOL("LimitSelectDistance") +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + BOOL fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && gFloaterTools->getVisible(); + if ( (gSavedSettings.getBOOL("LimitSelectDistance") || (fRlvFartouch) ) +// [/RLVa:KB] && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar()) && !mSelectedObjects->isAttachment() && !selectionCenter.isExactlyZero()) { - F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); +// F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : 1.5f; +// [/RLVa:KB] F32 deselect_dist_sq = deselect_dist * deselect_dist; LLVector3d select_delta = gAgent.getPositionGlobal() - selectionCenter; diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index fdc0182..8d5aa9e 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -384,6 +384,11 @@ bool idle_startup() // Initialize stuff that doesn't need data from simulators // +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d + if ( (gSavedSettings.controlExists(RLV_SETTING_MAIN)) && (gSavedSettings.getBOOL(RLV_SETTING_MAIN)) ) + rlv_handler_t::setEnabled(TRUE); +// [/RLVa:KB] + if (LLFeatureManager::getInstance()->isSafe()) { gViewerWindow->alertXml("DisplaySetToSafe"); @@ -924,6 +929,23 @@ bool idle_startup() // their last location, or some URL "-url //sim/x/y[/z]" // All accounts have both a home and a last location, and we don't support // more locations than that. Choose the appropriate one. JC +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1d + #ifndef RLV_EXTENSION_STARTLOCATION + if (rlv_handler_t::isEnabled()) + #else + if ( (rlv_handler_t::isEnabled()) && (RlvSettings::getLoginLastLocation()) ) + #endif // RLV_EXTENSION_STARTLOCATION + { + // Force login at the last location + agent_location_id = START_LOCATION_ID_LAST; + location_which = START_LOCATION_ID_LAST; + gSavedSettings.setBOOL("LoginLastLocation", FALSE); + + // Clear some things that would cause us to divert to a user-specified location + LLURLSimString::setString(LLURLSimString::sLocationStringLast); + LLStartUp::sSLURLCommand.clear(); + } else +// [/RLVa:KB] if (LLURLSimString::parse()) { // a startup URL was specified diff --git a/linden/indra/newview/llstatusbar.cpp b/linden/indra/newview/llstatusbar.cpp index b0ef61f..012db6f 100644 --- a/linden/indra/newview/llstatusbar.cpp +++ b/linden/indra/newview/llstatusbar.cpp @@ -568,6 +568,15 @@ void LLStatusBar::refresh() mRegionDetails.mTraffic = 0.0f; } +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a + if ( (region) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) // region == NULL if we loose our connection to the grid + { + // TODO-RLVa: find out whether the LCD code is still used because if so then we need to filter that as well + location_name = llformat("%s (%s) - %s", + rlv_handler_t::cstrHiddenRegion.c_str(), region->getSimAccessString().c_str(), rlv_handler_t::cstrHidden.c_str()); + } +// [/RLVa:KB] + mTextParcelName->setText(location_name); @@ -814,6 +823,12 @@ static void onClickScripts(void*) static void onClickBuyLand(void*) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + { + return; + } +// [/RLVa:KB] LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); LLViewerParcelMgr::getInstance()->startBuyLand(); } diff --git a/linden/indra/newview/lltoolbar.cpp b/linden/indra/newview/lltoolbar.cpp index 8202191..6d04294 100644 --- a/linden/indra/newview/lltoolbar.cpp +++ b/linden/indra/newview/lltoolbar.cpp @@ -307,6 +307,20 @@ void LLToolBar::refresh() } gSavedSettings.setBOOL("BuildBtnState", build_mode); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) + // Called per-frame so this really can't be slow + if (rlv_handler_t::isEnabled()) + { + // If we're rez-restricted, we can still edit => allow build floater + // If we're edit-restricted, we can still rez => allow build floater + childSetEnabled("build_btn", !(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) ); + + childSetEnabled("map_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP) ); + childSetEnabled("radar_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP) ); + childSetEnabled("inventory_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV) ); + } +// [/RLVa:KB] + updateCommunicateList(); } @@ -479,6 +493,14 @@ void LLToolBar::onClickSit(void*) } else { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // NOTE-RLVa: dead code? + if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) + { + return; + } +// [/RLVa:KB] + // stand up gAgent.setFlying(FALSE); gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); diff --git a/linden/indra/newview/lltooldraganddrop.cpp b/linden/indra/newview/lltooldraganddrop.cpp index efd8060..c99ccbf 100644 --- a/linden/indra/newview/lltooldraganddrop.cpp +++ b/linden/indra/newview/lltooldraganddrop.cpp @@ -1267,6 +1267,15 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, return; } + +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // Fallback in case there's a new code path that leads here (see behaviour notes) + if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return; + } +// [/RLVa:KB] + //llinfos << "Rezzing object" << llendl; make_ui_sound("UISndObjectRezIn"); LLViewerInventoryItem* item; @@ -1933,6 +1942,23 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL BOOL volume = (LL_PCODE_VOLUME == obj->getPCode()); BOOL attached = obj->isAttachment(); BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; + +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if (rlv_handler_t::isEnabled()) + { + if (!gRlvHandler.isDetachable(obj)) + { + return ACCEPT_NO_LOCKED; // Disallow inventory drops on a locked attachment + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == obj->getRootEdit()) ) + return ACCEPT_NO_LOCKED; // ... or on a linkset the avie is sitting on under @unsit=n/@sittp=n + } + } +// [/RLVa:KB] + if(attached && !unrestricted) { return ACCEPT_NO_LOCKED; @@ -1988,6 +2014,15 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( return ACCEPT_NO; } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-1.0.0c + LLViewerJointAttachment* pAttachPt = NULL; + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) && (!RlvSettings::getEnableWear()) && + ( ((pAttachPt = gRlvHandler.getAttachPoint(item, true)) == NULL) || (!gRlvHandler.isDetachable(pAttachPt->getObject())) ) ) + { + return ACCEPT_NO_LOCKED; + } +// [/RLVa:KB] + if( drop ) { if(mSource == SOURCE_LIBRARY) @@ -2003,7 +2038,10 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( } else { - rez_attachment(item, 0); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Added: RLVa-1.0.0c + rez_attachment(item, pAttachPt); +// [/RLVa:KB] + //rez_attachment(item, 0); } } return ACCEPT_YES_SINGLE; @@ -2013,6 +2051,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return ACCEPT_NO_LOCKED; + } +// [/RLVa:KB] + if (mSource == SOURCE_WORLD) { return dad3dRezFromObjectOnLand(obj, face, mask, drop); @@ -2076,6 +2121,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // NOTE: if (mask & MASK_CONTROL) then it's a drop rather than a rez, so we let that pass through + if ( !(mask & MASK_CONTROL) && (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) + { + return ACCEPT_NO_LOCKED; + } +// [/RLVa:KB] + // handle objects coming from object inventory if (mSource == SOURCE_WORLD) { @@ -2281,6 +2334,20 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( return ACCEPT_NO; } +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) + // (See behaviour notes for the "code path", this is just to give a visual indication on whether or not the drop is allowed) + if (rlv_handler_t::isEnabled()) + { + EWearableType type = (EWearableType)item->getFlags(); + + // Block if: 1) we can't wear on that layer; 2) or if we're already wearing something there we can't take off + if ( (!gRlvHandler.isWearable(type)) || ((gAgent.getWearable(type)) && (!gRlvHandler.isRemovable(type))) ) + { + return ACCEPT_NO_LOCKED; + } + } +// [/RLVa:KB] + if( drop ) { // Don't wear anything until initial wearables are loaded, can @@ -2645,6 +2712,14 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // NOTE: it looks like this is only ever called from LLToolDragAndDrop::dad3dRezObjectOnLand() making this a bit redundant + if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return ACCEPT_NO_LOCKED; + } +// [/RLVa:KB] + lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << llendl; LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; @@ -2666,6 +2741,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // NOTE: it looks like this is only ever called from LLToolDragAndDrop::dad3dRezObjectOnObject) making this a bit redundant + if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return ACCEPT_NO_LOCKED; + } +// [/RLVa:KB] + lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << llendl; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; diff --git a/linden/indra/newview/lltoolface.cpp b/linden/indra/newview/lltoolface.cpp index d5e4f81..41f2b0d 100644 --- a/linden/indra/newview/lltoolface.cpp +++ b/linden/indra/newview/lltoolface.cpp @@ -99,6 +99,16 @@ void LLToolFace::pickCallback(const LLPickInfo& pick_info) return; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + if ( (rlv_handler_t::isEnabled()) && + ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) || + ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!hit_obj->isAttachment()) || (!hit_obj->permYouOwner())) && + (dist_vec_squared(gAgent.getPositionAgent(), hit_obj->getPositionRegion() + pick_info.mObjectOffset) > 1.5f * 1.5f) ))) + { + return; + } +// [/RLVa:KB] + // ...clicked on a world object, try to pick the appropriate face if (pick_info.mKeyMask & MASK_SHIFT) diff --git a/linden/indra/newview/lltoolgrab.cpp b/linden/indra/newview/lltoolgrab.cpp index a6695f9..6c0a557 100644 --- a/linden/indra/newview/lltoolgrab.cpp +++ b/linden/indra/newview/lltoolgrab.cpp @@ -185,7 +185,12 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) return FALSE; } - if (objectp->isAvatar()) + //if (objectp->isAvatar()) +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + if ( (objectp->isAvatar()) || + ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!objectp->isAttachment()) || (!objectp->permYouOwner())) && + (dist_vec_squared(gAgent.getPositionAgent(), mGrabPick.mIntersection) > 1.5f * 1.5f) ) ) +// [/RLVa:KB] { if (gGrabTransientTool) { @@ -420,6 +425,23 @@ BOOL LLToolGrab::handleHover(S32 x, S32 y, MASK mask) return TRUE; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f + // Don't allow dragging beyond 1.5m under @fartouch=n + LLViewerObject* pObj; + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (GRAB_INACTIVE != mMode) && (hasMouseCapture()) && + ((pObj = mGrabPick.getObject()) != NULL) && (!pObj->isDead()) && (!pObj->isHUDAttachment()) && + (dist_vec_squared(gAgent.getPositionAgent(), pObj->getPositionRegion() + mGrabPick.mObjectOffset) > 1.5f * 1.5f) ) + { + if (gGrabTransientTool) + { + // Prevent the grab tool from popping up as soon as we kill the drag operation + gBasicToolset->selectTool(gGrabTransientTool); + gGrabTransientTool = NULL; + } + setMouseCapture(FALSE); + } +// [/RLVa:KB] + // Do the right hover based on mode switch( mMode ) { diff --git a/linden/indra/newview/lltoolpie.cpp b/linden/indra/newview/lltoolpie.cpp index b660b8d..b32169d 100644 --- a/linden/indra/newview/lltoolpie.cpp +++ b/linden/indra/newview/lltoolpie.cpp @@ -165,6 +165,15 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // If it's a left-click, and we have a special action, do it. if (useClickAction(always_show, mask, object, parent)) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + // Block left-click special actions (fallback code really since LLToolSelect::handleObjectSelection() wouldn't select it anyway) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && + (dist_vec_squared(gAgent.getPositionAgent(), mPick.mIntersection) > 1.5f * 1.5f) ) + { + return TRUE; + } +// [/RLVa:KB] + mClickAction = 0; if (object && object->getClickAction()) { @@ -344,7 +353,22 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) //gMutePieMenu->setLabel("Mute"); } - gPieAvatar->show(x, y, mPieMouseButtonDown); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f +#ifdef RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK + // If we have an empty selection under @fartouch=n don't show the pie menu but play the "operation block" sound + if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) ) + { +#endif // RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK + gPieAvatar->show(x, y, mPieMouseButtonDown); +#ifdef RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK + } + else + { + make_ui_sound("UISndInvalidOp"); + } +#endif // RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK +// [/RLVa:KB] + } else if (object->isAttachment() && !object->isHUDAttachment()) { @@ -374,15 +398,32 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) //gMuteObjectPieMenu->setLabel("Mute"); } - gPieObject->show(x, y, mPieMouseButtonDown); - - // VEFFECT: ShowPie object - // Don't show when you click on someone else, it freaks them - // out. - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); - effectp->setPositionGlobal(mPick.mPosGlobal); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - effectp->setDuration(0.25f); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f + #ifdef RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK + // If we have an empty selection under @fartouch=n don't show the pie menu but play the "operation block" sound + // (not entirely accurate in case of Tools / Select Only XXX [see LLToolSelect::handleObjectSelection()] + if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) || (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) ) + { + #endif // RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK +// [/RLVa:KB] + gPieObject->show(x, y, mPieMouseButtonDown); + + // VEFFECT: ShowPie object + // Don't show when you click on someone else, it freaks them + // out. + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + effectp->setPositionGlobal(mPick.mPosGlobal); + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + effectp->setDuration(0.25f); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f + #ifdef RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK + } + else + { + make_ui_sound("UISndInvalidOp"); + } + #endif // RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK +// [/RLVa:KB] } } diff --git a/linden/indra/newview/lltoolplacer.cpp b/linden/indra/newview/lltoolplacer.cpp index 297556e..840de23 100644 --- a/linden/indra/newview/lltoolplacer.cpp +++ b/linden/indra/newview/lltoolplacer.cpp @@ -124,6 +124,14 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, return FALSE; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + // NOTE: don't use surface_pos_global since for prims it will be the center of the prim while we need center + offset + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (dist_vec_squared(gAgent.getPositionGlobal(), pick.mPosGlobal) > 1.5f * 1.5f) ) + { + return FALSE; + } +// [/RLVa:KB] + // Find the sim where the surface lives. LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(surface_pos_global); if (!regionp) @@ -255,7 +263,10 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) { flags |= FLAGS_USE_PHYSICS; } - if (create_selected) + //if (create_selected) +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) | Added: RLVa-1.0.0b + if ( (create_selected) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) ) +// [/RLVa:KB] { flags |= FLAGS_CREATE_SELECTED; } @@ -513,6 +524,13 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) { BOOL added = TRUE; +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return TRUE; // Callers seem to expect a "did you handle it?" so we return TRUE rather than FALSE + } +// [/RLVa:KB] + if (gSavedSettings.getBOOL("CreateToolCopySelection")) { added = addDuplicate(x, y); diff --git a/linden/indra/newview/lltoolselect.cpp b/linden/indra/newview/lltoolselect.cpp index b4e9562..389ae59 100644 --- a/linden/indra/newview/lltoolselect.cpp +++ b/linden/indra/newview/lltoolselect.cpp @@ -50,6 +50,10 @@ #include "llvoavatar.h" #include "llworld.h" +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) +#include "llfloatertools.h" +// [/RLVa:KB] + // Globals extern BOOL gAllowSelectAvatar; @@ -82,6 +86,51 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi { object = object->getRootEdit(); } + +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + if (rlv_handler_t::isEnabled()) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + if (!temp_select) + { + return LLSelectMgr::getInstance()->getSelection(); + } + else + { + // Temporary selection, but if the build floater is open then it'll be permanent so get rid of the floater + if (gFloaterTools->getVisible()) + { + // Copy/paste from toggle_build_mode() + gAgent.resetView(false); + gFloaterTools->close(); + gViewerWindow->showCursor(); + } + } + } + + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && (object) && ((!object->isAttachment()) || (!object->permYouOwner())) && + (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion()) > 1.5f * 1.5f) ) + { + // NOTE-RLVa: see behaviour notes for a rather lengthy explanation of why we're doing things this way + //if (dist_vec_squared(gAgent.getPositionAgent(), object->getPositionRegion() + pick.mObjectOffset) > 1.5f * 1.5f) + if (dist_vec_squared(gAgent.getPositionAgent(), pick.mIntersection) > 1.5f * 1.5f) + { + if ( (gFloaterTools->getVisible()) && (pick.mKeyMask != MASK_SHIFT) && (pick.mKeyMask != MASK_CONTROL) ) + LLSelectMgr::getInstance()->deselectAll(); + return LLSelectMgr::getInstance()->getSelection(); + } + else if (gFloaterTools->getVisible()) + { + // Copy/paste from toggle_build_mode() + gAgent.resetView(false); + gFloaterTools->close(); + gViewerWindow->showCursor(); + } + } + } +// [/RLVa:KB] + BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); diff --git a/linden/indra/newview/lltracker.cpp b/linden/indra/newview/lltracker.cpp index bd2f659..cf98c7a 100644 --- a/linden/indra/newview/lltracker.cpp +++ b/linden/indra/newview/lltracker.cpp @@ -180,8 +180,12 @@ void LLTracker::render3D() } else { - renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, - instance()->mBeaconText, instance()->mTrackedLocationName ); + //renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, + // instance()->mBeaconText, instance()->mTrackedLocationName ); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a + renderBeacon(instance()->mTrackedPositionGlobal, gTrackColor, instance()->mBeaconText, + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? instance()->mTrackedLocationName : rlv_handler_t::cstrHidden); +// [/RLVa:KB] } } @@ -222,8 +226,12 @@ void LLTracker::render3D() // and back again instance()->mHasReachedLandmark = FALSE; } - renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, - instance()->mBeaconText, instance()->mTrackedLandmarkName ); + //renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, + // instance()->mBeaconText, instance()->mTrackedLandmarkName ); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a + renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, instance()->mBeaconText, + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? instance()->mTrackedLandmarkName : rlv_handler_t::cstrHidden); +// [/RLVa:KB] } } else @@ -251,8 +259,12 @@ void LLTracker::render3D() } else { - renderBeacon( av_tracker.getGlobalPos(), gTrackColor, - instance()->mBeaconText, av_tracker.getName() ); + //renderBeacon( av_tracker.getGlobalPos(), gTrackColor, + // instance()->mBeaconText, av_tracker.getName() ); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a + renderBeacon( av_tracker.getGlobalPos(), gTrackColor, instance()->mBeaconText, + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? av_tracker.getName() : rlv_handler_t::cstrHidden); +// [/RLVa:KB] } } else diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp index 89ae973..eb8b1d5 100644 --- a/linden/indra/newview/llviewercontrol.cpp +++ b/linden/indra/newview/llviewercontrol.cpp @@ -423,6 +423,20 @@ bool handleVoiceClientPrefsChanged(const LLSD& newvalue) return true; } +// [RLVa:KB] - Checked: 2009-08-11 (RLVa-1.0.1h) | Added: RLVa-1.0.1h +bool rlvHandleEnableLegacyNamingChanged(const LLSD& newvalue) +{ + rlv_handler_t::fLegacyNaming = newvalue.asBoolean(); + return true; +} + +bool rlvHandleShowNameTagsChanged(const LLSD& newvalue) +{ + RlvSettings::fShowNameTags = newvalue.asBoolean(); + return true; +} +// [/RLVa:KB] + bool handleMediaDebugLevelChanged(const LLSD& newvalue) { LLMediaManager *mgr = LLMediaManager::getInstance(); @@ -566,6 +580,13 @@ void settings_setup_listeners() gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); gSavedSettings.getControl("MediaDebugLevel")->getSignal()->connect(boost::bind(&handleMediaDebugLevelChanged, _1)); + +// [RLVa:KB] - Checked: 2009-08-11 (RLVa-1.0.1h) | Added: RLVa-1.0.1h + if (gSavedSettings.controlExists(RLV_SETTING_ENABLELEGACYNAMING)) + gSavedSettings.getControl(RLV_SETTING_ENABLELEGACYNAMING)->getSignal()->connect(boost::bind(&rlvHandleEnableLegacyNamingChanged, _1)); + if (gSavedSettings.controlExists(RLV_SETTING_SHOWNAMETAGS)) + gSavedSettings.getControl(RLV_SETTING_SHOWNAMETAGS)->getSignal()->connect(boost::bind(&rlvHandleShowNameTagsChanged, _1)); +// [/RLVa:KB] } template <> eControlType get_control_type(const U32& in, LLSD& out) diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp index 96591a2..4b352a4 100644 --- a/linden/indra/newview/llviewerdisplay.cpp +++ b/linden/indra/newview/llviewerdisplay.cpp @@ -675,7 +675,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gSky.updateSky(); } - if(gUseWireframe) +// if(gUseWireframe) +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (gUseWireframe) && ( (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedAttachment()) ) ) +// [/RLVa:KB] { glClearColor(0.5f, 0.5f, 0.5f, 0.f); glClear(GL_COLOR_BUFFER_BIT); @@ -802,7 +805,12 @@ void render_hud_attachments() glh::matrix4f current_mod = glh_get_current_modelview(); // clamp target zoom level to reasonable values - gAgent.mHUDTargetZoom = llclamp(gAgent.mHUDTargetZoom, 0.1f, 1.f); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // TODO-RLVa: while hasLockedHUD() isn't slow this is called per frame so find a better way + gAgent.mHUDTargetZoom = llclamp(gAgent.mHUDTargetZoom, + ( (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedHUD()) ) ? 0.1f : 0.85f, 1.f); +// [/RLVa:KB] + //gAgent.mHUDTargetZoom = llclamp(gAgent.mHUDTargetZoom, 0.1f, 1.f); // smoothly interpolate current zoom level gAgent.mHUDCurZoom = lerp(gAgent.mHUDCurZoom, gAgent.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index ddebd97..8a92963 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -209,6 +209,7 @@ #include "llwaterparammanager.h" #include "lltexlayer.h" +#include "primbackup.h" #include "jcfloater_animation_list.h" #include "llfloaterassetbrowser.h" @@ -222,6 +223,13 @@ void init_debug_ui_menu(LLMenuGL* menu); void init_debug_xui_menu(LLMenuGL* menu); void init_debug_avatar_menu(LLMenuGL* menu); void init_debug_baked_texture_menu(LLMenuGL* menu); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) +#ifdef RLV_DEBUG_TESTS + #include "rlvtest.h" +#endif // RLV_DEBUG_TESTS +#include "rlvfloaterbehaviour.h" +void init_debug_rlva_menu(LLMenuGL* menu); +// [/RLVa:KB] BOOL enable_land_build(void*); BOOL enable_object_build(void*); @@ -828,6 +836,19 @@ void init_client_menu(LLMenuGL* menu) init_debug_world_menu(sub_menu); menu->appendMenu(sub_menu); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1b + #ifdef RLV_ADVANCED_MENU + if (rlv_handler_t::isEnabled()) + { + sub_menu = new LLMenuGL("RLVa"); + init_debug_rlva_menu(sub_menu); + menu->appendMenu(sub_menu); + sub_menu->setVisible(rlv_handler_t::isEnabled()); + sub_menu->setEnabled(rlv_handler_t::isEnabled()); + } + #endif // RLV_ADVANCED_MENU +// [/RLVa:KB] + sub_menu = new LLMenuGL("UI"); init_debug_ui_menu(sub_menu); menu->appendMenu(sub_menu); @@ -922,6 +943,13 @@ void init_client_menu(LLMenuGL* menu) &menu_check_control, (void*)"ShowConsoleWindow")); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0e + #ifdef RLV_ADVANCED_TOGGLE_RLVA + if (gSavedSettings.controlExists(RLV_SETTING_MAIN)) + menu->append(new LLMenuItemCheckGL("Restrained Life API", &rlvDbgToggleEnabled, NULL, &rlvDbgGetEnabled, NULL)); + #endif // RLV_ADVANCED_TOGGLE_RLVA +// [/RLVa:KB] + if(gSavedSettings.getBOOL("QAMode")) { LLMenuGL* sub = NULL; @@ -1369,6 +1397,53 @@ void init_debug_baked_texture_menu(LLMenuGL* menu) menu->createJumpKeys(); } +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-1.0.0g +void init_debug_rlva_menu(LLMenuGL* menu) +{ + // Experimental feature toggles + { + /* + #ifdef RLV_EXPERIMENTAL + LLMenuGL* sub_menu = new LLMenuGL("Experimental"); + + menu->appendMenu(sub_menu); + #endif // RLV_EXPERIMENTAL + */ + } + + // Unit tests + { + #ifdef RLV_DEBUG_TESTS + init_debug_rlva_tests_menu(menu); + #endif // RLV_DEBUG_TESTS + } + + #ifdef RLV_EXTENSION_ENABLE_WEAR + if (gSavedSettings.controlExists(RLV_SETTING_ENABLEWEAR)) + { + menu->append(new LLMenuItemCheckGL("Enable Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLEWEAR)); + menu->appendSeparator(); + } + #endif // RLV_EXTENSION_ENABLE_WEAR + + #ifdef RLV_EXTENSION_HIDELOCKED + if ( (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDLAYER)) && + (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDATTACH)) ) + { + menu->append(new LLMenuItemCheckGL("Hide locked layers", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDLAYER)); + menu->append(new LLMenuItemCheckGL("Hide locked attachments", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDATTACH)); + //sub_menu->append(new LLMenuItemToggleGL("Hide locked inventory", &rlv_handler_t::fHideLockedInventory)); + menu->appendSeparator(); + } + #endif // RLV_EXTENSION_HIDELOCKED + + #ifdef RLV_EXTENSION_FLOATER_RESTRICTIONS + // TODO-RLVa: figure out a way to tell if floater_rlv_behaviour.xml exists + menu->append(new LLMenuItemCallGL("Restrictions...", RlvFloaterBehaviour::show, NULL, NULL)); + #endif // RLV_EXTENSION_FLOATER_RESTRICTIONS +} +// [/RLVa:KB] + void init_server_menu(LLMenuGL* menu) { { @@ -1521,6 +1596,16 @@ class LLObjectTouch : public view_listener_t LLPickInfo pick = LLToolPie::getInstance()->getPick(); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f + // TODO-RLVa: this code is rather redundant since we'll never get an active selection to show a pie menu for + // [msg->addVector3("Position", pick.mIntersection) <- see llDetectedTouchPos()] + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!object->isAttachment()) || (!object->permYouOwner())) && + (dist_vec_squared(gAgent.getPositionAgent(), pick.mIntersection) > 1.5f * 1.5f) ) + { + return true; // Can't touch in-world objects (or other avie's attachments) farther than 1.5m away under @fartouch=n + } +// [/RLVa:KB] + LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrab); @@ -1569,6 +1654,14 @@ class LLObjectEnableTouch : public view_listener_t { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); bool new_value = obj && obj->flagHandleTouch(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.0f + // TODO-RLVa: this code is rather redundant since we'll never get an active selection to show a pie menu for + if ( (new_value) && (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && ((!obj->isAttachment()) || (!obj->permYouOwner())) && + (dist_vec_squared(gAgent.getPositionAgent(), LLToolPie::getInstance()->getPick().mIntersection) > 1.5f * 1.5f) ) + { + new_value = false; // Can't touch in-world objects (or other avie's attachments) farther than 1.5m away under @fartouch=n + } +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label based on the node touch name if available. @@ -1637,6 +1730,14 @@ class LLObjectOpen : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + // TODO-RLVa: shouldn't we be checking for fartouch here as well? + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + return true; + } +// [/RLVa:KB] + return handle_object_open(); } }; @@ -1655,6 +1756,12 @@ class LLObjectEnableOpen : public view_listener_t if (!root) new_value = false; else new_value = root->allowOpen(); } + +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) | Modified: RLVa-1.0.0b + // TODO-RLV: shouldn't we be checking for fartouch here as well? (and LLViewerObject::allowOpen() makes this redundant?) + new_value &= !gRlvHandler.hasBehaviour(RLV_BHVR_EDIT); +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -1716,7 +1823,13 @@ bool toggle_build_mode() } } - +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (LLSelectMgr::getInstance()) ) + { + LLSelectMgr::getInstance()->deselectAll(); + } +// [/RLVa:KB] + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); @@ -1816,6 +1929,23 @@ class LLObjectEdit : public view_listener_t { LLViewerParcelMgr::getInstance()->deselectLand(); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f + if (rlv_handler_t::isEnabled()) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + return true; // Can't edit any object under @edit=n + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) && + (SELECT_TYPE_WORLD == LLSelectMgr::getInstance()->getSelection()->getSelectType()) && + (dist_vec_squared(gAgent.getPositionAgent(), LLToolPie::getInstance()->getPick().mIntersection) > 1.5f * 1.5f) ) + { + // TODO-RLVa: this code is rather redundant since we'll never get an active selection to show a pie menu for + return true; // Can't edit in-world objects farther than 1.5m away under @fartouch=n + } + } +// [/RLVa:KB] + if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit()) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); @@ -1965,6 +2095,22 @@ class LLEnableEdit : public view_listener_t enable = LLViewerParcelMgr::getInstance()->agentCanBuild() || LLSelectMgr::getInstance()->getSelection()->isAttachment(); } +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // TODO-RLV: include fartouch here? + if ( (rlv_handler_t::isEnabled()) && (enable) ) + { + // We have no way of knowing whether we're being called for "Create" or for "Edit", but we can + // make an educated guess based on the currently active selection which puts us halfway there. + BOOL fActiveSelection = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) + enable = false; // Edit and rez restricted, disable them both + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (fActiveSelection) ) + enable = false; // Edit restricted and there's an active selection => disable Edit and Create + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && (!fActiveSelection) ) + enable = false; // Rez restricted and there's no active selection => disable Create + } +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(enable); return true; } @@ -1992,7 +2138,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getObject()) +// if (attachment->getObject()) +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0c + if ( (attachment->getObject()) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.isDetachable(curiter->first)) ) ) +// [/RLVa:KB] { new_value = true; break; @@ -2039,6 +2188,9 @@ class LLObjectEnableMute : public view_listener_t BOOL is_linden = lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden"); BOOL is_self = avatar->isSelf(); new_value = !is_linden && !is_self; +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] } } gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); @@ -2059,6 +2211,12 @@ class LLObjectMute : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(object); if (avatar) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; // Fallback code [see LLObjectEnableMute::handleEvent()] + } +// [/RLVa:KB] id = avatar->getID(); LLNameValue *firstname = avatar->getNVPair("FirstName"); @@ -2107,8 +2265,155 @@ class LLObjectMute : public view_listener_t } }; +class LLObjectEnableCopyUUID : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + bool new_value = (object != NULL); + + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + return true; + } +}; + +class LLObjectCopyUUID : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if (!object) return true; + + LLUUID id = object->getID(); + + char buffer[UUID_STR_LENGTH]; + id.toString(buffer); + + + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); + + LLSelectMgr::getInstance()->deselectAll(); + return true; + } +}; + + +class LLObjectEnableExport : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + bool new_value = (object != NULL); + if (new_value) + { + LLVOAvatar* avatar = find_avatar_from_object(object); + new_value = (avatar == NULL); + } + if(new_value) + { + + struct ff : public LLSelectedNodeFunctor + { + ff(const LLSD& data) : LLSelectedNodeFunctor() + ,userdata(data) + { + + } + const LLSD& userdata; + virtual bool apply(LLSelectNode* node) + { + if(gAgent.getID()!=node->mPermissions->getCreator()) + { + llwarns<<"Incorrect permission to export"<getSelection()->applyToNodes(the_ff,false)) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(true); + } + else + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(false); + } + return true; + } + + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + return true; +#else + } + gMenuHolder->findControl(userdata["control"].asString())->setValue(true); + return true; +#endif + + } +}; + +class LLObjectExport : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (!object) return true; + + LLVOAvatar* avatar = find_avatar_from_object(object); + + if (!avatar) + { + primbackup::getInstance()->pre_export_object(); + } + + return true; + } +}; + + +class LLObjectEnableImport : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(TRUE); + return true; + } +}; + +class LLObjectImport : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + primbackup::getInstance()->import_object(FALSE); + return true; + } +}; + +class LLObjectImportUpload : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + primbackup::getInstance()->import_object(TRUE); + return true; + } +}; + bool handle_go_to() { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && gAgent.forwardGrabbed() && (gRlvHandler.hasLockedAttachment()) ) + { + return true; + } +// [/RLVa:KB] + + // JAMESDEBUG try simulator autopilot + std::vector strings; + std::string val; LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal; if (gSavedSettings.getBOOL("DoubleClickTeleport")) { @@ -2200,6 +2505,12 @@ class LLAvatarFreeze : public view_listener_t { LLUUID* avatar_id = new LLUUID( avatar->getID() ); std::string fullname = avatar->getFullname(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!fullname.empty()) ) + { + fullname = gRlvHandler.getAnonym(fullname); + } +// [/RLVa:KB] if (!fullname.empty()) { @@ -2225,7 +2536,11 @@ class LLAvatarVisibleDebug : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gAgent.isGodlike(); + //bool new_value = gAgent.isGodlike(); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + // TODO-RLVa: can you actually use this to cheat anything? + bool new_value = gAgent.isGodlike() && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -2337,6 +2652,12 @@ class LLAvatarEject : public view_listener_t MenuCallbackData *data = new MenuCallbackData; (*data).avatar_id = avatar->getID(); std::string fullname = avatar->getFullname(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (!fullname.empty()) ) + { + fullname = gRlvHandler.getAnonym(fullname); + } +// [/RLVa:KB] const LLVector3d& pos = avatar->getPositionGlobal(); LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel(); @@ -2418,6 +2739,13 @@ class LLAvatarGiveCard : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; + } +// [/RLVa:KB] + llinfos << "handle_give_card()" << llendl; LLViewerObject* dest = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if(dest && dest->isAvatar()) @@ -2667,6 +2995,13 @@ class LLSelfStandUp : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) + { + return true; + } +// [/RLVa:KB] + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); return true; } @@ -2676,7 +3011,10 @@ class LLSelfEnableStandUp : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting; +// bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting; +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -2851,6 +3189,11 @@ class LLAvatarEnableAddFriend : public view_listener_t { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); bool new_value = avatar && !is_agent_friend(avatar->getID()); + +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -2909,6 +3252,15 @@ bool handle_sit_or_stand() return true; } +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && + ( ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->mIsSitting)) || + (gRlvHandler.hasBehaviour(RLV_BHVR_SIT)) ) ) + { + return true; + } +// [/RLVa:KB] + if (sitting_on_selection()) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); @@ -2919,6 +3271,15 @@ bool handle_sit_or_stand() if (object && object->getPCode() == LL_PCODE_VOLUME) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0g + if ( (rlv_handler_t::isEnabled()) && + ((gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) || (gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH))) && + (dist_vec_squared(gAgent.getPositionGlobal(), object->getPositionGlobal() + LLVector3d(pick.mObjectOffset)) > 1.5f * 1.5f) ) + { + return true; // Don't allow sitting farther away than 1.5m under @sittp=n or @fartouch=n + } +// [/RLVa:KB] + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -2956,6 +3317,13 @@ class LLLandSit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) + { + return true; + } +// [/RLVa:KB] + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); LLViewerParcelMgr::getInstance()->deselectLand(); @@ -3266,6 +3634,14 @@ class LLEditDuplicate : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && + (LLEditMenuHandler::gEditMenuHandler == LLSelectMgr::getInstance()) ) + { + return true; + } +// [/RLVa:KB] + if(LLEditMenuHandler::gEditMenuHandler) { LLEditMenuHandler::gEditMenuHandler->duplicate(); @@ -3279,6 +3655,13 @@ class LLEditEnableDuplicate : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate(); +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (new_value) && (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && + (LLEditMenuHandler::gEditMenuHandler == LLSelectMgr::getInstance()) ) + { + new_value = false; + } +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -3664,6 +4047,11 @@ class LLToolsTakeCopy : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-1.0.0b + // NOTE: we need to handle "Take Copy" because it will force a sim-side unsit if we're sitting on the selection, + // but we do want to allow "Take Copy" under @rez=n so that's why we explicitly check for @unsit=n here + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (!rlvCanDeleteOrReturn()) ) return true; +// [/RLVa:KB] const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); derez_objects(DRD_ACQUIRE_TO_AGENT_INVENTORY, category_id); @@ -3679,6 +4067,9 @@ class LLObjectReturn : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) return true; +// [/RLVa:KB] mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); @@ -3748,6 +4139,14 @@ class LLObjectEnableReturn : public view_listener_t } } #endif + +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (new_value) && (rlv_handler_t::isEnabled()) ) + { + new_value = rlvCanDeleteOrReturn(); + } +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -3769,6 +4168,13 @@ void handle_take() return; } +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + return; + } +// [/RLVa:KB] + BOOL you_own_everything = TRUE; BOOL locked_but_takeable_object = FALSE; LLUUID category_id; @@ -3890,6 +4296,13 @@ BOOL enable_take() return FALSE; } +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + return FALSE; + } +// [/RLVa:KB] + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { @@ -4212,6 +4625,21 @@ class LLToolsEnableUnlink : public view_listener_t new_value = true; } } + +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0g + // The user might not be allowed to unlink this object due to RLV settings, + // because it would unsit them if they are sitting on the object. + if ( (new_value) && (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && + (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->mIsSitting) ) + { + // Allow if the avie isn't sitting on any of the selected objects + LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsSittingOn func(gAgent.getAvatarObject()->getRoot()); + if (handleSel->getFirstRootNode(&func, TRUE)) + new_value = false; + } +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4221,6 +4649,19 @@ class LLToolsUnlink : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0g + // The user might not be allowed to unlink this object due to RLV settings, + // because it would unsit them if they are sitting on the object. + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->mIsSitting) ) + { + // Allow if the avie isn't sitting on any of the selected objects + LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); + RlvSelectIsSittingOn func(gAgent.getAvatarObject()->getRoot()); + if (handleSel->getFirstRootNode(&func, TRUE)) + return true; + } +// [/RLVa:KB] + LLSelectMgr::getInstance()->sendDelink(); return true; } @@ -4240,6 +4681,13 @@ class LLToolsReleaseKeys : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + return true; + } +// [/RLVa:KB] + gAgent.forceReleaseControls(); return true; @@ -4250,7 +4698,11 @@ class LLToolsEnableReleaseKeys : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue( gAgent.anyControlGrabbed() ); +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + gMenuHolder->findControl(userdata["control"].asString())->setValue( + gAgent.anyControlGrabbed() && ( (!rlv_handler_t::isEnabled()) || (!gRlvHandler.hasLockedAttachment() ) ) ); +// [/RLVa:KB] + //gMenuHolder->findControl(userdata["control"].asString())->setValue( gAgent.anyControlGrabbed() ); return true; } }; @@ -4358,6 +4810,15 @@ class LLEditEnableDelete : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete(); + +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // NOTE: we want to disable delete on objects but not disable delete on text + if ( (new_value) && (rlv_handler_t::isEnabled()) && (LLEditMenuHandler::gEditMenuHandler == LLSelectMgr::getInstance()) ) + { + new_value = rlvCanDeleteOrReturn(); + } +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4367,6 +4828,15 @@ class LLEditDelete : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + // NOTE: we want to disable delete on objects but not disable delete on text + if ( (rlv_handler_t::isEnabled()) && (LLEditMenuHandler::gEditMenuHandler == LLSelectMgr::getInstance()) && + (!rlvCanDeleteOrReturn()) ) + { + return true; + } +// [/RLVa:KB] + // If a text field can do a deletion, it gets precedence over deleting // an object in the world. if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete()) @@ -4398,6 +4868,12 @@ class LLObjectEnableDelete : public view_listener_t # endif LLSelectMgr::getInstance()->canDoDelete(); #endif +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (new_value) && (rlv_handler_t::isEnabled()) ) + { + new_value = rlvCanDeleteOrReturn(); + } +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -4416,6 +4892,13 @@ class LLObjectDelete : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + return true; + } +// [/RLVa:KB] + if (LLSelectMgr::getInstance()) { LLSelectMgr::getInstance()->doDelete(); @@ -4765,6 +5248,12 @@ class LLWorldCreateLandmark : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return true; + } +// [/RLVa:KB] LLViewerRegion* agent_region = gAgent.getRegion(); if(!agent_region) { @@ -4872,6 +5361,13 @@ class LLAvatarInviteToGroup : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; + } +// [/RLVa:KB] + LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar) { @@ -4885,6 +5381,13 @@ class LLAvatarAddFriend : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; // Fallback code [see LLAvatarEnableAddFriend::handleEvent()] + } +// [/RLVa:KB] + LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar && !is_agent_friend(avatar->getID())) { @@ -4972,6 +5475,12 @@ class LLEnablePayObject : public view_listener_t } } } + +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + // Don't enable "Pay..." on the avatar pie menu under @shownames=n + new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (avatar == NULL); +// [/RLVa:KB] + gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -5160,6 +5669,12 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "buy land") { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + return true; + } +// [/RLVa:KB] if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); @@ -5341,6 +5856,13 @@ class LLShowAgentProfile : public view_listener_t } else if (userdata.asString() == "hit object") { +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; + } +// [/RLVa:KB] + LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (objectp) { @@ -5400,6 +5922,13 @@ class LLLandEdit : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) ) + { + return true; + } +// [/RLVa:KB] + if (gAgent.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) { // zoom in if we're looking at the avatar @@ -5484,6 +6013,18 @@ private: LLViewerJointAttachment* attachment_point = NULL; if (index > 0) attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL); + +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && + ( ((index == 0) && (gRlvHandler.hasLockedAttachment())) || // Can't wear on default attach point + ((index > 0) && (!gRlvHandler.isDetachable(attachment_point->getObject()))) || // Can't replace locked attachment + (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) ) // Attach on rezzed object == "Take" + { + setObjectSelection(NULL); // Clear the selection or it'll get stuck + return true; + } +// [/RLVa:KB] + confirm_replace_attachment(0, attachment_point); } return true; @@ -5591,6 +6132,24 @@ class LLAttachmentDrop : public view_listener_t return true; } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if (rlv_handler_t::isEnabled()) + { + if (gRlvHandler.hasLockedAttachment()) + { + // NOTE: copy/paste of the code in enable_detach() + LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection(); + RlvSelectHasLockedAttach functor; + if ( (hSelect->isAttachment()) && (hSelect->getFirstRootNode(&functor, FALSE)) ) + return true; + } + else if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + { + return true; + } + } +// [/RLVa:KB] + // The sendDropAttachment() method works on the list of selected // objects. Thus we need to clear the list, make sure it only // contains the object the user clicked, send the message, @@ -5609,6 +6168,13 @@ void handle_detach_from_avatar(void* user_data) if (attached_object) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-0.2.0d + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isDetachable(attached_object)) ) + { + return; + } +// [/RLVa:KB] + gMessageSystem->newMessage("ObjectDetach"); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); @@ -5691,6 +6257,17 @@ class LLAttachmentDetach : public view_listener_t return true; } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // NOTE: copy/paste of the code in enable_detach() + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection(); + RlvSelectHasLockedAttach functor; + if ( (hSelect->isAttachment()) && (hSelect->getFirstRootNode(&functor, FALSE)) ) + return FALSE; + } +// [/RLVa:KB] + // The sendDetach() method works on the list of selected // objects. Thus we need to clear the list, make sure it only // contains the object the user clicked, send the message, @@ -5774,7 +6351,10 @@ class LLAttachmentEnableDrop : public view_listener_t } //now check to make sure that the item is actually in the inventory before we enable dropping it - bool new_value = enable_detach(NULL) && can_build && item; +// bool new_value = enable_detach(NULL) && can_build && item; +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + bool new_value = enable_detach(NULL) && can_build && item && (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -5794,6 +6374,20 @@ BOOL enable_detach(void*) // ...if it's you, good to detach if (avatar->getID() == gAgent.getID()) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // NOTE: this code is reused as-is in LLAttachmentDetach::handleEvent() and LLAttachmentDrop::handleEvent() + // so any changes here should be reflected there as well (I think it's in a number of other places as well by now) + + // RELEASE-RLVa: LLSelectMgr::sendDetach() and LLSelectMgr::sendDropAttachment() call sendListToRegions with + // SEND_ONLY_ROOTS so we only need to examine the roots which saves us time + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLObjectSelectionHandle hSelect = LLSelectMgr::getInstance()->getSelection(); + RlvSelectHasLockedAttach functor; + if ( (hSelect->isAttachment()) && (hSelect->getFirstRootNode(&functor, FALSE)) ) + return FALSE; + } +// [/RLVa:KB] return TRUE; } @@ -5816,6 +6410,25 @@ class LLAttachmentEnableDetach : public view_listener_t // Used to tell if the selected object can be attached to your avatar. BOOL object_selected_and_point_valid(void *user_data) { +// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b) + if (rlv_handler_t::isEnabled()) + { + // RELEASE-RLVa: look at the caller graph for this function on every new release + // -> 1.22.11 and 1.23.4 + // - object_is_wearable() => dead code [user_data == NULL => default attach point => OK!] + // - LLObjectEnableWear::handleEvent() => Rezzed prim / right-click / "Wear" [user_data == NULL => see above] + // - enabler set up in LLVOAvatar::buildCharacter() => Rezzed prim / right-click / "Attach >" [user_data == pAttachPt] + // - enabler set up in LLVOAvatar::buildCharacter() => Rezzed prim / Edit menu / "Attach Object" [user_data == pAttachPt] + LLViewerJointAttachment* pAttachPt = (LLViewerJointAttachment*)user_data; + if ( ((!pAttachPt) && (gRlvHandler.hasLockedAttachment())) || // Don't allow attach to default attach point + ((pAttachPt) && (!gRlvHandler.isDetachable(pAttachPt->getObject()))) || // Don't allow replacing of locked attachment + (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) ) // Attaching a rezzed object == "Take" + { + return FALSE; + } + } +// [/RLVa:KB] + //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); @@ -5883,7 +6496,13 @@ BOOL object_attached(void *user_data) { LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - return attachment->getObject() != NULL; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + return ( + (attachment->getObject() != NULL) && + ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.isDetachable(attachment->getObject())) ) + ); +// [/RLVa:KB] +// return attachment->getObject() != NULL; } class LLAvatarSendIM : public view_listener_t @@ -5891,6 +6510,12 @@ class LLAvatarSendIM : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + return true; + } +// [/RLVa:KB] if(avatar) { std::string name("IM"); @@ -6026,6 +6651,16 @@ class LLToolsSelectedScriptAction : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLObjectSelectionHandle selectHandle = LLSelectMgr::getInstance()->getSelection(); + RlvSelectHasLockedAttach functor; + if ( (selectHandle->isAttachment()) && (selectHandle->getFirstNode(&functor)) ) + return true; + } +// [/RLVa:KB] + std::string action = userdata.asString(); if (action == "compile mono") { @@ -6110,12 +6745,30 @@ void handle_dump_image_list(void*) void handle_test_male(void*) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && + ( (gRlvHandler.hasLockedAttachment()) || + (gRlvHandler.hasBehaviour(RLV_BHVR_ADDOUTFIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_REMOUTFIT)) ) ) + { + return; + } +// [/RLVa:KB] + wear_outfit_by_name("Male Shape & Outfit"); //gGestureList.requestResetFromServer( TRUE ); } void handle_test_female(void*) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && + ( (gRlvHandler.hasLockedAttachment()) || + (gRlvHandler.hasBehaviour(RLV_BHVR_ADDOUTFIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_REMOUTFIT)) ) ) + { + return; + } +// [/RLVa:KB] + wear_outfit_by_name("Female Shape & Outfit"); //gGestureList.requestResetFromServer( FALSE ); } @@ -6258,6 +6911,22 @@ BOOL enable_more_than_one_selected(void* ) static bool is_editable_selected() { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) | Modified: RLVa-1.0.0c + // RELEASE-RLVa: check that this still isn't called by anything but script actions in the Tools menu + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedAttachment()) ) + { + LLObjectSelectionHandle selectHandle = LLSelectMgr::getInstance()->getSelection(); + + // NOTE: this is called for 5 different menu items so we'll trade accuracy for efficiency and only + // examine root nodes (LLToolsSelectedScriptAction::handleEvent() will catch what we miss) + RlvSelectHasLockedAttach functor; + if ( (selectHandle->isAttachment()) && (selectHandle->getFirstRootNode(&functor)) ) + { + return false; + } + } +// [/RLVa:KB] + return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); } @@ -6304,7 +6973,12 @@ class LLToolsEnableTakeCopy : public view_listener_t { virtual bool apply(LLViewerObject* obj) { - return (!obj->permCopy() || obj->isAttachment()); +// return (!obj->permCopy() || obj->isAttachment()); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + return (!obj->permCopy() || obj->isAttachment()) || + ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && + (gAgent.getAvatarObject()->getRoot() == obj) ); +// [/RLVa:KB] } } func; const bool firstonly = true; @@ -6507,6 +7181,9 @@ class LLWorldEnableCreateLandmark : public view_listener_t { bool new_value = gAgent.isGodlike() || (gAgent.getRegion() && gAgent.getRegion()->getAllowLandmark()); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + new_value &= !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); +// [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; } @@ -6559,7 +7236,11 @@ BOOL enable_god_customer_service(void*) BOOL enable_god_basic(void*) { - return gAgent.getGodLevel() > GOD_NOT; +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + // RELEASE-RLVa: check that this function isn't used for anything other than to enable/disable showing the "God Tools..." floater + return (gAgent.getGodLevel() > GOD_NOT) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); +// [/RLVa:KB] + //return gAgent.getGodLevel() > GOD_NOT; } #if 0 // 1.9.2 @@ -7070,6 +7751,13 @@ class LLViewHighlightTransparent : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) + { + return true; + } +// [/RLVa:KB] + LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha; return true; } @@ -7117,6 +7805,13 @@ class LLViewShowHUDAttachments : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (LLPipeline::sShowHUDAttachments) && (rlv_handler_t::isEnabled()) && (gRlvHandler.hasLockedHUD()) ) + { + return true; + } +// [/RLVa:KB] + LLPipeline::sShowHUDAttachments = !LLPipeline::sShowHUDAttachments; return true; } @@ -7175,6 +7870,15 @@ class LLEditEnableTakeOff : public view_listener_t { new_value = LLAgent::selfHasWearable((void *)WT_SKIRT); } + +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) + // Why aren't they using LLWearable::typeNameToType()? *confuzzled* + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.isRemovable(LLWearable::typeNameToType(clothing))) ) + { + new_value = false; + } +// [/RLVa:KB] + gMenuHolder->findControl(control_name)->setValue(new_value); return true; } @@ -7272,6 +7976,13 @@ class LLWorldEnvSettings : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) + { + return true; + } +// [/RLVa:KB] + std::string tod = userdata.asString(); LLVector3 sun_direction; @@ -7349,6 +8060,13 @@ class LLWorldWaterSettings : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) + { + return true; + } +// [/RLVa:KB] + // if not there or is hidden, show it if( !LLFloaterWater::isOpen() || !LLFloaterWater::instance()->getVisible()) { @@ -7379,6 +8097,13 @@ class LLWorldDayCycle : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) + { + return true; + } +// [/RLVa:KB] + LLFloaterDayCycle::show(); return true; } @@ -9613,6 +10338,49 @@ class LLAvatarReportAbuse : public view_listener_t +/////////////// +// RLVa Main // +/////////////// + + +class RLVaMainToggle : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + rlvDbgToggleEnabled(NULL); + return true; + } +}; + +class RLVaMainCheck : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + bool new_value = rlvDbgGetEnabled(NULL); + std::string control_name = userdata["control"].asString(); + gMenuHolder->findControl(control_name)->setValue(new_value); + return true; + } +}; + + + +//////////////////// +// RLVa BEHAVIORS // +//////////////////// + + +class RLVaBehaviorsShow : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + RlvFloaterBehaviour::show(NULL); + return true; + } +}; + + + static void addMenu(view_listener_t *menu, const char *name) { sMenus.push_back(menu); @@ -9778,6 +10546,10 @@ void initialize_menus() addMenu(new LLObjectBuy(), "Object.Buy"); addMenu(new LLObjectEdit(), "Object.Edit"); addMenu(new LLObjectInspect(), "Object.Inspect"); + addMenu(new LLObjectCopyUUID(), "Object.CopyUUID"); + addMenu(new LLObjectExport(), "Object.Export"); + addMenu(new LLObjectImport(), "Object.Import"); + addMenu(new LLObjectImportUpload(), "Object.ImportUpload"); addMenu(new LLObjectEnableOpen(), "Object.EnableOpen"); addMenu(new LLObjectEnableTouch(), "Object.EnableTouch"); @@ -9788,6 +10560,9 @@ void initialize_menus() addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse"); addMenu(new LLObjectEnableMute(), "Object.EnableMute"); addMenu(new LLObjectEnableBuy(), "Object.EnableBuy"); + addMenu(new LLObjectEnableCopyUUID(), "Object.EnableCopyUUID"); + addMenu(new LLObjectEnableExport(), "Object.EnableExport"); + addMenu(new LLObjectEnableImport(), "Object.EnableImport"); /*addMenu(new LLObjectVisibleTouch(), "Object.VisibleTouch"); addMenu(new LLObjectVisibleCustomTouch(), "Object.VisibleCustomTouch"); @@ -9988,4 +10763,11 @@ void initialize_menus() addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions"); addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus"); addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus"); + + + // RLVa + addMenu(new RLVaMainToggle(), "RLVa.Main.Toggle"); + addMenu(new RLVaMainCheck(), "RLVa.Main.Enabled"); + addMenu(new RLVaBehaviorsShow(), "RLVa.Behaviors.Show"); + } diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 815dc49..e326dac 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -140,6 +140,11 @@ #include "llwindebug.h" // For the invalid message handler #endif +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) +#include "llfloateravatarinfo.h" +extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp +// [/RLVa:KB] + // // Constants // @@ -1007,8 +1012,17 @@ void inventory_offer_callback(S32 button, void* user_data) std::string first_name, last_name; if (gCacheName->getName(info->mFromID, first_name, last_name)) { - from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; - chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + std::string full_name = first_name + " " + last_name; + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) ) + { + full_name = gRlvHandler.getAnonym(full_name); + } + from_string = std::string("An object named '") + info->mFromName + "' owned by " + full_name; + chatHistory_string = info->mFromName + " owned by " + full_name; +// [/RLVa:KB] + //from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; + //chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; } else { @@ -1027,6 +1041,21 @@ void inventory_offer_callback(S32 button, void* user_data) switch(button) { case IOR_ACCEPT: +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-0.2.2a + // Only change the inventory offer's destination folder to the shared root if: + // - the user has enabled the feature + // - the inventory offer came from a script (and specifies a folder) + // - the name starts with the prefix [mDesc format (quotes are part of the string): "[OBJECTNAME] ( http://slurl.com/... )"] + if ( (rlv_handler_t::isEnabled()) && (!RlvSettings::getForbidGiveToRLV()) && + (IM_TASK_INVENTORY_OFFERED == info->mIM) && (LLAssetType::AT_CATEGORY == info->mType) && (info->mDesc.find(RLV_PUTINV_PREFIX) == 1) ) + { + LLViewerInventoryCategory* pRlvRoot = gRlvHandler.getSharedRoot(); + if (pRlvRoot) + { + info->mFolderID = pRlvRoot->getUUID(); + } + } +// [/RLVa:KB] // ACCEPT. The math for the dialog works, because the accept // for inventory_offered, task_inventory_offer or // group_notice_inventory is 1 greater than the offer integer value. @@ -1189,6 +1218,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) if(indx >= 0) { LLStringUtil::truncate(msg, indx); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a + // TODO-RLVa: needs revisiting when LL saves open notifications to disk to accept them on the next relog + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + gRlvHandler.filterLocation(info->mDesc); + } +// [/RLVa:KB] } LLStringUtil::format_map_t args; @@ -1229,6 +1265,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) std::string first_name, last_name; if (gCacheName->getName(info->mFromID, first_name, last_name)) { +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) ) + { + first_name = gRlvHandler.getAnonym(first_name.append(" ").append(last_name)); + last_name.clear(); + } +// [/RLVa:KB] args["[FIRST]"] = first_name; args["[LAST]"] = last_name; name_found = TRUE; @@ -1243,7 +1286,13 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) else { // *TODO:translate -> [FIRST] [LAST] - args["[NAME]"] = info->mFromName; +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(info->mFromID)) ) + { + args["[NAME]"] = gRlvHandler.getAnonym(info->mFromName); + } +// [/RLVa:KB] + //args["[NAME]"] = info->mFromName; LLNotifyBox::showXml("UserGiveItem", args, &inventory_offer_callback, (void*)info); } @@ -1411,7 +1460,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // do nothing -- don't distract newbies in // Prelude with global IMs } - else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) ) + { + rlvSendBusyMessage(from_id, gRlvHandler.getVersionString(), session_id); + // We won't receive a typing stop message, so do that manually (see comment at the end of LLFloaterIMPanel::sendMsg) + LLPointer im_info = new LLIMInfo(gMessageSystem); + gIMMgr->processIMTypingStop(im_info); + } +// [/RLVa:KB] +// else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + else if ( (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, from_id))) ) +// [/RLVa:KB] { // return a standard "busy" message, but only do it to online IM // (i.e. not other auto responses and not store-and-forward IM) @@ -1468,6 +1530,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else if (to_id.isNull()) { +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + // Filter region messages that weren't sent by a Linden + if ( (rlv_handler_t::isEnabled()) && (LLMuteList::getInstance()) && + (!LLMuteList::getInstance()->isLinden(name)) && (from_id != gAgent.getID()) ) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + gRlvHandler.filterLocation(message); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + name = gRlvHandler.getAnonym(name); + gRlvHandler.filterNames(message); + } + } +// [/RLVa:KB] + // Message to everyone from GOD args["[NAME]"] = name; args["[MESSAGE]"] = message; @@ -1483,6 +1560,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) else { // standard message, not from system +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) ) + { + rlvSendBusyMessage(from_id, rlv_handler_t::cstrMsgRecvIM, session_id); + + message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM; + } +// [/RLVa:KB] + std::string saved; if(offline == IM_OFFLINE) { @@ -1688,6 +1774,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; info->mType = (LLAssetType::EType) bucketp->asset_type; info->mObjectID = bucketp->object_id; + +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (gRlvHandler.isAgentNearby(from_id)) ) + { + name = gRlvHandler.getAnonym(name); + } +// [/RLVa:KB] } else { @@ -1732,13 +1825,23 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { - args["[NAME]"] = name; +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b + bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && + (gRlvHandler.isAgentNearby(from_id)) && (!gAvatarInfoInstances.checkData(from_id)); + args["[NAME]"] = (!fRlvObfuscate) ? name : gRlvHandler.getAnonym(name); +// [/RLVa:KB] +// args["[NAME]"] = name; LLNotifyBox::showXml("InventoryAccepted", args); break; } case IM_INVENTORY_DECLINED: { - args["[NAME]"] = name; +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b + bool fRlvObfuscate = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && + (gRlvHandler.isAgentNearby(from_id)) && (!gAvatarInfoInstances.checkData(from_id)); + args["[NAME]"] = (!fRlvObfuscate) ? name : gRlvHandler.getAnonym(name); +// [/RLVa:KB] +// args["[NAME]"] = name; LLNotifyBox::showXml("InventoryDeclined", args); break; } @@ -1772,6 +1875,22 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) ) + { + if (gAgent.isInGroup(session_id)) + { + if (!gRlvHandler.isException(RLV_BHVR_RECVIM, session_id)) + return; + } + else + { + if ( (from_id != gAgent.getID()) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) ) + message = message.substr(0, message_offset) + rlv_handler_t::cstrBlockedRecvIM; + } + } +// [/RLVa:KB] + // standard message, not from system std::string saved; if(offline == IM_OFFLINE) @@ -1854,6 +1973,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } { +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) + // TODO-RLVa: what actually generates this? + if (rlv_handler_t::isEnabled()) + { + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + gRlvHandler.filterLocation(message); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + gRlvHandler.filterNames(message); + } +// [/RLVa:KB] + // Construct a viewer alert for this message. args["[NAME]"] = name; args["[MESSAGE]"] = message; @@ -1886,12 +2016,48 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - // *TODO:translate -> [FIRST] [LAST] (maybe) - LLLureInfo* info = new LLLureInfo(from_id, session_id, FALSE); - args["[NAME]"] = name; - args["[MESSAGE]"] = message; - LLNotifyBox::showXml("OfferTeleport", args, - lure_callback, (void*)info); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) + if (rlv_handler_t::isEnabled()) + { + // Disallow if: 1) @tplure=n restricted (sender isn't an exception), or 2) @unsit=n restricted and currently sitting + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLURE)) && (!gRlvHandler.isException(RLV_BHVR_TPLURE, from_id)) ) || + ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (pAvatar) && (pAvatar->mIsSitting) ) ) + { + rlvSendBusyMessage(from_id, rlv_handler_t::cstrMsgTpLure); + return; + } + + // Censor teleport message if: 1) @revcim=n restricted (sender isn't an exception), or 2) @showloc=n restricted + if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) && (!gRlvHandler.isException(RLV_BHVR_RECVIM, from_id)) ) || + (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + { + message = rlv_handler_t::cstrHidden; + } + } +// [/RLVa:KB] + +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b + if ( (rlv_handler_t::isEnabled()) && + ((gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)) || (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id))) ) + { + gRlvHandler.setCanCancelTp(false); + // (see IM_GODLIKE_LURE_USER below) + LLLureInfo* info = new LLLureInfo(from_id, session_id, TRUE); + lure_callback(0, (void*)info); + } + else + { +// [/RLVa:KB] + // *TODO:translate -> [FIRST] [LAST] (maybe) + LLLureInfo* info = new LLLureInfo(from_id, session_id, FALSE); + args["[NAME]"] = name; + args["[MESSAGE]"] = message; + LLNotifyBox::showXml("OfferTeleport", args, + lure_callback, (void*)info); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.0b + } +// [/RLVa:KB] } } break; @@ -2236,8 +2402,13 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mPosAgent = chatter->getPositionAgent(); // Make swirly things only for talking objects. (not script debug messages, though) - if (chat.mSourceType == CHAT_SOURCE_OBJECT - && chat.mChatType != CHAT_TYPE_DEBUG_MSG) +// if (chat.mSourceType == CHAT_SOURCE_OBJECT +// && chat.mChatType != CHAT_TYPE_DEBUG_MSG) +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // Don't show swirly things for llOwnerSay() chat here because we handle those further down + if ( (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mChatType != CHAT_TYPE_DEBUG_MSG) && + ((!rlv_handler_t::isEnabled()) || (CHAT_TYPE_OWNER != chat.mChatType)) ) +// [/RLVa:KB] { LLPointer psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); psc->setSourceObject(chatter); @@ -2270,6 +2441,50 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) color.setVec(1.f,1.f,1.f,1.f); msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); +// [RLVa:KB] - Checked: 2009-08-04 (RLVa-1.0.1d) | Modified: RLVa-1.0.1d + if ( (rlv_handler_t::isEnabled()) && + (CHAT_TYPE_START != chat.mChatType) && (CHAT_TYPE_STOP != chat.mChatType) && (CHAT_TYPE_OWNER != chat.mChatType) ) + { + // NOTE: chatter can be NULL (may not have rezzed yet, or could be another avie's HUD attachment) + BOOL is_attachment = (chatter) ? chatter->isAttachment() : FALSE; + + // Filtering "rules": + // avatar => filter all avie text (unless it's this avie or they're an exemption) + // objects => filter everything except attachments this avie owns + if ( ((CHAT_SOURCE_AGENT == chat.mSourceType) && (from_id != gAgent.getID())) || (!is_owned_by_me) || (!is_attachment) ) + { + if (!rlvIsEmote(mesg)) + { + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVCHAT)) && (!gRlvHandler.isException(RLV_BHVR_RECVCHAT, from_id)) ) + gRlvHandler.filterChat(mesg, false); + } + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVEMOTE)) && (!gRlvHandler.isException(RLV_BHVR_RECVEMOTE, from_id)) ) + { + mesg = "/me ..."; + } + } + + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + { + // Filtering "rules": + // avatar => filter only their name (unless it's this avie) + // other => filter everything except attachments this avie owns but then we still do filter their text + if (CHAT_SOURCE_AGENT == chat.mSourceType) + { + if (chat.mFromID != gAgent.getID()) + from_name = gRlvHandler.getAnonym(from_name); + } + else + { + if ( (!is_owned_by_me) || (!is_attachment) ) + gRlvHandler.filterNames(from_name); + gRlvHandler.filterNames(mesg); + } + chat.mRlvNamesFiltered = true; + } + } +// [/RLVa:KB] + BOOL ircstyle = FALSE; // Look for IRC-style emotes here so chatbubbles work @@ -2334,8 +2549,76 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) case CHAT_TYPE_WHISPER: verb = " " + LLTrans::getString("whisper") + " "; break; - case CHAT_TYPE_DEBUG_MSG: case CHAT_TYPE_OWNER: +// [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e + if ( (rlv_handler_t::isEnabled()) && (mesg.length() > 3) && (RLV_CMD_PREFIX == mesg[0]) ) + { + mesg.erase(0, 1); + LLStringUtil::toLower(mesg); + + std::string strExecuted, strFailed, strRetained, *pstr; + + typedef boost::tokenizer > tokenizer; + boost::char_separator sep(",", "", boost::drop_empty_tokens); + tokenizer tokens(mesg, sep); + for (tokenizer::iterator itToken = tokens.begin(); itToken != tokens.end(); ++itToken) + { + if (LLStartUp::getStartupState() == STATE_STARTED) + { + if (gRlvHandler.processCommand(from_id, *itToken, true)) + pstr = &strExecuted; + else + pstr = &strFailed; + } + else + { + gRlvHandler.retainCommand(from_name, from_id, *itToken); + pstr = &strRetained; + } + + if (!pstr->empty()) + pstr->push_back(','); + pstr->append(*itToken); + } + + if (!RlvSettings::getDebug()) + return; + + // Silly people want comprehensive debug messages, blah :p + if ( (!strExecuted.empty()) && (strFailed.empty()) && (strRetained.empty()) ) + verb = " executes: @"; + else if ( (strExecuted.empty()) && (!strFailed.empty()) && (strRetained.empty()) ) + verb = " failed: @"; + else if ( (strExecuted.empty()) && (strFailed.empty()) && (!strRetained.empty()) ) + verb = " retained: @"; + else + { + verb = ": @"; + if (!strExecuted.empty()) + mesg += "\n - executed: @" + strExecuted; + if (!strFailed.empty()) + mesg += "\n - failed: @" + strFailed; + if (!strRetained.empty()) + mesg += "\n - retained: @" + strRetained; + } + + break; + } +// [/RLVa:KB] +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // Copy/paste from above + if ( (chatter) && (chat.mChatType != CHAT_TYPE_DEBUG_MSG) ) + { + LLPointer psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); + psc->setSourceObject(chatter); + psc->setColor(color); + //We set the particles to be owned by the object's owner, + //just in case they should be muted by the mute list + psc->setOwnerUUID(owner_id); + LLViewerPartSim::getInstance()->addPartSource(psc); + } +// [/RLVa:KB] + case CHAT_TYPE_DEBUG_MSG: case CHAT_TYPE_NORMAL: verb = ": "; break; @@ -2404,7 +2687,10 @@ void process_teleport_start(LLMessageSystem *msg, void**) U32 teleport_flags = 0x0; msg->getU32("Info", "TeleportFlags", teleport_flags); - if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) + //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b + if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) ) +// [/RLVa:KB] { gViewerWindow->setProgressCancelButtonVisible(FALSE); } @@ -2439,7 +2725,10 @@ void process_teleport_progress(LLMessageSystem* msg, void**) } U32 teleport_flags = 0x0; msg->getU32("Info", "TeleportFlags", teleport_flags); - if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) + //if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) +// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Added: RLVa-0.2.0b + if ( (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) || (!gRlvHandler.getCanCancelTp()) ) +// [/RLVa:KB] { gViewerWindow->setProgressCancelButtonVisible(FALSE); } @@ -2780,7 +3069,10 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) // know what you look like. gAgent.sendAgentSetAppearance(); - if (avatarp) +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if ( (avatarp) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) +// [/RLVa:KB] +// if (avatarp) { // Chat the "back" SLURL. (DEV-4907) LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL()); @@ -4360,7 +4652,13 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q if (viewregion) { // got the region, so include the region and 3d coordinates of the object - notice.setArg("[REGIONNAME]", viewregion->getName()); + notice.setArg("[REGIONNAME]", viewregion->getName()); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + { + notice.setArg("[REGIONNAME]", rlv_handler_t::cstrHiddenRegion); + } +// [/RLVa:KB] std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); notice.setArg("[REGIONPOS]", formatpos); @@ -4565,8 +4863,31 @@ void process_script_question(LLMessageSystem *msg, void **user_data) LLScriptQuestionCBData *cbdata = new LLScriptQuestionCBData(taskid, itemid, sender, questions, object_name, owner_name); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0e + S32 rlvQuestionsOther = questions; + + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour("acceptpermission")) ) + { + LLViewerObject* pObj = gObjectList.findObject(taskid); + if (pObj) + { + if (pObj->permYouOwner()) + { + // PERMISSION_TAKE_CONTROLS and PERMISSION_ATTACH are only auto-granted to objects this avie owns + rlvQuestionsOther &= ~(LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TAKE_CONTROLS] | + LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH]); + } + } + } + + if ( (!caution) && (!rlvQuestionsOther) ) + { + script_question_cb(0, cbdata); + } + else if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) +// [/RLVa:KB] // check whether cautions are even enabled or not - if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) + //if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) { if (caution) { @@ -4858,6 +5179,21 @@ void handle_lure_callback(S32 option, const std::string& text, void* userdata) if(0 == option) { +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b + bool fRlvCensorMessage = false; + if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) + { + for (LLDynamicArray::iterator it = invitees->begin(); it != invitees->end(); ++it) + { + if (!gRlvHandler.isException(RLV_BHVR_SENDIM, *it)) + { + fRlvCensorMessage = true; + break; + } + } + } +// [/RLVa:KB] + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_StartLure); msg->nextBlockFast(_PREHASH_AgentData); @@ -4865,7 +5201,10 @@ void handle_lure_callback(S32 option, const std::string& text, void* userdata) msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Info); msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. - msg->addStringFast(_PREHASH_Message, text); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0b + msg->addStringFast(_PREHASH_Message, (!fRlvCensorMessage) ? text : rlv_handler_t::cstrHidden); +// [/RLVa:KB] + //msg->addStringFast(_PREHASH_Message, text); for(LLDynamicArray::iterator itr = invitees->begin(); itr != invitees->end(); ++itr) { msg->nextBlockFast(_PREHASH_TargetData); @@ -4895,8 +5234,28 @@ void handle_lure(LLDynamicArray& ids) { LLDynamicArray* userdata = new LLDynamicArray(ids); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-1.0.0a + // Only allow offering teleports if everyone is a @tplure exception or able to map this avie under @showloc=n + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + for (LLDynamicArray::iterator it = ids.begin(); it != ids.end(); ++it) + { + const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(*it); + if ( (!gRlvHandler.isException(RLV_BHVR_TPLURE, *it)) && + ((!pBuddyInfo) || (!pBuddyInfo->isOnline()) || (!pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))) ) + { + delete userdata; + return; + } + } + } +// [/RLVa:KB] + LLStringUtil::format_map_t edit_args; - edit_args["[REGION]"] = gAgent.getRegion()->getName(); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-1.0.0a + edit_args["[REGION]"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? gAgent.getRegion()->getName() : rlv_handler_t::cstrHidden; +// [/RLVa:KB] + //edit_args["[REGION]"] = gAgent.getRegion()->getName(); if (gAgent.isGodlike()) { gViewerWindow->alertXmlEditText("OfferTeleportFromGod", edit_args, diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp index ca7055a..102b135 100644 --- a/linden/indra/newview/llviewerobject.cpp +++ b/linden/indra/newview/llviewerobject.cpp @@ -1006,6 +1006,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); mText->setStringUTF8(temp_string); +// [RLVa:KB] - Checked: 2009-07-09 (RLVa-1.0.0f) | Added: RLVa-1.0.0f + if (rlv_handler_t::isEnabled()) + { + mText->setObjectText(temp_string); + } +// [/RLVa:KB] if (mDrawable.notNull()) { @@ -1423,6 +1429,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); mText->setStringUTF8(temp_string); +// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-09 (RLVa-1.0.0f) | Added: RLVa-1.0.0f + if (rlv_handler_t::isEnabled()) + { + mText->setObjectText(temp_string); + } +// [/RLVa:KB] setChanged(TEXTURE); } @@ -4795,7 +4807,10 @@ BOOL LLViewerObject::permTransfer() const // given you modify rights to. JC BOOL LLViewerObject::allowOpen() const { - return !flagInventoryEmpty() && (permYouOwner() || permModify()); +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0b) + return !flagInventoryEmpty() && (permYouOwner() || permModify()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)); +// [/RLVa:KB] +// return !flagInventoryEmpty() && (permYouOwner() || permModify()); } LLViewerObject::LLInventoryCallbackInfo::~LLInventoryCallbackInfo() diff --git a/linden/indra/newview/llviewerobjectlist.cpp b/linden/indra/newview/llviewerobjectlist.cpp index 9ccbf99..78c1730 100644 --- a/linden/indra/newview/llviewerobjectlist.cpp +++ b/linden/indra/newview/llviewerobjectlist.cpp @@ -74,6 +74,8 @@ #include "llappviewer.h" +#include "primbackup.h" + extern F32 gMinObjectDistance; extern BOOL gAnimateTextures; @@ -163,8 +165,6 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject &object) { - if(object.getRegion()) - { U32 local_id = object.mLocalID; LLHost region_host = object.getRegion()->getHost(); U32 ip = region_host.getAddress(); @@ -176,9 +176,6 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject &object) return sIndexAndLocalIDToUUID.erase(indexid) > 0 ? TRUE : FALSE; } - return FALSE ; -} - void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, const U32 local_id, const U32 ip, @@ -222,6 +219,11 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, updateActive(objectp); + if(!just_created) + primbackup::getInstance()->prim_update(objectp); + + + if (just_created) { gPipeline.addObject(objectp); @@ -251,6 +253,9 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, objectp->mCreateSelected = false; gViewerWindow->getWindow()->decBusyCount(); gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW ); + + primbackup::getInstance()->newprim(objectp); + } } @@ -827,17 +832,10 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) for (S32 i = 0; i < drawablep->getNumFaces(); i++) { - LLFace* facep = drawablep->getFace(i) ; - if(facep) - { - LLViewerObject* objectp = facep->getViewerObject(); - if(objectp) - { + LLViewerObject* objectp = drawablep->getFace(i)->getViewerObject(); mSelectPickList.erase(objectp); } } - } -} BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { @@ -914,7 +912,7 @@ void LLViewerObjectList::killAllObjects() if (!mMapObjects.empty()) { llwarns << "Some objects still on map object list!" << llendl; - mMapObjects.clear(); + mActiveObjects.clear(); } } diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp index 54b7743..76b752c 100644 --- a/linden/indra/newview/llviewertexteditor.cpp +++ b/linden/indra/newview/llviewertexteditor.cpp @@ -95,6 +95,13 @@ public: } else { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour("viewnote")) ) + { + return; + } +// [/RLVa:KB] + // See if we can bring an existing preview to the front if(!LLPreview::show(item->getUUID(), true)) { diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 3b23bb9..2240d44 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp @@ -2993,6 +2993,16 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, { moveable_object_selected = TRUE; this_object_movable = TRUE; + +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0g + if ( (rlv_handler_t::isEnabled()) && + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) + { + LLVOAvatar* pAvatar = gAgent.getAvatarObject(); + if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) + moveable_object_selected = this_object_movable = FALSE; + } +// [/RLVa:KB] } all_selected_objects_move = all_selected_objects_move && this_object_movable; all_selected_objects_modify = all_selected_objects_modify && object->permModify(); diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 3d2523e..158977e 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -125,6 +125,10 @@ #include "llvoicevisualizer.h" #include "llvoiceclient.h" +// [RLVa:KB] +#include "llstartup.h" +// [/RLVa:KB] + LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; LLVOAvatarSkeletonInfo* LLVOAvatar::sSkeletonInfo = NULL; @@ -2093,9 +2097,15 @@ void LLVOAvatar::buildCharacter() if (attachment->getGroup() == i) { LLMenuItemCallGL* item; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on (Left Hand / Right Hand option) item = new LLMenuItemCallGL(attachment->getName(), NULL, - object_selected_and_point_valid); + object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// item = new LLMenuItemCallGL(attachment->getName(), +// NULL, +// object_selected_and_point_valid); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); gAttachPieMenu->append(item); @@ -2150,9 +2160,15 @@ void LLVOAvatar::buildCharacter() if (attachment->getGroup() == 8) { LLMenuItemCallGL* item; +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on item = new LLMenuItemCallGL(attachment->getName(), NULL, - object_selected_and_point_valid); + object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// item = new LLMenuItemCallGL(attachment->getName(), +// NULL, +// object_selected_and_point_valid); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); gAttachScreenPieMenu->append(item); gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), @@ -2171,6 +2187,7 @@ void LLVOAvatar::buildCharacter() { continue; } + // RELEASE-RLVa: random comment because we want know if LL ever changes this to not include "attachment" as userdata LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), NULL, &object_selected_and_point_valid, &attach_label, attachment); @@ -2230,8 +2247,13 @@ void LLVOAvatar::buildCharacter() LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); if (attachment) { +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + // We need the userdata param to disable options in this pie menu later on LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), - NULL, object_selected_and_point_valid); + NULL, object_selected_and_point_valid, attachment); +// [/RLVa:KB] +// LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), +// NULL, object_selected_and_point_valid); gAttachBodyPartPieMenus[group]->append(item); item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), @@ -3089,10 +3111,16 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) const F32 time_visible = mTimeVisible.getElapsedTimeF32(); const F32 NAME_SHOW_TIME = gSavedSettings.getF32("RenderNameShowTime"); // seconds const F32 FADE_DURATION = gSavedSettings.getF32("RenderNameFadeDuration"); // seconds +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b + bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); +// [/RLVa:KB] BOOL visible_avatar = isVisible() || mNeedsAnimUpdate; BOOL visible_chat = gSavedSettings.getBOOL("UseChatBubbles") && (mChats.size() || mTyping); BOOL render_name = visible_chat || (visible_avatar && +// [RLVa:KB] - Checked: 2009-08-11 (RLVa-1.0.1h) | Added: RLVa-1.0.0h + ( (!fRlvShowNames) || (RlvSettings::fShowNameTags) ) && +// [/RLVa:KB] ((sRenderName == RENDER_NAME_ALWAYS) || (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); // If it's your own avatar, don't draw in mouselook, and don't @@ -3113,7 +3141,18 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - if (sRenderGroupTitles != mRenderGroupTitles) +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b + if (fRlvShowNames) + { + if (mRenderGroupTitles) + { + mRenderGroupTitles = FALSE; + new_name = TRUE; + } + } + else if (sRenderGroupTitles != mRenderGroupTitles) +// [/RLVa] + //if (sRenderGroupTitles != mRenderGroupTitles) { mRenderGroupTitles = sRenderGroupTitles; new_name = TRUE; @@ -3218,6 +3257,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) || is_appearance != mNameAppearance) { std::string line; + if (title && title->getString() && title->getString()[0] != '\0') { line += title->getString(); @@ -3232,6 +3272,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += " "; line += lastname->getString(); + +// [RLVa:KB] + if (fRlvShowNames) + { + // User is not allowed to see who it is, due to RLV settings. + line = gRlvHandler.getAnonym(line); + } +// [/RLVa:KB] + BOOL need_comma = FALSE; if (is_away || is_muted || is_busy) @@ -6328,6 +6377,40 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) { updateAttachmentVisibility(gAgent.getCameraMode()); +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + if (rlv_handler_t::isEnabled()) + { + static bool fRlvFullyLoaded = false; + static LLFrameTimer* pRlvFullyLoadedTimer = NULL; + + // There's no way to know when we're done reattaching what was attached at log-off but this ugly evil bad hack tries anyway + if (!fRlvFullyLoaded) + { + if (pRlvFullyLoadedTimer) + { + if (pRlvFullyLoadedTimer->getElapsedTimeF32() > 30.0f) + { + fRlvFullyLoaded = true; + delete pRlvFullyLoadedTimer; + pRlvFullyLoadedTimer = NULL; + } + else + { + pRlvFullyLoadedTimer->reset(); + } + } + else if ( (!pRlvFullyLoadedTimer) && + ( (0 == mPendingAttachment.size()) || + ((1 == mPendingAttachment.size()) && (mPendingAttachment[0] == viewer_object)) ) ) + { + pRlvFullyLoadedTimer = new LLFrameTimer(); + } + } + + gRlvHandler.onAttach(attachment, fRlvFullyLoaded); + } +// [/RLVa:KB] + // Then make sure the inventory is in sync with the avatar. gInventory.addChangedMask( LLInventoryObserver::LABEL, attachment->getItemID() ); gInventory.notifyObservers(); @@ -6383,6 +6466,14 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) // only one object per attachment point for now if (attachment->getObject() == viewer_object) { +// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) + // URGENT-RLV: it looks like LLApp::isExiting() isn't always accurate so find something better (if it exists) + if ( (rlv_handler_t::isEnabled()) && (!LLApp::isExiting()) && (mIsSelf) ) + { + gRlvHandler.onDetach(attachment); + } +// [/RLVa:KB] + LLUUID item_id = attachment->getItemID(); attachment->removeObject(viewer_object); if (mIsSelf) @@ -6441,6 +6532,14 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) gPipeline.markMoved(mDrawable, TRUE); mIsSitting = TRUE; +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.1d + #ifdef RLV_EXTENSION_STARTLOCATION + if (rlv_handler_t::isEnabled()) + { + RlvSettings::updateLoginLastLocation(); + } + #endif // RLV_EXTENSION_STARTLOCATION +// [/RLVa:KB] mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject mRoot.setPosition(getPosition()); mRoot.updateWorldMatrixChildren(); @@ -6502,6 +6601,14 @@ void LLVOAvatar::getOffObject() gPipeline.markMoved(mDrawable, TRUE); mIsSitting = FALSE; +// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.1d + #ifdef RLV_EXTENSION_STARTLOCATION + if (rlv_handler_t::isEnabled()) + { + RlvSettings::updateLoginLastLocation(); + } + #endif // RLV_EXTENSION_STARTLOCATION +// [/RLVa:KB] mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject mRoot.setPosition(cur_position_world); mRoot.setRotation(cur_rotation_world); diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp index ad44356..adf82cd 100644 --- a/linden/indra/newview/llvovolume.cpp +++ b/linden/indra/newview/llvovolume.cpp @@ -1942,7 +1942,11 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e { if (!mbCanSelect || - (gHideSelectedObjects && isSelected()) || +// (gHideSelectedObjects && isSelected()) || +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + ( (gHideSelectedObjects && isSelected()) && + ((!rlv_handler_t::isEnabled()) || (!isHUDAttachment()) || (gRlvHandler.isDetachable(this))) ) || +// [/RLVa:KB] mDrawable->isDead() || !gPipeline.hasRenderType(mDrawable->getRenderType())) { @@ -2084,10 +2088,18 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - if (facep->getViewerObject()->isSelected() && gHideSelectedObjects) +// if (facep->getViewerObject()->isSelected() && gHideSelectedObjects) +// { +// return; +// } +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + LLViewerObject* pObj = facep->getViewerObject(); + if ( (pObj->isSelected() && gHideSelectedObjects) && + ((!rlv_handler_t::isEnabled()) || (!pObj->isHUDAttachment()) || (gRlvHandler.isDetachable(pObj))) ) { return; } +// [/RVLa:KB] //add face to drawmap LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[type]; diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp index 77833c3..5e51e6f 100644 --- a/linden/indra/newview/llworldmapview.cpp +++ b/linden/indra/newview/llworldmapview.cpp @@ -640,7 +640,14 @@ void LLWorldMapView::draw() // info->mAgents, // info->mName.c_str(), // LLViewerRegion::accessToShortString(info->mAccess).c_str() ); - if (info->mAccess == SIM_ACCESS_DOWN) +// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-04 (RLVa-1.0.0a) + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) + { + mesg = rlv_handler_t::cstrHidden; + } + else if (info->mAccess == SIM_ACCESS_DOWN) +// [/RLVa:KB] +// if (info->mAccess == SIM_ACCESS_DOWN) { mesg = llformat( "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str()); } @@ -1069,7 +1076,10 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING); text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset); - if (label != "") + //if (label != "") +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Added: RLVa-1.0.0a + if ( (label != "") && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) +// [/RLVa:KB] { font->renderUTF8( label, 0, @@ -1129,7 +1139,10 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* stic std::string message = llformat("%s (%s)", - info->mName.c_str(), + //info->mName.c_str(), +// [RLVa:KB] - Alternate: Snowglobe-1.0 | Checked: 2009-07-04 (RLVa-1.0.0a) + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? info->mName.c_str() : rlv_handler_t::cstrHidden.c_str(), +// [/RLVa:KB] LLViewerRegion::accessToString(info->mAccess).c_str()); if (info->mAccess != SIM_ACCESS_DOWN) diff --git a/linden/indra/newview/pipeline.cpp b/linden/indra/newview/pipeline.cpp index 87b810c..67af961 100644 --- a/linden/indra/newview/pipeline.cpp +++ b/linden/indra/newview/pipeline.cpp @@ -1795,8 +1795,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) if (gHideSelectedObjects) { - if (drawablep->getVObj().notNull() && - drawablep->getVObj()->isSelected()) +// if (drawablep->getVObj().notNull() && +// drawablep->getVObj()->isSelected()) +// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.0.0c) + LLViewerObject* pObj = drawablep->getVObj(); + if ( (pObj) && (pObj->isSelected()) && + ((!rlv_handler_t::isEnabled()) || (!pObj->isHUDAttachment()) || (gRlvHandler.isDetachable(pObj))) ) +// [/RVLa:KB] { return; } diff --git a/linden/indra/newview/primbackup.cpp b/linden/indra/newview/primbackup.cpp new file mode 100644 index 0000000..78fd482 --- /dev/null +++ b/linden/indra/newview/primbackup.cpp @@ -0,0 +1,1105 @@ + +#include "llviewerprecompiledheaders.h" +#include "llviewermenu.h" + + +// system library includes +#include +#include +#include + +// linden library includes +#include "llfilepicker.h" +#include "indra_constants.h" +#include "llsdserialize.h" +#include "llsdutil.h" + +#include "llcallbacklist.h" + +// newview includes +#include "llagent.h" +#include "llselectmgr.h" +#include "lltoolplacer.h" + +#include "lltexturecache.h" + +#include "llnotify.h" + +#include "llapr.h" +#include "lldir.h" +#include "llimage.h" +#include "lllfsthread.h" +#include "llviewercontrol.h" +#include "llassetuploadresponders.h" +#include "lleconomy.h" +#include "llhttpclient.h" +#include "lluploaddialog.h" +#include "lldir.h" +#include "llinventorymodel.h" // gInventory +#include "llviewercontrol.h" // gSavedSettings +#include "llviewermenu.h" // gMenuHolder +#include "llagent.h" +#include "llfilepicker.h" +#include "llfloateranimpreview.h" +#include "llfloaterbuycurrency.h" +#include "llfloaterimagepreview.h" +#include "llfloaternamedesc.h" +#include "llfloatersnapshot.h" +#include "llinventorymodel.h" // gInventory +#include "llresourcedata.h" +#include "llstatusbar.h" +#include "llviewercontrol.h" // gSavedSettings +#include "llviewerimagelist.h" +#include "lluictrlfactory.h" +#include "llviewermenu.h" // gMenuHolder +#include "llviewerregion.h" +#include "llviewerstats.h" +#include "llviewerwindow.h" +#include "llappviewer.h" +#include "lluploaddialog.h" +// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout +#include "llappviewer.h" +#include "lltransactiontypes.h" + +#include "primbackup.h" + +#include "llviewerobjectlist.h" + +primbackup* primbackup::sInstance = 0; + +class importResponder: public LLNewAgentInventoryResponder +{ + public: + + importResponder(const LLSD& post_data, + const LLUUID& vfile_id, + LLAssetType::EType asset_type) + : LLNewAgentInventoryResponder(post_data, vfile_id, asset_type) + { + } + + + //virtual + virtual void uploadComplete(const LLSD& content) + { + lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; + + LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); + LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); + + // Update L$ and ownership credit information + // since it probably changed on the server + if (asset_type == LLAssetType::AT_TEXTURE || + asset_type == LLAssetType::AT_SOUND || + asset_type == LLAssetType::AT_ANIMATION) + { + gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->nextBlockFast(_PREHASH_MoneyData); + gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); + gAgent.sendReliableMessage(); + +// LLStringUtil::format_map_t args; +// args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); +// LLNotifyBox::showXml("UploadPayment", args); + } + + // Actually add the upload to viewer inventory + llinfos << "Adding " << content["new_inventory_item"].asUUID() << " " + << content["new_asset"].asUUID() << " to inventory." << llendl; + if(mPostData["folder_id"].asUUID().notNull()) + { + LLPermissions perm; + U32 next_owner_perm; + perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); + if (mPostData["inventory_type"].asString() == "snapshot") + { + next_owner_perm = PERM_ALL; + } + else + { + next_owner_perm = PERM_MOVE | PERM_TRANSFER; + } + perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, next_owner_perm); + S32 creation_date_now = time_corrected(); + LLPointer item + = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(), + mPostData["folder_id"].asUUID(), + perm, + content["new_asset"].asUUID(), + asset_type, + inventory_type, + mPostData["name"].asString(), + mPostData["description"].asString(), + LLSaleInfo::DEFAULT, + LLInventoryItem::II_FLAGS_NONE, + creation_date_now); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + else + { + llwarns << "Can't find a folder to put it in" << llendl; + } + + // remove the "Uploading..." message + LLUploadDialog::modalUploadFinished(); + + primbackup::getInstance()->update_map(content["new_asset"].asUUID()); + primbackup::getInstance()->upload_next_asset(); + + } + +}; + + + +class CacheReadResponder : public LLTextureCache::ReadResponder + { + public: + CacheReadResponder(const LLUUID& id, LLImageFormatted* image) + : mFormattedImage(image), mID(id) + { + setImage(image); + } + void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) + { + if(imageformat==IMG_CODEC_TGA && mFormattedImage->getCodec()==IMG_CODEC_J2C) + { + llwarns<<"Bleh its a tga not saving"<getCodec() == imageformat); + mFormattedImage->appendData(data, datasize); + } + else + { + mFormattedImage = LLImageFormatted::createFromType(imageformat); + mFormattedImage->setData(data,datasize); + } + mImageSize = imagesize; + mImageLocal = imagelocal; + } + + virtual void completed(bool success) + { + if(success && (mFormattedImage.notNull()) && mImageSize>0) + { + + llinfos << "SUCCESS getting texture "<getfolder()+"//"+name)<save(primbackup::getInstance()->getfolder()+"//"+name)) + { + llinfos << "FAIL saving texture "<m_nexttextureready=true; + //JUST SAY NO TO APR DEADLOCKING + //primbackup::getInstance()->export_next_texture(); + } + private: + LLPointer mFormattedImage; + LLUUID mID; + }; + + + +primbackup::primbackup() +: LLFloater( std::string("Prim Import Floater") ) +{ + LLUICtrlFactory::getInstance()->buildFloater( this, "floater_prim_import.xml" ); + + // reposition floater from saved settings + //LLRect rect = gSavedSettings.getRect( "FloaterPrimImport" ); + //reshape( rect.getWidth(), rect.getHeight(), FALSE ); + //setRect( rect ); + + running=false; + textures.clear(); + assetmap.clear(); + current_asset=LLUUID::null; + m_retexture=false; + close(); +} + + +//////////////////////////////////////////////////////////////////////////////// +// +primbackup* primbackup::getInstance() +{ + if ( ! sInstance ) + sInstance = new primbackup(); + + return sInstance; +} + +primbackup::~primbackup() +{ + // save position of floater + gSavedSettings.setRect( "FloaterPrimImport", getRect() ); + sInstance = 0; +} + +void primbackup::draw() +{ + LLFloater::draw(); +} + +void primbackup::show() +{ + // set the title + setTitle( "stuff" ); + m_curobject=1; + m_curprim=0; + m_objects=0; + m_prims=0; + m_textures=0; + m_curtexture=0; + rezcount=0; + + // make floater appear + setVisibleAndFrontmost(); +} + + +void primbackup::onClose( bool app_quitting ) +{ + setVisible( false ); + // HACK for fast XML iteration replace with: + // destroy(); +} + +void primbackup::updateexportnumbers() +{ + + std::stringstream sstr; + LLUICtrl * ctrl=this->getChild("name_label"); + + sstr<<"Export Progress \n"; + + sstr << "Remaining Textures "<setValue(LLSD("Text")=sstr.str()); + +} + + +void primbackup::updateimportnumbers() +{ + std::stringstream sstr; + LLUICtrl * ctrl=this->getChild("name_label"); + + if(m_retexture) + { + sstr << " Textures uploads remaining : "<setValue(LLSD("Text")=sstr.str()); + } + else + { + sstr << " Textures uploads N/A \n"; + ctrl->setValue(LLSD("Text")=sstr.str()); + } + sstr << " Objects "<m_curobject<<"/"<m_objects<<"\n"; + ctrl->setValue(LLSD("Text")=sstr.str()); + + sstr << " Rez "<rezcount<<"/"<m_prims; + ctrl->setValue(LLSD("Text")=sstr.str()); + + sstr << " Build "<m_curprim<<"/"<m_prims; + ctrl->setValue(LLSD("Text")=sstr.str()); + + +} + +void primbackup::pre_export_object() +{ + textures.clear(); + llsd.clear(); + this_group.clear(); + + // Open the file save dialog + LLFilePicker& file_picker = LLFilePicker::instance(); + if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_XML ) ) + { + // User canceled save. + return; + } + + file_name = file_picker.getCurFile(); + folder = gDirUtilp->getDirName(file_name); + + export_state=EXPORT_INIT; + gIdleCallbacks.addFunction(exportworker, NULL); +} + +void primbackup::exportworker(void *userdata) +{ + primbackup::getInstance()->updateexportnumbers(); + + switch(primbackup::getInstance()->export_state) + { + case EXPORT_INIT: + { + primbackup::getInstance()->show(); + LLSelectMgr::getInstance()->getSelection()->ref(); + + struct ff : public LLSelectedNodeFunctor + { + virtual bool apply(LLSelectNode* node) + { + if(gAgent.getID()!=node->mPermissions->getOwner()) + { + #ifdef LL_GRID_PERMISSIONS + return false; + #else + return true; + #endif + } + else if(581632==node->mPermissions->getMaskOwner() || 2147483647==node->mPermissions->getMaskOwner()) + { + return true; + } + return false; + } + } func; + + if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) + primbackup::getInstance()->export_state=EXPORT_STRUCTURE; + else + { + llwarns<<"Incorrect permission to export"<export_state=EXPORT_DONE; + primbackup::getInstance()->close(); + gIdleCallbacks.deleteFunction(exportworker); + LLSelectMgr::getInstance()->getSelection()->unref(); + + } + break; + } + + break; + case EXPORT_STRUCTURE: + { + struct ff : public LLSelectedObjectFunctor + { + virtual bool apply(LLViewerObject* object) + { + object->boostTexturePriority(TRUE); + LLViewerObject::child_list_t children = object->getChildren(); + children.push_front(object); //push root onto list + LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children); + LLSD stuff; + stuff["root_position"] = object->getPosition().getValue(); + stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); + stuff["group_body"] = prim_llsd; + primbackup::getInstance()->llsd["data"].append(stuff); + return true; + } + } func; + + primbackup::getInstance()->export_state=EXPORT_LLSD; + LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func,false); + LLSelectMgr::getInstance()->getSelection()->unref(); + + break; + } + case EXPORT_TEXTURES: + if(primbackup::getInstance()->m_nexttextureready==false) + return; + + //Ok we got work to do + primbackup::getInstance()->m_nexttextureready=false; + + if(primbackup::getInstance()->textures.empty()) + { + primbackup::getInstance()->export_state=EXPORT_DONE; + return; + } + + primbackup::getInstance()->export_next_texture(); + break; + + case EXPORT_LLSD: + { + // Create a file stream and write to it + llofstream export_file(primbackup::getInstance()->file_name); + LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); + export_file.close(); + primbackup::getInstance()->m_nexttextureready=true; + primbackup::getInstance()->export_state=EXPORT_TEXTURES; + } + break; + case EXPORT_DONE: + llinfos<<"Backup complete"<close(); + break; + } +} + +LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list) +{ + + LLViewerObject* object; + LLSD llsd; + + char localid[16]; + + for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) + { + object=(*i); + LLUUID id = object->getID(); + + llinfos << "Exporting prim " << object->getID().asString() << llendl; + + // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD + // tree structure + LLSD prim_llsd; + + if (!object->isRoot()) + { + + // Parent id + snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); + prim_llsd["parent"] = localid; + } + + // Transforms + prim_llsd["position"] = object->getPosition().getValue(); + prim_llsd["scale"] = object->getScale().getValue(); + prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation()); + + // Flags + prim_llsd["shadows"] = object->flagCastShadows(); + prim_llsd["phantom"] = object->flagPhantom(); + prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS); + + // Volume params + LLVolumeParams params = object->getVolume()->getParams(); + prim_llsd["volume"] = params.asLLSD(); + + // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 + if (object->isFlexible()) + { + // Flexible + LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + prim_llsd["flexible"] = flex->asLLSD(); + } + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) + { + // Light + LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); + prim_llsd["light"] = light->asLLSD(); + } + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + { + // Sculpt + LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + prim_llsd["sculpt"] = sculpt->asLLSD(); + + LLUUID sculpt_texture=sculpt->getSculptTexture(); + bool alreadyseen=false; + std::list::iterator iter; + for(iter = textures.begin(); iter != textures.end() ; iter++) + { + if( (*iter)==sculpt_texture) + alreadyseen=true; + } + if(alreadyseen==false) + { + llinfos << "Found a sculpt texture, adding to list "<getNumTEs(); + for (U8 i = 0; i < te_count; i++) + { + bool alreadyseen=false; + te_llsd.append(object->getTE(i)->asLLSD()); + std::list::iterator iter; + for(iter = textures.begin(); iter != textures.end() ; iter++) + { + if( (*iter)==object->getTE(i)->getID()) + alreadyseen=true; + } + if(alreadyseen==false) + textures.push_back(object->getTE(i)->getID()); + } + prim_llsd["textures"] = te_llsd; + + // The keys in the primitive maps do not have to be localids, they can be any + // string. We simply use localids because they are a unique identifier + snprintf(localid, sizeof(localid), "%u", object->getLocalID()); + llsd[(const char*)localid] = prim_llsd; + } + + updateexportnumbers(); + + return llsd; +} + + +void primbackup::export_next_texture() +{ + if(textures.empty()) + { + llinfos << "Finished exporting textures "<::iterator iter; + iter = textures.begin(); + + LLUUID id; + + while(1) + { + if(iter==textures.end()) + { + m_nexttextureready=true; + return; + } + + id=(*iter); + + LLViewerImage * imagep = gImageList.hasImage(id); + if(imagep!=NULL) + { + S32 cur_discard = imagep->getDiscardLevel(); + if(cur_discard>0) + { + if(imagep->getBoostLevel()!=LLViewerImage::BOOST_PREVIEW) + imagep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); //we want to force discard 0 this one does this. + } + else + { + break; + } + } + else + { + llwarns<<" We *DONT* have the texture "<readFromCache(id,LLWorkerThread::PRIORITY_HIGH,0,999999,responder); +} + + + +void primbackup::import_object(bool upload) +{ + textures.clear(); + assetmap.clear(); + current_asset=LLUUID::null; + + this->m_retexture=upload; + + // Open the file open dialog + LLFilePicker& file_picker = LLFilePicker::instance(); + if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_XML ) ) + { + // User canceled save. + return; + } + std::string file_name = file_picker.getFirstFile().c_str(); + folder = gDirUtilp->getDirName(file_name); + + llifstream import_file(file_name); + LLSDSerialize::fromXML(llsd, import_file); + import_file.close(); + + show(); + + //Get the texture map + + LLSD::map_const_iterator prim_it; + LLSD::array_const_iterator prim_arr_it; + + this->m_curobject=1; + this->m_curprim=1; + this->m_objects=llsd["data"].size(); + this->m_prims=0; + rezcount=0; + + updateimportnumbers(); + + for( prim_arr_it = llsd["data"].beginArray(); prim_arr_it != llsd["data"].endArray(); prim_arr_it++) + { + + LLSD llsd2; + llsd2=(*prim_arr_it)["group_body"]; + + for( prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++) + { + LLSD prim_llsd; + prim_llsd=llsd2[prim_it->first]; + LLSD::array_iterator text_it; + std::list::iterator iter; + + if(prim_llsd.has("sculpt")) + { + LLSculptParams* sculpt=new LLSculptParams(); + sculpt->fromLLSD(prim_llsd["sculpt"]); + LLUUID orig=sculpt->getSculptTexture(); + bool alreadyseen=false; + for(iter = textures.begin(); iter != textures.end() ; iter++) + { + if( (*iter)==orig) + alreadyseen=true; + } + if(alreadyseen==false) + { + llinfos << "Found a new SCULPT texture to upload "<setObjectType(LL_PCODE_CUBE); + //LLVector3 pos=offset_agent(offset); + mPlacer->placeObject((S32)(offset.mV[0]), (S32)(offset.mV[1]), 0); +} + +void primbackup::import_object1a() +{ + running=true; + + show(); + + group_prim_import_iter=llsd["data"].beginArray(); + root_root_pos=(*group_prim_import_iter)["root_position"]; + + this->m_objects=llsd["data"].size(); + this->m_curobject=1; + import_next_object(); +} + +void primbackup::import_next_object() +{ + toselect.clear(); + rezcount=0; + + this_group=(*group_prim_import_iter)["group_body"]; + prim_import_iter=this_group.beginMap(); + + m_curprim=0; + m_prims=this_group.size(); + updateimportnumbers(); + LLVector3 lgpos=(*group_prim_import_iter)["root_position"]; + + group_offset=lgpos-root_root_pos; + root_pos=offset_agent(LLVector3(2.0,0,0)); + root_rot=ll_quaternion_from_sd((*group_prim_import_iter)["root_rotation"]); + + rez_agent_offset(LLVector3(0.0,2.0,0.0)); + // Now we must wait for the callback when ViewerObjectList gets the new objects and we have the correct number selected +} + +// This function takes a pointer to a viewerobject and applys the prim definition that prim_llsd has +void primbackup::xmltoprim(LLSD prim_llsd,LLViewerObject * object) +{ + LLUUID id = object->getID(); + expecting_update = object->getID(); + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + + if(prim_llsd.has("parent")) + { + //we are not the root node. + LLVector3 pos=prim_llsd["position"]; + LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]); + object->setPositionRegion((pos*root_rot)+(root_pos+group_offset)); + object->setRotation(rot*root_rot); + } + else + { + object->setPositionRegion(root_pos+group_offset); + LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]); + object->setRotation(rot); + } + + object->setScale(prim_llsd["scale"]); + + if(prim_llsd.has("shadows")) + if(prim_llsd["shadows"].asInteger()==1) + object->setFlags(FLAGS_CAST_SHADOWS,true); + + if(prim_llsd.has("phantom")) + if(prim_llsd["phantom"].asInteger()==1) + object->setFlags(FLAGS_PHANTOM,true); + + if(prim_llsd.has("physical")) + if(prim_llsd["physical"].asInteger()==1) + object->setFlags(FLAGS_USE_PHYSICS,true); + + // Volume params + LLVolumeParams volume_params = object->getVolume()->getParams(); + volume_params.fromLLSD(prim_llsd["volume"]) ; + object->updateVolume(volume_params); + + if(prim_llsd.has("sculpt")) + { + LLSculptParams* sculpt=new LLSculptParams(); + sculpt->fromLLSD(prim_llsd["sculpt"]); + + //TODO check if map is valid and only set texture is map is valid and changes + + if(assetmap[sculpt->getSculptTexture()].notNull()) + { + LLUUID replacment=assetmap[sculpt->getSculptTexture()]; + sculpt->setSculptTexture(replacment); + } + + object->setParameterEntry(LLNetworkData::PARAMS_SCULPT,(LLNetworkData&)(*sculpt),true); + } + + if(prim_llsd.has("light")) + { + LLLightParams * light=new LLLightParams(); + light->fromLLSD(prim_llsd["light"]); + object->setParameterEntry(LLNetworkData::PARAMS_LIGHT,(LLNetworkData&)(*light),true); + } + + if(prim_llsd.has("flexible")) + { + LLFlexibleObjectData* flex=new LLFlexibleObjectData(); + flex->fromLLSD(prim_llsd["flexible"]); + object->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE,(LLNetworkData&)(*flex),true); + } + + + // Textures + LLSD te_llsd; + llinfos << "Processing textures for prim" << llendl; + + te_llsd=prim_llsd["textures"]; + + LLSD::array_iterator text_it; + U8 i=0; + i=0; + + for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++) + { + LLSD the_te; + the_te=(*text_it); + LLTextureEntry te; + te.fromLLSD(the_te); + + if(assetmap[te.getID()].notNull()) + { + LLUUID replacment=assetmap[te.getID()]; + te.setID(replacment); + } + + object->setTE(i,te); // + i++; + } + + llinfos << "Textures done!" << llendl; + + //bump the iterator now so the callbacks hook together nicely + //if(prim_import_iter!=this_group.endMap()) + // prim_import_iter++; + + object->sendRotationUpdate(); + object->sendTEUpdate(); + object->sendShapeUpdate(); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE |UPD_POSITION); + + LLSelectMgr::getInstance()->deselectAll(); +} + +//This is fired when the update packet is processed so we know the prim settings have stuck +void primbackup::prim_update(LLViewerObject* object) +{ + if(!running) + return; + + if(object!=NULL) + if(object->mID!=expecting_update) + return; + + m_curprim++; + updateimportnumbers(); + + prim_import_iter++; + + LLUUID x; + expecting_update=x.null; + + if(prim_import_iter==this_group.endMap()) + { + llinfos<<"Trying to link"<1) + { + std::reverse(toselect.begin(),toselect.end()); + //Now link + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->selectObjectAndFamily(toselect,true); + LLSelectMgr::getInstance()->sendLink(); + LLViewerObject * root=toselect.back(); + root->setRotation(root_rot); + } + + this->m_curobject++; + group_prim_import_iter++; + if(group_prim_import_iter!=llsd["data"].endArray()) + { + import_next_object(); + return; + } + + running=false; + this->close(); + return; + } + + LLSD prim_llsd; + prim_llsd=this_group[prim_import_iter->first]; + + if(toselect.empty()) + { + llwarns << "error: ran out of objects to mod" << llendl; + return; + } + + if(prim_import_iter!=this_group.endMap()) + { + //rez_agent_offset(LLVector3(1.0,0,0)); + LLSD prim_llsd=this_group[prim_import_iter->first]; + process_iter++; + xmltoprim(prim_llsd,(*process_iter)); + } +} + +// Callback when we rez a new object when the importer is running. +bool primbackup::newprim(LLViewerObject * pobject) +{ + if(running) + { + rezcount++; + toselect.push_back(pobject); + updateimportnumbers(); + prim_import_iter++; + + if(prim_import_iter!=this_group.endMap()) + { + + pobject->setPosition(this->offset_agent(LLVector3(0,1.0,0))); + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); + + rez_agent_offset(LLVector3(1.0,0,0)); + } + else + { + llinfos << "All prims rezed, moving to build stage" <first]; + process_iter=toselect.begin(); + xmltoprim(prim_llsd,(*process_iter)); + } + } + + return true; +} + +void primbackup::update_map(LLUUID uploaded_asset) +{ + if(current_asset.isNull()) + return; + + assetmap.insert(std::pair(current_asset,uploaded_asset)); + llinfos << "Mapping "<getCapability("NewFileAgentInventory"); + if (!url.empty()) + { + LLSD body; + body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLAssetType::AT_NONE) ? asset_type : destination_folder_type); + body["asset_type"] = LLAssetType::lookup(asset_type); + body["inventory_type"] = LLInventoryType::lookup(inv_type); + body["name"] = name; + body["description"] = desc; + + std::ostringstream llsdxml; + LLSDSerialize::toXML(body, llsdxml); + lldebugs << "posting body to capability: " << llsdxml.str() << llendl; + //LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type)); + LLHTTPClient::post(url, body, new importResponder(body, uuid, asset_type)); + + } + else + { + llinfos << "NewAgentInventory capability not found, FUCK!" << llendl; + } +} + + + +void primbackup::upload_next_asset() +{ + if(textures.empty()) + { + llinfos<<" Texture list is empty, moving to rez statge"<< llendl; + current_asset=LLUUID::null; + import_object1a(); + return; + } + + this->updateimportnumbers(); + + std::list::iterator iter; + iter=textures.begin(); + LLUUID id=(*iter); + textures.pop_front(); + + llinfos<<"Got texture ID "< assetmap; + + //Export texture list + std::list textures; + + //Import object tracking + std::vector toselect; + std::vector::iterator process_iter; + + //Working LLSD holders + LLUUID current_asset; + LLSD llsd; + LLSD this_group; + LLUUID expecting_update; + + //working llsd itterators for objects and linksets + LLSD::map_const_iterator prim_import_iter; + LLSD::array_const_iterator group_prim_import_iter; + + // Root pos and central root pos for link set + LLVector3 root_pos; + LLVector3 root_root_pos; + LLVector3 group_offset; + + //Agent inital pos and rot when starting import + LLQuaternion root_rot; + LLQuaternion agent_rot; + +}; + diff --git a/linden/indra/newview/rlvevent.h b/linden/indra/newview/rlvevent.h new file mode 100644 index 0000000..c3d9c45 --- /dev/null +++ b/linden/indra/newview/rlvevent.h @@ -0,0 +1,224 @@ +#ifndef RLV_EVENTEMITTER_H +#define RLV_EVENTEMITTER_H + +#include +#include +#include + +#include "lluuid.h" + +#include "rlvhelper.h" + +// ============================================================================ +/* + * RlvEvent + * ======== + * Passed to observer event handlers (contains the same paramaters as RlvHandler::processXXXCommand) + */ + +class RlvEvent +{ +public: + RlvEvent(const LLUUID& uuid, const RlvCommand& rlvCmd) : m_UUID(uuid), m_rlvCmd(rlvCmd) {} + virtual ~RlvEvent() {} + + const LLUUID& getSenderID() const { return m_UUID; }; + const RlvCommand& getCommand() const { return m_rlvCmd; }; + +protected: + LLUUID m_UUID; + RlvCommand m_rlvCmd; +}; + +// ============================================================================ +/* + * RlvObserver + * =========== + * Provides a way to extend the existing command set without changing the main RlvHandler class + * + * Steps: + * - derive your class from RlvObserver + * - override any of the event functions you need + * - add it as an observer: gRlvHandler.addObserver(new RlbObserverDerivedClass()); + * - done + * + * Notes: + * - as long as you don't call gRlvHandler.remObserver() your class will be cleaned up from + * RlvEventEmitter destructor (see below) + * - event handlers are called only if RlvHandler didn't handle it so while you can + * add a new command @foobar=n, you won't get called for @detach=n + * - event handlers are called *after* the command is added so a call to + * RlvHandler::hasBehaviour("foobar") would return TRUE + * - return TRUE if you handled the command (won't get passed on to the next observer) + * return FALSE if you didn't handle the command (gets passed on to the next observer) + * + */ + +class RlvObserver +{ +public: + virtual ~RlvObserver() {} + + typedef RlvEvent EventType; + + virtual BOOL onAddCommand(const EventType& rlvEvent) { return FALSE; } + virtual BOOL onRemoveCommand(const EventType& rlvEvent) { return FALSE; } + virtual BOOL onReplyCommand(const EventType& rlvEvent) { return FALSE; } + virtual BOOL onForceCommand(const EventType& rlvEvent) { return FALSE; } +}; + +// ============================================================================ +/* + * RlvEventEmitter + * =============== + * Essentially a slightly modified eventEmitter (see lleventemitter.h) + * + * Changes: + * - if an event handler returns TRUE then no further observers are notified + * - cleans up the (remaining) observers in the destructor + */ + +template < class T > +class RlvEventEmitter +{ + public: + typedef typename T::EventType EventType; + typedef std::list< T* > ObserverContainer; + typedef BOOL ( T::*observerMethod )( const EventType& ); + + protected: + ObserverContainer observers; + + public: + RlvEventEmitter() { }; + + ~RlvEventEmitter() + { + clearObservers(); + } + + BOOL addObserver ( T* observerIn ) + { + if ( ! observerIn ) + return FALSE; + + // check if observer already exists + if ( std::find ( observers.begin (), observers.end (), observerIn ) != observers.end () ) + return FALSE; + + // save it + observers.push_back ( observerIn ); + + return true; + } + + BOOL remObserver ( T* observerIn ) + { + if ( ! observerIn ) + return FALSE; + + observers.remove ( observerIn ); + + return TRUE; + } + + void clearObservers() + { + typename std::list< T* >::iterator iter = observers.begin (); + + while (iter != observers.end ()) + { + delete *iter; + ++iter; + }; + + observers.clear(); + } + + BOOL update ( observerMethod method, const EventType& msgIn ) + { + typename std::list< T* >::iterator iter = observers.begin (); + + BOOL fContinue = TRUE; + while ( (iter != observers.end ()) && (fContinue) ) + { + fContinue = !( ( ( *iter )->*method ) ( msgIn ) ); + ++iter; + }; + + return !fContinue; + } +}; + +// ============================================================================ + +class RlvBehaviourObserver +{ +public: + virtual ~RlvBehaviourObserver() {} + virtual void changed(const RlvCommand& rlvCmd, bool fInternal) = 0; +}; + +// ============================================================================ + +class RlvBehaviourNotifyObserver : public RlvBehaviourObserver +{ +public: + virtual ~RlvBehaviourNotifyObserver() { } + + void changed(const RlvCommand& rlvCmd, bool fInternal) + { + if ( (fInternal) || ((RLV_TYPE_ADD != rlvCmd.getParamType()) && (RLV_TYPE_REMOVE != rlvCmd.getParamType())) ) + return; + + std::string strCmd = rlvCmd.asString(); + std::string strNotify = llformat("/%s=%c", strCmd.c_str(), (RLV_TYPE_ADD == rlvCmd.getParamType()) ? 'n' : 'y'); + + for (std::multimap::const_iterator itNotify = m_Notifications.begin(); + itNotify != m_Notifications.end(); ++itNotify) + { + if ( (itNotify->second.strFilter.empty()) || (std::string::npos != strCmd.find(itNotify->second.strFilter)) ) + rlvSendChatReply(itNotify->second.nChannel, strNotify); + } + } + + void addNotify(const LLUUID& idObj, S32 nChannel, const std::string& strFilter) + { + m_Notifications.insert(std::pair(idObj, notifyData(nChannel, strFilter))); + } + + void clearNotify(const LLUUID& idObj) + { + m_Notifications.erase(idObj); + } + + bool hasNotify() + { + return (m_Notifications.size() != 0); + } + + void removeNotify(const LLUUID& idObj, S32 nChannel, const std::string& strFilter) + { + for (std::multimap::iterator itNotify = m_Notifications.lower_bound(idObj), + endNotify = m_Notifications.upper_bound(idObj); itNotify != endNotify; ++itNotify) + { + if ( (itNotify->second.nChannel == nChannel) && (itNotify->second.strFilter == strFilter) ) + { + m_Notifications.erase(itNotify); + break; + } + } + } +protected: + struct notifyData + { + S32 nChannel; + std::string strFilter; + notifyData(S32 channel, const std::string& filter) : nChannel(channel), strFilter(filter) {} + }; + std::multimap m_Notifications; +}; + +// ============================================================================ + +#endif // RLV_EVENTEMITTER_H diff --git a/linden/indra/newview/rlvextensions.cpp b/linden/indra/newview/rlvextensions.cpp new file mode 100644 index 0000000..6f79636 --- /dev/null +++ b/linden/indra/newview/rlvextensions.cpp @@ -0,0 +1,454 @@ +#include "llviewerprecompiledheaders.h" +#include "llagent.h" +#include "llviewercontrol.h" +#include "llviewerwindow.h" +#include "llvoavatar.h" +#include "llwlparammanager.h" + +#include "rlvextensions.h" +#include "rlvhandler.h" + +// ============================================================================ + +std::map RlvExtGetSet::m_DbgAllowed; + +// Checked: 2009-06-03 (RLVa-0.2.0h) | Modified: RLVa-0.2.0h +RlvExtGetSet::RlvExtGetSet() +{ + if (!m_DbgAllowed.size()) // m_DbgAllowed is static and should only be initialized once + { + m_DbgAllowed.insert(std::pair("AvatarSex", DBG_READ | DBG_PSEUDO)); + m_DbgAllowed.insert(std::pair("RenderResolutionDivisor", DBG_READ | DBG_WRITE)); + #ifdef RLV_EXTENSION_CMD_GETSETDEBUG_EX + m_DbgAllowed.insert(std::pair(RLV_SETTING_FORBIDGIVETORLV, DBG_READ)); + m_DbgAllowed.insert(std::pair(RLV_SETTING_NOSETENV, DBG_READ)); + m_DbgAllowed.insert(std::pair("WindLightUseAtmosShaders", DBG_READ)); + #endif // RLV_EXTENSION_CMD_GETSETDEBUG_EX + + // Cache persistance of every setting + LLControlVariable* pSetting; + for (std::map::iterator itDbg = m_DbgAllowed.begin(); itDbg != m_DbgAllowed.end(); ++itDbg) + { + if ( ((pSetting = gSavedSettings.getControl(itDbg->first)) != NULL) && (pSetting->isPersisted()) ) + itDbg->second |= DBG_PERSIST; + } + } +} + +// Checked: 2009-05-17 (RLVa-0.2.0a) +BOOL RlvExtGetSet::onForceCommand(const RlvEvent& rlvEvent) +{ + return processCommand(rlvEvent.getSenderID(), rlvEvent.getCommand()); +} + +// Checked: 2009-05-17 (RLVa-0.2.0a) +BOOL RlvExtGetSet::onReplyCommand(const EventType& rlvEvent) +{ + return processCommand(rlvEvent.getSenderID(), rlvEvent.getCommand()); +} + +// Checked: 2009-06-18 (RLVa-0.2.1d) | Modified: RLVa-0.2.1d +BOOL RlvExtGetSet::processCommand(const LLUUID& idObj, const RlvCommand& rlvCmd) +{ + std::string strBehaviour = rlvCmd.getBehaviour(), strGetSet, strSetting; + int idxSetting = strBehaviour.find('_'); + if ( (strBehaviour.length() >= 6) && (-1 != idxSetting) && ((int)strBehaviour.length() > idxSetting + 1) ) + { + strSetting = strBehaviour.substr(idxSetting + 1); + strBehaviour.erase(idxSetting); // Get rid of "_" + + strGetSet = strBehaviour.substr(0, 3); + strBehaviour.erase(0, 3); // Get rid of get/set + + if ("debug" == strBehaviour) + { + if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) + { + rlvSendChatReply(rlvCmd.getParam(), onGetDebug(strSetting)); + return TRUE; + } + else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) + { + if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETDEBUG, idObj)) + onSetDebug(strSetting, rlvCmd.getOption()); + return TRUE; + } + } + else if ("env" == strBehaviour) + { + if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) ) + { + rlvSendChatReply(rlvCmd.getParam(), onGetEnv(strSetting)); + return TRUE; + } + else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) ) + { + if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, idObj)) + onSetEnv(strSetting, rlvCmd.getOption()); + return TRUE; + } + } + } + else if ("setrot" == rlvCmd.getBehaviour()) + { + // NOTE: if