From 4d1072a0a8912748bc62d42617cc6d5679a1bf20 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Fri, 3 Apr 2015 18:36:14 +0300
Subject: [PATCH] MAINT-4878 FIXED Outfits worn from library copy the
 subfolders too

---
 indra/newview/llaisapi.cpp        | 7 ++++++-
 indra/newview/llaisapi.h          | 2 +-
 indra/newview/llappearancemgr.cpp | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 9d887a61f10..714b456ae72 100755
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -315,7 +315,8 @@ SlamFolderCommand::SlamFolderCommand(const LLUUID& folder_id, const LLSD& conten
 
 CopyLibraryCategoryCommand::CopyLibraryCategoryCommand(const LLUUID& source_id,
 													   const LLUUID& dest_id,
-													   LLPointer<LLInventoryCallback> callback):
+													   LLPointer<LLInventoryCallback> callback,
+													   bool copy_subfolders):
 	AISCommand(callback)
 {
 	std::string cap;
@@ -328,6 +329,10 @@ CopyLibraryCategoryCommand::CopyLibraryCategoryCommand(const LLUUID& source_id,
 	LLUUID tid;
 	tid.generate();
 	std::string url = cap + std::string("/category/") + source_id.asString() + "?tid=" + tid.asString();
+	if (!copy_subfolders)
+	{
+		url += ",depth=0";
+	}
 	LL_INFOS() << url << LL_ENDL;
 	LLCurl::ResponderPtr responder = this;
 	LLSD headers;
diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h
index 5a2ec94af98..bb483fb1335 100755
--- a/indra/newview/llaisapi.h
+++ b/indra/newview/llaisapi.h
@@ -124,7 +124,7 @@ class SlamFolderCommand: public AISCommand
 class CopyLibraryCategoryCommand: public AISCommand
 {
 public:
-	CopyLibraryCategoryCommand(const LLUUID& source_id, const LLUUID& dest_id, LLPointer<LLInventoryCallback> callback);
+	CopyLibraryCategoryCommand(const LLUUID& source_id, const LLUUID& dest_id, LLPointer<LLInventoryCallback> callback, bool copy_subfolders = true);
 
 protected:
 	/* virtual */ bool getResponseUUID(const LLSD& content, LLUUID& id);
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index c6971edf9f8..0ac0dccc4e6 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2357,7 +2357,7 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
 		LLPointer<LLInventoryCallback> copy_cb = new LLWearCategoryAfterCopy(append);
 		LLPointer<LLInventoryCallback> track_cb = new LLTrackPhaseWrapper(
 													std::string("wear_inventory_category_callback"), copy_cb);
-		LLPointer<AISCommand> cmd_ptr = new CopyLibraryCategoryCommand(category->getUUID(), parent_id, track_cb);
+		LLPointer<AISCommand> cmd_ptr = new CopyLibraryCategoryCommand(category->getUUID(), parent_id, track_cb, false);
 		ais_ran=cmd_ptr->run_command();
 	}
 
-- 
GitLab