aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Capabilities/LLSDAssetUploadResponse.cs23
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs48
2 files changed, 68 insertions, 3 deletions
diff --git a/OpenSim/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
index 0d6f7f9..18285b5 100644
--- a/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
+++ b/OpenSim/Capabilities/LLSDAssetUploadResponse.cs
@@ -30,11 +30,32 @@ using System;
30namespace OpenSim.Framework.Capabilities 30namespace OpenSim.Framework.Capabilities
31{ 31{
32 [OSDMap] 32 [OSDMap]
33 public class LLSDAssetUploadResponsePricebrkDown
34 {
35 public int mesh_streaming;
36 public int mesh_physics;
37 public int mesh_instance;
38 public int texture;
39 public int model;
40 }
41
42 [OSDMap]
43 public class LLSDAssetUploadResponseData
44 {
45 public double resource_cost;
46 public double model_streaming_cost;
47 public double simulation_cost;
48 public double physics_cost;
49 public LLSDAssetUploadResponsePricebrkDown upload_price_breakdown = new LLSDAssetUploadResponsePricebrkDown();
50 }
51
52 [OSDMap]
33 public class LLSDAssetUploadResponse 53 public class LLSDAssetUploadResponse
34 { 54 {
35 public string uploader = String.Empty; 55 public string uploader = String.Empty;
36 public string state = String.Empty; 56 public string state = String.Empty;
37 57 public int upload_price = 0;
58 public LLSDAssetUploadResponseData data = null;
38 public LLSDAssetUploadResponse() 59 public LLSDAssetUploadResponse()
39 { 60 {
40 } 61 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index df43991..90ac8ce 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -463,7 +463,26 @@ namespace OpenSim.Region.ClientStack.Linden
463 if (mm != null) 463 if (mm != null)
464 { 464 {
465 // XPTO: The cost should be calculated about here 465 // XPTO: The cost should be calculated about here
466 cost = (uint)mm.UploadCharge; 466
467 if (llsdRequest.asset_type == "mesh")
468 {
469 if (llsdRequest.asset_resources == null)
470 {
471 client.SendAgentAlertMessage("Unable to upload asset. missing information.", false);
472
473 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
474 errorResponse.uploader = "";
475 errorResponse.state = "error";
476 return errorResponse;
477 }
478
479 uint textures_cost = (uint)llsdRequest.asset_resources.texture_list.Array.Count;
480 textures_cost *= (uint)mm.UploadCharge;
481
482 cost = textures_cost;
483 }
484 else
485 cost = (uint)mm.UploadCharge;
467 486
468 if (!mm.UploadCovered(client.AgentId, (int)cost)) 487 if (!mm.UploadCovered(client.AgentId, (int)cost))
469 { 488 {
@@ -486,9 +505,14 @@ namespace OpenSim.Region.ClientStack.Linden
486 UUID parentFolder = llsdRequest.folder_id; 505 UUID parentFolder = llsdRequest.folder_id;
487 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 506 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
488 507
508 uint uploadCost = cost;
509 // don't charge for meshs until we done them
510 if (llsdRequest.asset_type == "mesh")
511 uploadCost = 0;
512
489 AssetUploaderWithCost uploader = 513 AssetUploaderWithCost uploader =
490 new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 514 new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
491 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); 515 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, uploadCost);
492 516
493 m_HostCapsObj.HttpListener.AddStreamHandler( 517 m_HostCapsObj.HttpListener.AddStreamHandler(
494 new BinaryStreamHandler( 518 new BinaryStreamHandler(
@@ -506,11 +530,31 @@ namespace OpenSim.Region.ClientStack.Linden
506 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 530 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase +
507 uploaderPath; 531 uploaderPath;
508 532
533
509 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 534 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
510 uploadResponse.uploader = uploaderURL; 535 uploadResponse.uploader = uploaderURL;
511 uploadResponse.state = "upload"; 536 uploadResponse.state = "upload";
537 uploadResponse.upload_price = (int)cost;
538
539 // use fake values for now
540 if (llsdRequest.asset_type == "mesh")
541 {
542 uploadResponse.data = new LLSDAssetUploadResponseData();
543 uploadResponse.data.model_streaming_cost = 1.0;
544 uploadResponse.data.simulation_cost = 1.5;
545
546 uploadResponse.data.physics_cost = 2.0;
547 uploadResponse.data.resource_cost = 3.0;
548 uploadResponse.data.upload_price_breakdown.mesh_instance = 1;
549 uploadResponse.data.upload_price_breakdown.mesh_physics = 2;
550 uploadResponse.data.upload_price_breakdown.mesh_streaming = 3;
551 uploadResponse.data.upload_price_breakdown.texture = 5;
552 uploadResponse.data.upload_price_breakdown.model = 4;
553 }
554
512 uploader.OnUpLoad += UploadCompleteHandler; 555 uploader.OnUpLoad += UploadCompleteHandler;
513 return uploadResponse; 556 return uploadResponse;
557
514 } 558 }
515 559
516 /// <summary> 560 /// <summary>