diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index 94614a1cc1..1423e3ab28 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Framework.Communications.Capabilities
public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
+ public delegate void NewAsset(AssetBase asset);
+
public delegate UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
@@ -120,6 +122,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// These are callbacks which will be setup by the scene so that we can update scene data when we
// receive capability calls
public NewInventoryItem AddNewInventoryItem = null;
+ public NewAsset AddNewAsset = null;
public ItemUpdatedCallback ItemUpdatedCall = null;
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
@@ -674,30 +677,38 @@ namespace OpenSim.Framework.Communications.Capabilities
///
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
{
+ //m_log.Debug("[CAPS]: NewAgentInventoryRequest Request is: " + llsdRequest.ToString());
+ //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);
+
if (llsdRequest.asset_type == "texture" ||
llsdRequest.asset_type == "animation" ||
llsdRequest.asset_type == "sound")
{
- IClientAPI client = GetClient(m_agentID);
- IScene scene = client.Scene;
-
- IMoneyModule mm = scene.RequestModuleInterface();
-
- if (mm != null)
+ IClientAPI client = null;
+ IScene scene = null;
+ if (GetClient != null)
{
- if (!mm.UploadCovered(client))
- {
- client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
+ client = GetClient(m_agentID);
+ scene = client.Scene;
- LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
- errorResponse.uploader = "";
- errorResponse.state = "error";
- return errorResponse;
+ IMoneyModule mm = scene.RequestModuleInterface();
+
+ if (mm != null)
+ {
+ if (!mm.UploadCovered(client))
+ {
+ if (client != null)
+ client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
+
+ LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
+ errorResponse.uploader = "";
+ errorResponse.state = "error";
+ return errorResponse;
+ }
}
}
}
- //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
string assetName = llsdRequest.name;
string assetDes = llsdRequest.description;
@@ -771,7 +782,10 @@ namespace OpenSim.Framework.Communications.Capabilities
asset.Type = assType;
asset.Name = assetName;
asset.Data = data;
- m_assetCache.AddAsset(asset);
+ if (AddNewAsset != null)
+ AddNewAsset(asset);
+ else if (m_assetCache != null)
+ m_assetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.Owner = m_agentID;
diff --git a/OpenSim/Framework/Communications/Services/HGInventoryService.cs b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
index 7eaed89320..d59d1aede5 100644
--- a/OpenSim/Framework/Communications/Services/HGInventoryService.cs
+++ b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
@@ -234,6 +234,11 @@ namespace OpenSim.Framework.Communications.Services
}
}
+ public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
+ {
+ AddItem(item);
+ }
+
public InventoryItemBase UpdateItem(InventoryItemBase item)
{
m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner);
@@ -372,6 +377,11 @@ namespace OpenSim.Framework.Communications.Services
return true;
}
+ public void PostAnAsset(AssetBase asset)
+ {
+ PostAsset(asset);
+ }
+
///
/// CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])
///
@@ -598,6 +608,10 @@ namespace OpenSim.Framework.Communications.Services
Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory");
caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/");
caps.ItemUpdatedCall = UpdateInventoryItemAsset;
+ caps.AddNewInventoryItem = AddUploadedInventoryItem;
+ caps.AddNewAsset = PostAnAsset;
+ //caps.GetClient =
+
Hashtable capsHandlers = caps.CapsHandlers.CapsDetails;
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler(