Merge branch 'inventory_extensions', remote-tracking branch 'origin' into DRTVWR-567
commit
11bd72661c
|
|
@ -3402,6 +3402,7 @@ typedef std::map<const char*, LLMessageBuilder*> BuilderMap;
|
|||
|
||||
void LLMessageSystem::newMessageFast(const char *name)
|
||||
{
|
||||
//LL_DEBUGS("Messaging") << "creating new message: " << name << LL_ENDL;
|
||||
LLMessageConfig::Flavor message_flavor =
|
||||
LLMessageConfig::getMessageFlavor(name);
|
||||
LLMessageConfig::Flavor server_flavor =
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
|
|||
tid.generate();
|
||||
|
||||
std::string url = cap + std::string("/category/") + parentId.asString() + "?tid=" + tid.asString();
|
||||
LL_DEBUGS("Inventory") << "url: " << url << LL_ENDL;
|
||||
LL_DEBUGS("Inventory") << "url: " << url << " parentID " << parentId << " newInventory " << newInventory << LL_ENDL;
|
||||
|
||||
// I may be suffering from golden hammer here, but the first part of this bind
|
||||
// is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
|
||||
|
|
@ -124,7 +124,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
|
|||
(&LLCoreHttpUtil::HttpCoroutineAdapter::postAndSuspend), _1, _2, _3, _4, _5, _6);
|
||||
|
||||
LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
|
||||
_1, postFn, url, parentId, newInventory, callback, COPYINVENTORY));
|
||||
_1, postFn, url, parentId, newInventory, callback, CREATEINVENTORY));
|
||||
EnqueueAISCommand("CreateInventory", proc);
|
||||
}
|
||||
|
||||
|
|
@ -478,6 +478,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
|
|||
LL_WARNS("Inventory") << ll_pretty_print_sd(result) << LL_ENDL;
|
||||
}
|
||||
|
||||
LL_DEBUGS("Inventory") << result << LL_ENDL;
|
||||
gInventory.onAISUpdateReceived("AISCommand", result);
|
||||
|
||||
if (callback && !callback.empty())
|
||||
|
|
@ -487,9 +488,32 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
|
|||
if (result.has("category_id") && (type == COPYLIBRARYCATEGORY))
|
||||
{
|
||||
id = result["category_id"];
|
||||
callback(id);
|
||||
}
|
||||
if (type == CREATEINVENTORY)
|
||||
{
|
||||
if (result.has("_created_categories"))
|
||||
{
|
||||
LLSD& cats = result["_created_categories"];
|
||||
LLSD::array_const_iterator cat_iter;
|
||||
for (cat_iter = cats.beginArray(); cat_iter != cats.endArray(); ++cat_iter)
|
||||
{
|
||||
LLUUID cat_id = *cat_iter;
|
||||
callback(cat_id);
|
||||
}
|
||||
}
|
||||
if (result.has("_created_items"))
|
||||
{
|
||||
LLSD& items = result["_created_items"];
|
||||
LLSD::array_const_iterator item_iter;
|
||||
for (item_iter = items.beginArray(); item_iter != items.endArray(); ++item_iter)
|
||||
{
|
||||
LLUUID item_id = *item_iter;
|
||||
callback(item_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ private:
|
|||
PURGEDESCENDENTS,
|
||||
UPDATECATEGORY,
|
||||
UPDATEITEM,
|
||||
COPYLIBRARYCATEGORY
|
||||
COPYLIBRARYCATEGORY,
|
||||
CREATEINVENTORY
|
||||
} COMMAND_TYPE;
|
||||
|
||||
static const std::string INVENTORY_CAP_NAME;
|
||||
|
|
|
|||
|
|
@ -1701,6 +1701,7 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds
|
|||
{
|
||||
parent_id = gInventory.getRootFolderID();
|
||||
}
|
||||
// USES UDP PATH
|
||||
LLUUID subfolder_id = gInventory.createNewCategory( parent_id,
|
||||
LLFolderType::FT_NONE,
|
||||
src_cat->getName());
|
||||
|
|
@ -2725,7 +2726,8 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap
|
|||
{
|
||||
pid = gInventory.getRootFolderID();
|
||||
}
|
||||
|
||||
|
||||
// UDP PATH
|
||||
LLUUID new_cat_id = gInventory.createNewCategory(
|
||||
pid,
|
||||
LLFolderType::FT_NONE,
|
||||
|
|
@ -3987,6 +3989,7 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
|
|||
// existence of AIS as an indicator the fix is present. Does
|
||||
// not actually use AIS to create the category.
|
||||
inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel);
|
||||
|
||||
LLUUID folder_id = gInventory.createNewCategory(
|
||||
parent_id,
|
||||
LLFolderType::FT_OUTFIT,
|
||||
|
|
@ -3994,7 +3997,8 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
|
|||
func);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// UDP PATH
|
||||
LLUUID folder_id = gInventory.createNewCategory(
|
||||
parent_id,
|
||||
LLFolderType::FT_OUTFIT,
|
||||
|
|
|
|||
|
|
@ -664,24 +664,25 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp
|
|||
// updateCategory() with a newly generated UUID category, but this
|
||||
// version will take care of details like what the name should be
|
||||
// based on preferred type. Returns the UUID of the new category.
|
||||
//
|
||||
// On failure, returns a null UUID.
|
||||
// FIXME: callers do not check for or handle a null results currently.
|
||||
LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
|
||||
LLFolderType::EType preferred_type,
|
||||
const std::string& pname,
|
||||
inventory_func_type callback)
|
||||
{
|
||||
LLUUID id;
|
||||
LLUUID id; // Initially null.
|
||||
if (!isInventoryUsable())
|
||||
{
|
||||
LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type "
|
||||
<< preferred_type << LL_ENDL;
|
||||
// FIXME failing but still returning an id?
|
||||
return id;
|
||||
}
|
||||
|
||||
if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup())
|
||||
{
|
||||
LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL;
|
||||
// FIXME failing but still returning an id?
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
@ -693,38 +694,20 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
|
|||
LL_WARNS(LOG_INV) << "Creating new system folder, type " << preferred_type << LL_ENDL;
|
||||
}
|
||||
|
||||
id.generate();
|
||||
std::string name = pname;
|
||||
if(!pname.empty())
|
||||
{
|
||||
name.assign(pname);
|
||||
}
|
||||
else
|
||||
if (pname.empty())
|
||||
{
|
||||
name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
|
||||
}
|
||||
|
||||
LLViewerRegion* viewer_region = gAgent.getRegion();
|
||||
std::string url;
|
||||
if ( viewer_region )
|
||||
url = viewer_region->getCapability("CreateInventoryCategory");
|
||||
|
||||
if (!url.empty() && callback)
|
||||
if (callback)
|
||||
{
|
||||
//Let's use the new capability.
|
||||
|
||||
LLSD request, body;
|
||||
body["folder_id"] = id;
|
||||
body["parent_id"] = parent_id;
|
||||
body["type"] = (LLSD::Integer) preferred_type;
|
||||
body["name"] = name;
|
||||
|
||||
request["message"] = "CreateInventoryCategory";
|
||||
request["payload"] = body;
|
||||
|
||||
LL_DEBUGS(LOG_INV) << "Creating category via request: " << ll_pretty_print_sd(request) << LL_ENDL;
|
||||
LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro",
|
||||
boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback));
|
||||
LLSD new_inventory = LLSD::emptyMap();
|
||||
new_inventory["categories"] = LLSD::emptyArray();
|
||||
LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID());
|
||||
LLSD cat_sd = cat.asLLSD();
|
||||
new_inventory["categories"].append(cat_sd);
|
||||
AISAPI::CreateInventory(parent_id, new_inventory, callback);
|
||||
|
||||
return LLUUID::null;
|
||||
}
|
||||
|
|
@ -739,6 +722,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
|
|||
// assuming instant success.
|
||||
|
||||
// Add the category to the internal representation
|
||||
id.generate();
|
||||
LLPointer<LLViewerInventoryCategory> cat =
|
||||
new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID());
|
||||
cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue