aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs42
1 files changed, 28 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 94614a1..1423e3a 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Framework.Communications.Capabilities
49 49
50 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item); 50 public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
51 51
52 public delegate void NewAsset(AssetBase asset);
53
52 public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data); 54 public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
53 55
54 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, 56 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
@@ -120,6 +122,7 @@ namespace OpenSim.Framework.Communications.Capabilities
120 // These are callbacks which will be setup by the scene so that we can update scene data when we 122 // These are callbacks which will be setup by the scene so that we can update scene data when we
121 // receive capability calls 123 // receive capability calls
122 public NewInventoryItem AddNewInventoryItem = null; 124 public NewInventoryItem AddNewInventoryItem = null;
125 public NewAsset AddNewAsset = null;
123 public ItemUpdatedCallback ItemUpdatedCall = null; 126 public ItemUpdatedCallback ItemUpdatedCall = null;
124 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; 127 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
125 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; 128 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
@@ -674,30 +677,38 @@ namespace OpenSim.Framework.Communications.Capabilities
674 /// <returns></returns> 677 /// <returns></returns>
675 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 678 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
676 { 679 {
680 //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString());
681 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
682
677 if (llsdRequest.asset_type == "texture" || 683 if (llsdRequest.asset_type == "texture" ||
678 llsdRequest.asset_type == "animation" || 684 llsdRequest.asset_type == "animation" ||
679 llsdRequest.asset_type == "sound") 685 llsdRequest.asset_type == "sound")
680 { 686 {
681 IClientAPI client = GetClient(m_agentID); 687 IClientAPI client = null;
682 IScene scene = client.Scene; 688 IScene scene = null;
689 if (GetClient != null)
690 {
691 client = GetClient(m_agentID);
692 scene = client.Scene;
683 693
684 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); 694 IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
685 695
686 if (mm != null) 696 if (mm != null)
687 {
688 if (!mm.UploadCovered(client))
689 { 697 {
690 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 698 if (!mm.UploadCovered(client))
691 699 {
692 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); 700 if (client != null)
693 errorResponse.uploader = ""; 701 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
694 errorResponse.state = "error"; 702
695 return errorResponse; 703 LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
704 errorResponse.uploader = "";
705 errorResponse.state = "error";
706 return errorResponse;
707 }
696 } 708 }
697 } 709 }
698 } 710 }
699 711
700 //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
701 712
702 string assetName = llsdRequest.name; 713 string assetName = llsdRequest.name;
703 string assetDes = llsdRequest.description; 714 string assetDes = llsdRequest.description;
@@ -771,7 +782,10 @@ namespace OpenSim.Framework.Communications.Capabilities
771 asset.Type = assType; 782 asset.Type = assType;
772 asset.Name = assetName; 783 asset.Name = assetName;
773 asset.Data = data; 784 asset.Data = data;
774 m_assetCache.AddAsset(asset); 785 if (AddNewAsset != null)
786 AddNewAsset(asset);
787 else if (m_assetCache != null)
788 m_assetCache.AddAsset(asset);
775 789
776 InventoryItemBase item = new InventoryItemBase(); 790 InventoryItemBase item = new InventoryItemBase();
777 item.Owner = m_agentID; 791 item.Owner = m_agentID;