Backport of V3 inventory loading at login via Henri Beauchamp (Cool VL) with additions from Singularity Viewer

Tue, 27 Dec 2011 12:37:26 +0100

author
Ansariel
date
Tue, 27 Dec 2011 12:37:26 +0100
changeset 1612
a4e050c55225
parent 1611
03d17778bcda
child 1613
2615ecde1159

Backport of V3 inventory loading at login via Henri Beauchamp (Cool VL) with additions from Singularity Viewer

indra/newview/llinventorymodel.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llinventorymodel.cpp	Tue Dec 27 12:35:53 2011 +0100
     1.2 +++ b/indra/newview/llinventorymodel.cpp	Tue Dec 27 12:37:26 2011 +0100
     1.3 @@ -2075,68 +2075,57 @@
     1.4  	return false;
     1.5  }
     1.6  
     1.7 -// OGPX : This loadSkeleton() takes LLSD formated data, other loadSkeleton is for XML-RPC data.
     1.8 -//  There are major differences in what is returned from the XML-RPC authenticate call versus
     1.9 -//  the style and sequence of OGP/llsd style authentication. 
    1.10 -//  In OGP, authentication returns a cap to the skeleton on agent domain. An HTTP GET then occurs on
    1.11 -//  this "agent/inventory-skeleton" cap. This loadSkeleton() 
    1.12 -//  routine is called after that HTTP GET of "agent/inventory-skeleton" cap occurs.  
    1.13 -bool LLInventoryModel::loadSkeleton(
    1.14 -	const LLSD& options,
    1.15 -	const LLUUID& owner_id)
    1.16 +bool LLInventoryModel::loadSkeleton(const LLSD& options, const LLUUID& owner_id)
    1.17  {
    1.18 -	LL_INFOS("OGPX") << "importing inventory skeleton for " << owner_id << LL_ENDL;
    1.19 -	LL_DEBUGS("Inventory") << " skeleton is " << ll_pretty_print_sd(options) << LL_ENDL;
    1.20 +	LL_DEBUGS("LoadInventory") << "Importing inventory skeleton for "
    1.21 +							   << owner_id << LL_ENDL;
    1.22  
    1.23  	typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
    1.24  	cat_set_t temp_cats;
    1.25  
    1.26 -	update_map_t child_counts;
    1.27 -
    1.28 -	LLUUID id;
    1.29 -	LLFolderType::EType preferred_type;
    1.30  	bool rv = true;
    1.31 -	for (LLSD::array_const_iterator it = options.beginArray(); it < options.endArray(); ++it)
    1.32 +	for(LLSD::array_const_iterator it = options.beginArray(), end = options.endArray();
    1.33 +		it != end; ++it)
    1.34  	{
    1.35 -		LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
    1.36 -
    1.37 -		LL_DEBUGS("Inventory") << "cat name, folder, parent, type " << (*it)["name"].asString() << " " << (*it)["folder_id"].asUUID() << " " << (*it)["parent_id"].asUUID() << " " << (*it)["type_default"].asString() << " " << LL_ENDL; // OGPX
    1.38 -		if ((*it)["name"].asString().empty()) goto clean_cat;
    1.39 -		cat->rename((*it)["name"].asString().c_str());
    1.40 -		if ((*it)["folder_id"].asUUID().isNull()) goto clean_cat;
    1.41 -		id = (*it)["folder_id"].asUUID();
    1.42 -		// if an id is null, it locks the viewer.
    1.43 -		if (id.isNull()) goto clean_cat;
    1.44 -		cat->setUUID(id);
    1.45 -		// OGPX : slight change in snowglobe non OGP handling of things with null parents vs OGP9 SVN branch
    1.46 -		// OGPX : so commented this line out for OGPX as well. if((*it)["parent_id"].asUUID().isNull()) goto clean_cat;
    1.47 -		id = (*it)["parent_id"].asUUID();
    1.48 -		cat->setParent(id);
    1.49 -
    1.50 -		preferred_type = LLFolderType::FT_NONE;
    1.51 -		if (!(*it)["type_default"].asString().empty())
    1.52 +		LLSD name = (*it)["name"];
    1.53 +		LLSD folder_id = (*it)["folder_id"];
    1.54 +		LLSD parent_id = (*it)["parent_id"];
    1.55 +		LLSD version = (*it)["version"];
    1.56 +		if (name.isDefined() && folder_id.isDefined() &&
    1.57 +			parent_id.isDefined() && version.isDefined() &&
    1.58 +			folder_id.asUUID().notNull())	// if an id is null, it locks the viewer.
    1.59  		{
    1.60 -			S32 t = (*it)["type_default"].asInteger();
    1.61 -			preferred_type = (LLFolderType::EType)t;
    1.62 +			LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
    1.63 +			cat->rename(name.asString());
    1.64 +			cat->setUUID(folder_id.asUUID());
    1.65 +			cat->setParent(parent_id.asUUID());
    1.66 +
    1.67 +			LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
    1.68 +			LLSD type_default = (*it)["type_default"];
    1.69 +			if (type_default.isDefined())
    1.70 +            {
    1.71 +				preferred_type = (LLFolderType::EType)type_default.asInteger();
    1.72 +            }
    1.73 +            cat->setPreferredType(preferred_type);
    1.74 +			cat->setVersion(version.asInteger());
    1.75 +            temp_cats.insert(cat);
    1.76  		}
    1.77 -		cat->setPreferredType(preferred_type);
    1.78 -		if ((*it)["version"].asString().empty()) goto clean_cat;
    1.79 -		cat->setVersion((*it)["version"].asInteger());
    1.80 -		temp_cats.insert(cat);
    1.81 -		continue;
    1.82 -	clean_cat:
    1.83 -		llwarns << "Unable to import near " << cat->getName() << llendl;
    1.84 -		rv = false;
    1.85 -		//delete cat; // automatic when cat is reasigned or destroyed
    1.86 +		else
    1.87 +		{
    1.88 +			llwarns << "Unable to import near " << name.asString() << llendl;
    1.89 +            rv = false;
    1.90 +		}
    1.91  	}
    1.92 - 
    1.93 +
    1.94  	S32 cached_category_count = 0;
    1.95  	S32 cached_item_count = 0;
    1.96  	if (!temp_cats.empty())
    1.97  	{
    1.98 +		update_map_t child_counts;
    1.99  		cat_array_t categories;
   1.100  		item_array_t items;
   1.101 -		cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
   1.102 +		// Used to mark categories that weren't successfully loaded.
   1.103 +		cat_set_t invalid_categories;
   1.104  		std::string owner_id_str;
   1.105  		owner_id.toString(owner_id_str);
   1.106  		std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));
   1.107 @@ -2203,9 +2192,10 @@
   1.108  			}
   1.109  
   1.110  			// go ahead and add the cats returned during the download
   1.111 -			std::set<LLUUID>::iterator not_cached_id = cached_ids.end();
   1.112 +			std::set<LLUUID>::const_iterator not_cached_id = cached_ids.end();
   1.113  			cached_category_count = cached_ids.size();
   1.114 -			for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.115 +			for (cat_set_t::iterator it = temp_cats.begin();
   1.116 +				 it != temp_cats.end(); ++it)
   1.117  			{
   1.118  				if (cached_ids.find((*it)->getUUID()) == not_cached_id)
   1.119  				{
   1.120 @@ -2219,34 +2209,67 @@
   1.121  				++child_counts[(*it)->getParentUUID()];
   1.122  			}
   1.123  
   1.124 -			// Add all the items loaded which are parented to a
   1.125 -			// category with a correctly cached parent
   1.126 -			count = items.count();
   1.127 -			S32 bad_link_count = 0;
   1.128 +			// Add all the items loaded which are parented to a category with a
   1.129 +			// correctly cached parent
   1.130  			cat_map_t::iterator unparented = mCategoryMap.end();
   1.131 -			for (int i = 0; i < count; ++i)
   1.132 +			// First, we add non-link items and links which base objects have
   1.133 +			// been loaded
   1.134 +			for (item_array_t::const_iterator item_iter = items.begin();
   1.135 +				 item_iter != items.end();
   1.136 +				 ++item_iter)
   1.137  			{
   1.138 -				cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID());
   1.139 +				LLViewerInventoryItem *item = (*item_iter).get();
   1.140 +				const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
   1.141  				
   1.142  				if (cit != unparented)
   1.143  				{
   1.144 -					LLViewerInventoryCategory* cat = cit->second;
   1.145 +					const LLViewerInventoryCategory* cat = cit->second.get();
   1.146 +					if (cat->getVersion() != NO_VERSION && !item->getIsBrokenLink())
   1.147 +					{
   1.148 +						addItem(item);
   1.149 +						cached_item_count++;
   1.150 +						++child_counts[cat->getUUID()];
   1.151 +					}
   1.152 +				}
   1.153 +			}
   1.154 +			// Then we can add the remaining links since their base objects have
   1.155 +			// now all been loaded...
   1.156 +			S32 bad_link_count = 0;
   1.157 +			item_map_t::const_iterator iit;
   1.158 +			for (item_array_t::const_iterator item_iter = items.begin();
   1.159 +				 item_iter != items.end();
   1.160 +				 ++item_iter)
   1.161 +			{
   1.162 +				LLViewerInventoryItem *item = (*item_iter).get();
   1.163 +				const cat_map_t::iterator cit = mCategoryMap.find(item->getParentUUID());
   1.164 +				
   1.165 +				if (cit != unparented)
   1.166 +				{
   1.167 +					const LLViewerInventoryCategory* cat = cit->second.get();
   1.168  					if (cat->getVersion() != NO_VERSION)
   1.169  					{
   1.170 -						// This can happen if the linked object's baseobj is removed from the cache but the linked object is still in the cache.
   1.171 -						if (items[i]->getIsBrokenLink())
   1.172 +						iit = mItemMap.find(item->getUUID());
   1.173 +						if (iit == mItemMap.end())	// not yet added
   1.174  						{
   1.175 -							bad_link_count++;
   1.176 -							lldebugs << "Attempted to add cached link item without baseobj present ( name: "
   1.177 -									 << items[i]->getName() << " itemID: " << items[i]->getUUID()
   1.178 -									 << " assetID: " << items[i]->getAssetUUID()
   1.179 -									 << " ).  Ignoring and invalidating " << cat->getName() << " . " << llendl;
   1.180 -							invalid_categories.insert(cit->second);
   1.181 -							continue;
   1.182 +							// This can happen if the linked object's baseobj is
   1.183 +							// removed from the cache but the linked object is
   1.184 +							// still in the cache.
   1.185 +							if (item->getIsBrokenLink())
   1.186 +							{
   1.187 +								bad_link_count++;
   1.188 +								LL_DEBUGS("LoadInventory") << "Attempted to add cached link item without baseobj present (name: "
   1.189 +										 << item->getName() << " - itemID: "
   1.190 +										 << item->getUUID() << " - assetID: "
   1.191 +										 << item->getAssetUUID()
   1.192 +										 << "). Ignoring and invalidating: "
   1.193 +										 << cat->getName() << LL_ENDL;
   1.194 +								invalid_categories.insert(cit->second);
   1.195 +								continue;
   1.196 +							}
   1.197 +							addItem(item);
   1.198 +							cached_item_count++;
   1.199 +							++child_counts[cat->getUUID()];
   1.200  						}
   1.201 -						addItem(items[i]);
   1.202 -						cached_item_count += 1;
   1.203 -						++child_counts[cat->getUUID()];
   1.204  					}
   1.205  				}
   1.206  			}
   1.207 @@ -2261,7 +2284,8 @@
   1.208  		{
   1.209  			// go ahead and add everything after stripping the version
   1.210  			// information.
   1.211 -			for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.212 +			for (cat_set_t::iterator it = temp_cats.begin();
   1.213 +				 it != temp_cats.end(); ++it)
   1.214  			{
   1.215  				LLViewerInventoryCategory *llvic = (*it);
   1.216  				llvic->setVersion(NO_VERSION);
   1.217 @@ -2277,23 +2301,26 @@
   1.218  		{
   1.219  			LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
   1.220  			cat->setVersion(NO_VERSION);
   1.221 -			llinfos << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl;
   1.222 +			llinfos << "Invalidating category name: " << cat->getName()
   1.223 +					<< " - UUID: " << cat->getUUID()
   1.224 +					<< ", due to invalid descendents cache" << llendl;
   1.225  		}
   1.226  
   1.227  		// At this point, we need to set the known descendents for each
   1.228  		// category which successfully cached so that we do not
   1.229  		// needlessly fetch descendents for categories which we have.
   1.230 -		update_map_t::iterator no_child_counts = child_counts.end();
   1.231 -		update_map_t::iterator the_count;
   1.232 -		for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.233 +		update_map_t::const_iterator no_child_counts = child_counts.end();
   1.234 +		for (cat_set_t::iterator it = temp_cats.begin();
   1.235 +			 it != temp_cats.end(); ++it)
   1.236  		{
   1.237 -			LLViewerInventoryCategory* cat = (*it);
   1.238 +			LLViewerInventoryCategory* cat = (*it).get();
   1.239  			if (cat->getVersion() != NO_VERSION)
   1.240  			{
   1.241 -				the_count = child_counts.find(cat->getUUID());
   1.242 +				update_map_t::const_iterator the_count = child_counts.find(cat->getUUID());
   1.243  				if (the_count != no_child_counts)
   1.244  				{
   1.245 -					cat->setDescendentCount((*the_count).second.mValue);
   1.246 +					const S32 num_descendents = (*the_count).second.mValue;
   1.247 +					cat->setDescendentCount(num_descendents);
   1.248  				}
   1.249  				else
   1.250  				{
   1.251 @@ -2316,255 +2343,31 @@
   1.252  		categories.clear(); // will unref and delete entries
   1.253  	}
   1.254  
   1.255 -	LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count
   1.256 +	llinfos << "Successfully loaded " << cached_category_count
   1.257  			<< " categories and " << cached_item_count << " items from cache."
   1.258 -			<< LL_ENDL;
   1.259 +			<< llendl;
   1.260  
   1.261  	return rv;
   1.262  }
   1.263  
   1.264 -bool LLInventoryModel::loadSkeleton(
   1.265 -	const LLInventoryModel::options_t& options,
   1.266 -	const LLUUID& owner_id)
   1.267 +// TODO: get rid of this version once we migrated to the new login method
   1.268 +// (we'd need LLLoginInstance::getInstance()->getResponse() implemented).
   1.269 +bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options,
   1.270 +									const LLUUID& owner_id)
   1.271  {
   1.272 -	lldebugs << "importing inventory skeleton for " << owner_id << llendl;
   1.273 -
   1.274 -	typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
   1.275 -	cat_set_t temp_cats;
   1.276 -
   1.277 -	update_map_t child_counts;
   1.278 -
   1.279 -	LLUUID id;
   1.280 -	LLFolderType::EType preferred_type;
   1.281 -	bool rv = true;
   1.282 -	for(options_t::const_iterator it = options.begin(); it < options.end(); ++it)
   1.283 +	LLSD options_list;
   1.284 +	for (options_t::const_iterator it = options.begin(); it < options.end();
   1.285 +		 it++)
   1.286  	{
   1.287 -		LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
   1.288 -		response_t::const_iterator no_response = (*it).end();
   1.289 -		response_t::const_iterator skel;
   1.290 -		skel = (*it).find("name");
   1.291 -		if(skel == no_response) goto clean_cat;
   1.292 -		cat->rename(std::string((*skel).second));
   1.293 -		skel = (*it).find("folder_id");
   1.294 -		if(skel == no_response) goto clean_cat;
   1.295 -		id.set((*skel).second);
   1.296 -		// if an id is null, it locks the viewer.
   1.297 -		if(id.isNull()) goto clean_cat;
   1.298 -		cat->setUUID(id);
   1.299 -		skel = (*it).find("parent_id");
   1.300 -		if(skel == no_response) goto clean_cat;
   1.301 -		id.set((*skel).second);
   1.302 -		cat->setParent(id);
   1.303 -		skel = (*it).find("type_default");
   1.304 -		preferred_type = LLFolderType::FT_NONE;
   1.305 -		if (skel != no_response)
   1.306 +		LLSD entry;
   1.307 +		for (response_t::const_iterator it2 = it->begin(); it2 != it->end();
   1.308 +			 it2++)
   1.309  		{
   1.310 -			S32 t = atoi((*skel).second.c_str());
   1.311 -			preferred_type = (LLFolderType::EType)t;
   1.312 +			entry[it2->first] = it2->second;
   1.313  		}
   1.314 -		cat->setPreferredType(preferred_type);
   1.315 -		skel = (*it).find("version");
   1.316 -		if(skel == no_response) goto clean_cat;
   1.317 -		cat->setVersion(atoi((*skel).second.c_str()));
   1.318 -		temp_cats.insert(cat);
   1.319 -		continue;
   1.320 -	clean_cat:
   1.321 -		llwarns << "Unable to import near " << cat->getName() << llendl;
   1.322 -		rv = false;
   1.323 -		//delete cat; // automatic when cat is reasigned or destroyed
   1.324 +		options_list.append(entry);
   1.325  	}
   1.326 -
   1.327 -	S32 cached_category_count = 0;
   1.328 -	S32 cached_item_count = 0;
   1.329 -	if(!temp_cats.empty())
   1.330 -	{
   1.331 -		cat_array_t categories;
   1.332 -		item_array_t items;
   1.333 -		cat_set_t invalid_categories; // Used to mark categories that weren't successfully loaded.
   1.334 -		std::string owner_id_str;
   1.335 -		owner_id.toString(owner_id_str);
   1.336 -		std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));
   1.337 -		std::string inventory_filename;
   1.338 -		inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str());
   1.339 -		const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN;
   1.340 -		std::string gzip_filename(inventory_filename);
   1.341 -		gzip_filename.append(".gz");
   1.342 -		LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
   1.343 -		bool remove_inventory_file = false;
   1.344 -		if(fp)
   1.345 -		{
   1.346 -			fclose(fp);
   1.347 -			fp = NULL;
   1.348 -			if(gunzip_file(gzip_filename, inventory_filename))
   1.349 -			{
   1.350 -				// we only want to remove the inventory file if it was
   1.351 -				// gzipped before we loaded, and we successfully
   1.352 -				// gunziped it.
   1.353 -				remove_inventory_file = true;
   1.354 -			}
   1.355 -			else
   1.356 -			{
   1.357 -				llinfos << "Unable to gunzip " << gzip_filename << llendl;
   1.358 -			}
   1.359 -		}
   1.360 -		bool is_cache_obsolete = false;
   1.361 -		if (loadFromFile(inventory_filename, categories, items, is_cache_obsolete))
   1.362 -		{
   1.363 -			// We were able to find a cache of files. So, use what we
   1.364 -			// found to generate a set of categories we should add. We
   1.365 -			// will go through each category loaded and if the version
   1.366 -			// does not match, invalidate the version.
   1.367 -			S32 count = categories.count();
   1.368 -			cat_set_t::iterator not_cached = temp_cats.end();
   1.369 -			std::set<LLUUID> cached_ids;
   1.370 -			for(S32 i = 0; i < count; ++i)
   1.371 -			{
   1.372 -				LLViewerInventoryCategory* cat = categories[i];
   1.373 -				cat_set_t::iterator cit = temp_cats.find(cat);
   1.374 -				if (cit == temp_cats.end())
   1.375 -				{
   1.376 -					continue; // cache corruption?? not sure why this happens -SJB
   1.377 -				}
   1.378 -				LLViewerInventoryCategory* tcat = *cit;
   1.379 -				
   1.380 -				// we can safely ignore anything loaded from file, but
   1.381 -				// not sent down in the skeleton.
   1.382 -				if(cit == not_cached)
   1.383 -				{
   1.384 -					continue;
   1.385 -				}
   1.386 -				if(cat->getVersion() != tcat->getVersion())
   1.387 -				{
   1.388 -					// if the cached version does not match the server version,
   1.389 -					// throw away the version we have so we can fetch the
   1.390 -					// correct contents the next time the viewer opens the folder.
   1.391 -					tcat->setVersion(NO_VERSION);
   1.392 -				}
   1.393 -				else
   1.394 -				{
   1.395 -					cached_ids.insert(tcat->getUUID());
   1.396 -				}
   1.397 -			}
   1.398 -
   1.399 -			// go ahead and add the cats returned during the download
   1.400 -			std::set<LLUUID>::iterator not_cached_id = cached_ids.end();
   1.401 -			cached_category_count = cached_ids.size();
   1.402 -			for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.403 -			{
   1.404 -				if(cached_ids.find((*it)->getUUID()) == not_cached_id)
   1.405 -				{
   1.406 -					// this check is performed so that we do not
   1.407 -					// mark new folders in the skeleton (and not in cache)
   1.408 -					// as being cached.
   1.409 -					LLViewerInventoryCategory *llvic = (*it);
   1.410 -					llvic->setVersion(NO_VERSION);
   1.411 -				}
   1.412 -				addCategory(*it);
   1.413 -				++child_counts[(*it)->getParentUUID()];
   1.414 -			}
   1.415 -
   1.416 -			// Add all the items loaded which are parented to a
   1.417 -			// category with a correctly cached parent
   1.418 -			count = items.count();
   1.419 -			S32 bad_link_count = 0;
   1.420 -			cat_map_t::iterator unparented = mCategoryMap.end();
   1.421 -			for(int i = 0; i < count; ++i)
   1.422 -			{
   1.423 -				cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID());
   1.424 -				
   1.425 -				if(cit != unparented)
   1.426 -				{
   1.427 -					LLViewerInventoryCategory* cat = cit->second;
   1.428 -					if(cat->getVersion() != NO_VERSION)
   1.429 -					{
   1.430 -						// This can happen if the linked object's baseobj is removed from the cache but the linked object is still in the cache.
   1.431 -						if (items[i]->getIsBrokenLink())
   1.432 -						{
   1.433 -							bad_link_count++;
   1.434 -							lldebugs << "Attempted to add cached link item without baseobj present ( name: "
   1.435 -									 << items[i]->getName() << " itemID: " << items[i]->getUUID()
   1.436 -									 << " assetID: " << items[i]->getAssetUUID()
   1.437 -									 << " ).  Ignoring and invalidating " << cat->getName() << " . " << llendl;
   1.438 -							invalid_categories.insert(cit->second);
   1.439 -							continue;
   1.440 -						}
   1.441 -						addItem(items[i]);
   1.442 -						cached_item_count += 1;
   1.443 -						++child_counts[cat->getUUID()];
   1.444 -					}
   1.445 -				}
   1.446 -			}
   1.447 -			if (bad_link_count > 0)
   1.448 -			{
   1.449 -				llinfos << "Attempted to add " << bad_link_count
   1.450 -						<< " cached link items without baseobj present. "
   1.451 -						<< "The corresponding categories were invalidated." << llendl;
   1.452 -			}
   1.453 -		}
   1.454 -		else
   1.455 -		{
   1.456 -			// go ahead and add everything after stripping the version
   1.457 -			// information.
   1.458 -			for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.459 -			{
   1.460 -				LLViewerInventoryCategory *llvic = (*it);
   1.461 -				llvic->setVersion(NO_VERSION);
   1.462 -				addCategory(*it);
   1.463 -			}
   1.464 -		}
   1.465 -
   1.466 -		// Invalidate all categories that failed fetching descendents for whatever
   1.467 -		// reason (e.g. one of the descendents was a broken link).
   1.468 -		for (cat_set_t::iterator invalid_cat_it = invalid_categories.begin();
   1.469 -			 invalid_cat_it != invalid_categories.end();
   1.470 -			 invalid_cat_it++)
   1.471 -		{
   1.472 -			LLViewerInventoryCategory* cat = (*invalid_cat_it).get();
   1.473 -			cat->setVersion(NO_VERSION);
   1.474 -			llinfos << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl;
   1.475 -		}
   1.476 -
   1.477 -		// At this point, we need to set the known descendents for each
   1.478 -		// category which successfully cached so that we do not
   1.479 -		// needlessly fetch descendents for categories which we have.
   1.480 -		update_map_t::iterator no_child_counts = child_counts.end();
   1.481 -		update_map_t::iterator the_count;
   1.482 -		for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
   1.483 -		{
   1.484 -			LLViewerInventoryCategory* cat = (*it);
   1.485 -			if(cat->getVersion() != NO_VERSION)
   1.486 -			{
   1.487 -				the_count = child_counts.find(cat->getUUID());
   1.488 -				if(the_count != no_child_counts)
   1.489 -				{
   1.490 -					cat->setDescendentCount((*the_count).second.mValue);
   1.491 -				}
   1.492 -				else
   1.493 -				{
   1.494 -					cat->setDescendentCount(0);
   1.495 -				}
   1.496 -			}
   1.497 -		}
   1.498 -
   1.499 -		if(remove_inventory_file)
   1.500 -		{
   1.501 -			// clean up the gunzipped file.
   1.502 -			LLFile::remove(inventory_filename);
   1.503 -		}
   1.504 -		if (is_cache_obsolete)
   1.505 -		{
   1.506 -			// If out of date, remove the gzipped file too.
   1.507 -			llwarns << "Inv cache out of date, removing" << llendl;
   1.508 -			LLFile::remove(gzip_filename);
   1.509 -		}
   1.510 -		categories.clear(); // will unref and delete entries
   1.511 -	}
   1.512 -
   1.513 -	LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count
   1.514 -			<< " categories and " << cached_item_count << " items from cache."
   1.515 -			<< LL_ENDL;
   1.516 -
   1.517 -	return rv;
   1.518 +	return loadSkeleton(options_list,owner_id);
   1.519  }
   1.520  
   1.521  // This is a brute force method to rebuild the entire parent-child

mercurial