Example #1
0
LLKeyTool::LLKeyTool(LLUUID key, void (*callback)(LLUUID, LLKeyType, LLAssetType::EType, BOOL, void*), void* user_data)
{
	mKey = key;
	mCallback = callback;
	//lets add our handlers to the message system.
	if(mKeyTools.empty())
	{
		mObjectPropertiesFamilyConnection = gMessageSystem->addHandlerFuncFast(_PREHASH_ObjectPropertiesFamily, &LLKeyTool::onObjectPropertiesFamily);
		mParcelInfoReplyConnection = gMessageSystem->addHandlerFuncFast(_PREHASH_ParcelInfoReply, &LLKeyTool::onParcelInfoReply);
		mImageDataConnection = gMessageSystem->addHandlerFuncFast(_PREHASH_ImageData, &LLKeyTool::onImageData);
		mImageNotInDatabaseConnection = gMessageSystem->addHandlerFuncFast(_PREHASH_ImageNotInDatabase, &LLKeyTool::onImageNotInDatabase);
		mTransferInfoConnection = gMessageSystem->addHandlerFuncFast(_PREHASH_TransferInfo, &LLKeyTool::onTransferInfo);
	}
	mKeyTools.push_back(this);
	mUserData = user_data;

	tryAgent();
	tryTask();
	tryGroup();
	tryRegion();
	tryParcel();
	tryItem();

	// try assets
	// it seems these come back in reverse order, so order them in reverse...
	std::list<LLAssetType::EType> ordered_asset_types;
	ordered_asset_types.push_back(LLAssetType::AT_BODYPART);
	ordered_asset_types.push_back(LLAssetType::AT_CLOTHING);
	ordered_asset_types.push_back(LLAssetType::AT_GESTURE);
	//ordered_asset_types.push_back(LLAssetType::AT_NOTECARD); // does not work anymore without an item
	ordered_asset_types.push_back(LLAssetType::AT_LANDMARK);
	ordered_asset_types.push_back(LLAssetType::AT_ANIMATION);
	ordered_asset_types.push_back(LLAssetType::AT_SOUND);
	ordered_asset_types.push_back(LLAssetType::AT_TEXTURE);
	for(std::list<LLAssetType::EType>::iterator iter = ordered_asset_types.begin();
		iter != ordered_asset_types.end();
		++iter)
	{
		tryAsset(*iter);
	}
}
LLKeyTool::LLKeyTool(LLUUID key, void (*callback)(LLUUID, LLKeyType, LLAssetType::EType, BOOL, void*), void* user_data)
{
	mKey = key;
	mCallback = callback;
	mKeyTools.push_back(this);
	mUserData = user_data;

	mObjectPropertiesFamilyRequests = 0;
	mParcelInfoRequests = 0;
	mTransferRequests = 0;
	mImageRequests = 0;

	tryAgent();
	tryTask();
	tryGroup();
	//tryRegion();
	tryParcel();
	tryItem();

	// try assets
	// it seems these come back in reverse order, so order them in reverse...
	std::list<LLAssetType::EType> ordered_asset_types;
	ordered_asset_types.push_back(LLAssetType::AT_BODYPART);
	ordered_asset_types.push_back(LLAssetType::AT_CLOTHING);
	ordered_asset_types.push_back(LLAssetType::AT_GESTURE);
	//ordered_asset_types.push_back(LLAssetType::AT_NOTECARD); // does not work anymore without an item
	ordered_asset_types.push_back(LLAssetType::AT_LANDMARK);
	ordered_asset_types.push_back(LLAssetType::AT_ANIMATION);
	ordered_asset_types.push_back(LLAssetType::AT_SOUND);
	ordered_asset_types.push_back(LLAssetType::AT_TEXTURE);
	for(std::list<LLAssetType::EType>::iterator iter = ordered_asset_types.begin();
		iter != ordered_asset_types.end();
		++iter)
	{
		tryAsset(*iter);
	}
}