From 24955c2d3971ca0a875c11f283099ed29bc9a8bb Mon Sep 17 00:00:00 2001
From: Kitty Barnett <develop@catznip.com>
Date: Wed, 15 Sep 2010 23:39:56 +0200
Subject: [PATCH] - internal : SVC-5383 appears to be fixed so we'll use
 RezMultipleAttachmentsFromInv for force-wearing once more

--HG--
branch : RLVa
---
 indra/newview/llattachmentsmgr.cpp |  2 +-
 indra/newview/rlvcommon.cpp        |  5 +++--
 indra/newview/rlvcommon.h          |  7 -------
 indra/newview/rlvdefines.h         |  3 ---
 indra/newview/rlvhelper.cpp        |  7 +++----
 indra/newview/rlvlocks.cpp         | 30 +++---------------------------
 indra/newview/rlvlocks.h           |  3 +--
 7 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp
index 1b8045d837..d894a2ce74 100644
--- a/indra/newview/llattachmentsmgr.cpp
+++ b/indra/newview/llattachmentsmgr.cpp
@@ -71,7 +71,7 @@ void LLAttachmentsMgr::onIdle(void *)
 void LLAttachmentsMgr::onIdle()
 {
 // [RLVa:KB] - Checked: 2010-09-13 (RLVa-1.2.1c) | Added: RLVa-1.2.1c
-	if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
+	if ( (mPendingAttachments.size()) && (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
 	{
 		attachments_vec_t::iterator itPending = mPendingAttachments.begin();
 		while (itPending != mPendingAttachments.end())
diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp
index 4dae07fdf6..008b9b25f5 100644
--- a/indra/newview/rlvcommon.cpp
+++ b/indra/newview/rlvcommon.cpp
@@ -109,15 +109,16 @@ void RlvSettings::initClass()
 	}
 }
 
-#ifndef RLV_WORKAROUND_REZMULTIPLEATTACH
 BOOL RlvSettings::getEnableSharedWear()
 {
+	return FALSE;
+/*
 	// NOTE-RLVa: it's not proper but some code relies on the fact that getEnableSharedWear() returns FALSE if any attach point is locked
 	return 
 		(rlvGetSettingBOOL(RLV_SETTING_ENABLESHAREDWEAR, FALSE)) && // "Enable Shared Wear" is toggled on and...
 		(!gRlvHandler.hasLockedAttachment(RLV_LOCK_ANY));			// no attachment point is non-attachable or non-detachable
+*/
 }
-#endif // RLV_WORKAROUND_REZMULTIPLEATTACH
 
 #ifdef RLV_EXTENSION_STARTLOCATION
 	// Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-0.2.1d
diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h
index f29fe3abb4..ee1865320a 100644
--- a/indra/newview/rlvcommon.h
+++ b/indra/newview/rlvcommon.h
@@ -81,13 +81,6 @@ protected:
 	static BOOL fShowNameTags;
 };
 
-#ifdef RLV_WORKAROUND_REZMULTIPLEATTACH
-inline BOOL RlvSettings::getEnableSharedWear()
-{
-	return FALSE;
-}
-#endif // RLV_WORKAROUND_REZMULTIPLEATTACH
-
 // ============================================================================
 // RlvStrings
 //
diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h
index 6ce241fd6e..707339fec8 100644
--- a/indra/newview/rlvdefines.h
+++ b/indra/newview/rlvdefines.h
@@ -57,9 +57,6 @@
 	#define RLV_EXTENSION_CMD_TOUCHXXX		// @touch:uuid=n|y, @touchworld[:<uuid>]=n|y, @touchattach[:<uuid>]=n|y, @touchud[:<uuid>]=n|y
 #endif // RLV_EXPERIMENTAL_CMDS
 
-// Workarounds
-#define RLV_WORKAROUND_REZMULTIPLEATTACH	// See http://jira.secondlife.com/browse/SVC-5383 ; disables "Shared Wear"
-
 // ============================================================================
 // Defines
 //
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index 8073e43784..abf8be7add 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -17,6 +17,7 @@
 #include "llviewerprecompiledheaders.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
+#include "llattachmentsmgr.h"
 #include "llgesturemgr.h"
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
@@ -826,10 +827,8 @@ void RlvForceWear::done()
 					continue;
 				gAgentAvatarp->addAttachmentRequest(idItem);
 
-				LLSD payload;
-				payload["item_id"] = idItem;
-				payload["attachment_point"] = itAddAttachments->first;
-				LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
+				LLAttachmentsMgr::instance().addAttachment(
+					idItem, itAddAttachments->first & ~ATTACHMENT_ADD, itAddAttachments->first | ATTACHMENT_ADD);
 			}
 		}
 		m_addAttachments.clear();
diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp
index d6b333b2d0..c65ae55aca 100644
--- a/indra/newview/rlvlocks.cpp
+++ b/indra/newview/rlvlocks.cpp
@@ -15,10 +15,8 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include "llnotifications.h"
-#include "lltooldraganddrop.h"
+#include "llattachmentsmgr.h"
 #include "llviewerobjectlist.h"
-#include "llviewerregion.h"
 #include "pipeline.h"
 
 #include "rlvhelper.h"
@@ -410,28 +408,6 @@ bool RlvAttachmentLocks::verifyAttachmentLocks()
 // RlvAttachmentLockWatchdog member functions
 //
 
-// Checked: 2010-09-15 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c
-void RlvAttachmentLockWatchdog::attach(const LLUUID& idItem, S32 idxAttachPt)
-{
-	const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
-	if (!pItem)
-		return;
-
-	LLMessageSystem* pMsg = gMessageSystem;
-	pMsg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv);
-	pMsg->nextBlockFast(_PREHASH_AgentData);
-	pMsg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-	pMsg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-	pMsg->nextBlockFast(_PREHASH_ObjectData);
-	pMsg->addUUIDFast(_PREHASH_ItemID, pItem->getUUID());
-	pMsg->addUUIDFast(_PREHASH_OwnerID, pItem->getPermissions().getOwner());
-	pMsg->addU8Fast(_PREHASH_AttachmentPt, idxAttachPt | ATTACHMENT_ADD);
-	pack_permissions_slam(pMsg, pItem->getFlags(), pItem->getPermissions());
-	pMsg->addStringFast(_PREHASH_Name, pItem->getName());
-	pMsg->addStringFast(_PREHASH_Description, pItem->getDescription());
-	pMsg->sendReliable(gAgent.getRegion()->getHost());
-}
-
 // Checked: 2010-07-28 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
 void RlvAttachmentLockWatchdog::detach(const LLViewerObject* pAttachObj)
 {
@@ -664,7 +640,7 @@ void RlvAttachmentLockWatchdog::onSavedAssetIntoInventory(const LLUUID& idItem)
 	{
 		if ( (!itAttach->second.fAssetSaved) && (idItem == itAttach->second.idItem) )
 		{
-			attach(itAttach->second.idItem, itAttach->first);
+			LLAttachmentsMgr::instance().addAttachment(itAttach->second.idItem, itAttach->first, true, true);
 			itAttach->second.tsAttach = LLFrameTimer::getElapsedSeconds();
 		}
 	}
@@ -712,7 +688,7 @@ BOOL RlvAttachmentLockWatchdog::onTimer()
 
 		if (fAttach)
 		{
-			attach(itAttach->second.idItem, itAttach->first);
+			LLAttachmentsMgr::instance().addAttachment(itAttach->second.idItem, itAttach->first, true, true);
 			itAttach->second.tsAttach = tsCurrent;
 		}
 
diff --git a/indra/newview/rlvlocks.h b/indra/newview/rlvlocks.h
index ecfe596a03..1f5393e757 100644
--- a/indra/newview/rlvlocks.h
+++ b/indra/newview/rlvlocks.h
@@ -152,8 +152,7 @@ protected:
 	 * Member functions
 	 */
 protected:
-	// NOTE: attach/detach do *not* respect attachment locks so use with care
-	void attach(const LLUUID& idItem, S32 idxAttachPt);
+	// NOTE: detach does *not* respect attachment locks so use with care
 	void detach(const LLViewerObject* pAttachObj);
 	void detach(S32 idxAttachPt, const LLViewerObject* pAttachObjExcept = NULL);
 
-- 
GitLab