Commit fe9fc121 authored by Cinder's avatar Cinder
Browse files

Fix ALCH-463

parent c08a2e00
......@@ -1524,16 +1524,11 @@ void LLAOEngine::tick()
{
if (!isAgentAvatarValid()) return;
const LLUUID categoryID = gInventory.findDescendentCategoryIDByName(gInventory.getRootFolderID(), ROOT_AO_FOLDER);
LLUUID const& category_id = gInventory.findCategoryUUIDForNameInRoot(ROOT_AO_FOLDER, true, gInventory.getRootFolderID());
if (categoryID.isNull())
if (category_id.notNull())
{
LL_WARNS("AOEngine") << "no " << ROOT_AO_FOLDER << " folder yet. Creating ..." << LL_ENDL;
gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, ROOT_AO_FOLDER);
}
else
{
mAOFolder = categoryID;
mAOFolder = category_id;
LL_INFOS("AOEngine") << "AO basic folder structure intact." << LL_ENDL;
update();
}
......
......@@ -467,6 +467,8 @@ void LLInventoryModel::consolidateForType(const LLUUID& main_id, LLFolderType::E
}
}
const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot(
LLFolderType::EType preferred_type,
bool create_folder,
......@@ -508,6 +510,39 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot(
return rv;
}
const LLUUID LLInventoryModel::findCategoryUUIDForNameInRoot(std::string const& folder_name, bool create_folder, LLUUID const& root_id)
{
LLUUID rv = LLUUID::null;
if (root_id.notNull())
{
cat_array_t* cats = nullptr;
cats = get_ptr_in_map(mParentChildCategoryTree, root_id);
if (cats)
{
U32 count = cats->size();
for (U32 i = 0; i < count; ++i)
{
if (cats->at(i)->getName() == folder_name)
{
LLUUID const& folder_id = cats->at(i)->getUUID();
if (rv.isNull() || folder_id < rv)
{
rv = folder_id;
}
}
}
}
}
if (rv.isNull() && isInventoryUsable() && create_folder)
{
if (root_id.notNull())
{
return createNewCategory(root_id, LLFolderType::FT_NONE, folder_name);
}
}
return rv;
}
// findCategoryUUIDForType() returns the uuid of the category that
// specifies 'type' as what it defaults to containing. The category is
// not necessarily only for that type. *NOTE: This will create a new
......@@ -4270,4 +4305,3 @@ void LLInventoryModel::FetchItemHttpHandler::processFailure(const char * const r
<< LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
gInventory.notifyObservers();
}
......@@ -268,6 +268,10 @@ public:
bool create_folder,
const LLUUID& root_id);
const LLUUID findCategoryUUIDForNameInRoot(std::string const& folder_name,
bool create_folder,
LLUUID const& root_id);
// Returns the uuid of the category that specifies 'type' as what it
// defaults to containing. The category is not necessarily only for that type.
// NOTE: If create_folder is true, this will create a new inventory category
......@@ -281,7 +285,7 @@ public:
// Returns user specified category for uploads, returns default id if there are no
// user specified one or it does not exist, creates default category if it is missing.
const LLUUID findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type);
// Returns the uuid of the category if found, LLUUID::null is not
const LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,
const std::string& name) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment