void LLNewAgentInventoryVariablePriceResponder::result(const LLSD& content) { // Parse out application level errors and the appropriate // responses for them static const std::string _ERROR = "error"; static const std::string _STATE = "state"; static const std::string _COMPLETE = "complete"; static const std::string _CONFIRM_UPLOAD = "confirm_upload"; static const std::string _UPLOAD_PRICE = "upload_price"; static const std::string _RESOURCE_COST = "resource_cost"; static const std::string _RSVP = "rsvp"; // Check for application level errors if ( content.has(_ERROR) ) { onApplicationLevelError(content[_ERROR]); return; } std::string state = content[_STATE]; LLAssetType::EType asset_type = mImpl->getAssetType(); if ( _COMPLETE == state ) { // rename file in VFS with new asset id if (mImpl->getFilename().empty()) { // rename the file in the VFS to the actual asset id // llinfos << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << llendl; gVFS->renameFile( mImpl->getVFileID(), asset_type, content["new_asset"].asUUID(), asset_type); } on_new_single_inventory_upload_complete( asset_type, mImpl->getInventoryType(), mImpl->getInventoryTypeString(), mImpl->getFolderID(), mImpl->getItemName(), mImpl->getItemDescription(), content, content[_UPLOAD_PRICE].asInteger()); // TODO* Add bulk (serial) uploading or add // a super class of this that does so } else if ( _CONFIRM_UPLOAD == state ) { showConfirmationDialog( content[_UPLOAD_PRICE].asInteger(), content[_RESOURCE_COST].asInteger(), content[_RSVP].asString()); } else { onApplicationLevelError(""); } }
//virtual void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; //std::ostringstream llsdxml; //LLSDSerialize::toXML(content, llsdxml); //llinfos << "upload complete content:\n " << llsdxml.str() << llendl; LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); S32 expected_upload_cost = 0; // Update L$ and ownership credit information // since it probably changed on the server if (asset_type == LLAssetType::AT_TEXTURE || asset_type == LLAssetType::AT_SOUND || asset_type == LLAssetType::AT_ANIMATION || asset_type == LLAssetType::AT_MESH) { expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); } on_new_single_inventory_upload_complete( asset_type, inventory_type, mPostData["asset_type"].asString(), mPostData["folder_id"].asUUID(), mPostData["name"], mPostData["description"], content, expected_upload_cost); // continue uploading for bulk uploads // *FIX: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. std::string next_file = LLFilePicker::instance().getNextFile(); if(!next_file.empty()) { std::string name = gDirUtilp->getBaseFileName(next_file, true); std::string asset_name = name; LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); LLStringUtil::replaceChar(asset_name, '|', '?'); LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); // Continuing the horrible hack above, we need to extract the originally requested permissions data, if any, // and use them for each next file to be uploaded. Note the requested perms are not the same as the U32 everyone_perms = content.has("new_everyone_mask") ? content["new_everyone_mask"].asInteger() : PERM_NONE; U32 group_perms = content.has("new_group_mask") ? content["new_group_mask"].asInteger() : PERM_NONE; U32 next_owner_perms = content.has("new_next_owner_mask") ? content["new_next_owner_mask"].asInteger() : PERM_NONE; std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource( next_file, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, next_owner_perms, group_perms, everyone_perms, display_name, callback, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), userdata); } //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], TRUE); }
//virtual void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; //std::ostringstream llsdxml; //LLSDSerialize::toXML(content, llsdxml); //llinfos << "upload complete content:\n " << llsdxml.str() << llendl; LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); S32 expected_upload_cost = 0; // Update L$ and ownership credit information // since it probably changed on the server if (asset_type == LLAssetType::AT_TEXTURE || asset_type == LLAssetType::AT_SOUND || asset_type == LLAssetType::AT_ANIMATION || asset_type == LLAssetType::AT_MESH) { expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); } llinfos << "Adding " << content["new_inventory_item"].asUUID() << " " << content["new_asset"].asUUID() << " to inventory." << llendl; on_new_single_inventory_upload_complete( asset_type, inventory_type, mPostData["asset_type"].asString(), mPostData["folder_id"].asUUID(), mPostData["name"], mPostData["description"], content, expected_upload_cost); // continue uploading for bulk uploads if (!gUploadQueue.empty()) { std::string next_file = gUploadQueue.front(); gUploadQueue.pop_front(); if (next_file.empty()) return; std::string name = gDirUtilp->getBaseFileName(next_file, true); std::string asset_name = name; LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); LLStringUtil::replaceChar(asset_name, '|', '?'); LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); // We need to extract the originally requested permissions data, if any, // and use them for each next file to be uploaded. Note the requested // perms are not the same as the granted ones found in the given // "content" structure but can still be found in mPostData. -MG U32 everyone_perms = mPostData.has("everyone_mask") ? mPostData.get("everyone_mask").asInteger() : PERM_NONE; U32 group_perms = mPostData.has("group_mask") ? mPostData.get("group_mask").asInteger() : PERM_NONE; U32 next_owner_perms = mPostData.has("next_owner_mask") ? mPostData.get("next_owner_mask").asInteger() : PERM_NONE; std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource( next_file, asset_name, asset_name, 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, next_owner_perms, group_perms, everyone_perms, display_name, callback, expected_upload_cost, userdata); } }