summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerassetupload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerassetupload.cpp')
-rw-r--r--indra/newview/llviewerassetupload.cpp73
1 files changed, 42 insertions, 31 deletions
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index b00f99cf5c..83d3449b96 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -148,6 +148,22 @@ void LLResourceUploadInfo::logPreparedUpload()
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
}
+S32 LLResourceUploadInfo::getEconomyUploadCost()
+{
+ // Update L$ and ownership credit information
+ // since it probably changed on the server
+ if (getAssetType() == LLAssetType::AT_TEXTURE ||
+ getAssetType() == LLAssetType::AT_SOUND ||
+ getAssetType() == LLAssetType::AT_ANIMATION ||
+ getAssetType() == LLAssetType::AT_MESH)
+ {
+ return LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ }
+
+ return 0;
+}
+
+
LLUUID LLResourceUploadInfo::finishUpload(LLSD &result)
{
if (getFolderId().isNull())
@@ -660,7 +676,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
return;
}
- //self.yield();
+ llcoro::yield();
if (uploadInfo->showUploadDialog())
{
@@ -686,43 +702,38 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
std::string uploader = result["uploader"].asString();
- result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
- httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
- status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-
- if (!status)
+ bool success = false;
+ if (!uploader.empty() && uploadInfo->getAssetId().notNull())
{
- HandleUploadError(status, result, uploadInfo);
- if (uploadInfo->showUploadDialog())
- LLUploadDialog::modalUploadFinished();
- return;
- }
+ result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
+ httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- S32 uploadPrice = 0;
+ if (!status)
+ {
+ HandleUploadError(status, result, uploadInfo);
+ if (uploadInfo->showUploadDialog())
+ LLUploadDialog::modalUploadFinished();
+ return;
+ }
- // Update L$ and ownership credit information
- // since it probably changed on the server
- if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE ||
- uploadInfo->getAssetType() == LLAssetType::AT_SOUND ||
- uploadInfo->getAssetType() == LLAssetType::AT_ANIMATION ||
- uploadInfo->getAssetType() == LLAssetType::AT_MESH)
- {
- uploadPrice = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
- }
+ S32 uploadPrice = uploadInfo->getEconomyUploadCost();
- bool success = false;
+ if (uploadPrice > 0)
+ {
+ // this upload costed us L$, update our balance
+ // and display something saying that it cost L$
+ LLStatusBar::sendMoneyBalanceRequest();
- if (uploadPrice > 0)
+ LLSD args;
+ args["AMOUNT"] = llformat("%d", uploadPrice);
+ LLNotificationsUtil::add("UploadPayment", args);
+ }
+ }
+ else
{
- // this upload costed us L$, update our balance
- // and display something saying that it cost L$
- LLStatusBar::sendMoneyBalanceRequest();
-
- LLSD args;
- args["AMOUNT"] = llformat("%d", uploadPrice);
- LLNotificationsUtil::add("UploadPayment", args);
+ LL_WARNS() << "No upload url provided. Nothing uploaded, responding with previous result." << LL_ENDL;
}
-
LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
if (uploadInfo->showInventoryPanel())