Added one more delegate to Caps, and a few guards, so that these objects can be used from more than just Scenes. Added the NewFileAgentInvengory cap to HGInventoryService.
parent
fc1b1bc797
commit
7322e19212
|
@ -49,6 +49,8 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||||
|
|
||||||
public delegate void NewInventoryItem(UUID userID, InventoryItemBase item);
|
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 UUID ItemUpdatedCallback(UUID userID, UUID itemID, byte[] data);
|
||||||
|
|
||||||
public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
|
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
|
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||||
// receive capability calls
|
// receive capability calls
|
||||||
public NewInventoryItem AddNewInventoryItem = null;
|
public NewInventoryItem AddNewInventoryItem = null;
|
||||||
|
public NewAsset AddNewAsset = null;
|
||||||
public ItemUpdatedCallback ItemUpdatedCall = null;
|
public ItemUpdatedCallback ItemUpdatedCall = null;
|
||||||
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
|
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
|
||||||
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
|
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
|
||||||
|
@ -674,12 +677,19 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
|
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" ||
|
if (llsdRequest.asset_type == "texture" ||
|
||||||
llsdRequest.asset_type == "animation" ||
|
llsdRequest.asset_type == "animation" ||
|
||||||
llsdRequest.asset_type == "sound")
|
llsdRequest.asset_type == "sound")
|
||||||
{
|
{
|
||||||
IClientAPI client = GetClient(m_agentID);
|
IClientAPI client = null;
|
||||||
IScene scene = client.Scene;
|
IScene scene = null;
|
||||||
|
if (GetClient != null)
|
||||||
|
{
|
||||||
|
client = GetClient(m_agentID);
|
||||||
|
scene = client.Scene;
|
||||||
|
|
||||||
IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
|
IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>();
|
||||||
|
|
||||||
|
@ -687,6 +697,7 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||||
{
|
{
|
||||||
if (!mm.UploadCovered(client))
|
if (!mm.UploadCovered(client))
|
||||||
{
|
{
|
||||||
|
if (client != null)
|
||||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||||
|
|
||||||
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse();
|
||||||
|
@ -696,8 +707,8 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
|
|
||||||
|
|
||||||
string assetName = llsdRequest.name;
|
string assetName = llsdRequest.name;
|
||||||
string assetDes = llsdRequest.description;
|
string assetDes = llsdRequest.description;
|
||||||
|
@ -771,6 +782,9 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||||
asset.Type = assType;
|
asset.Type = assType;
|
||||||
asset.Name = assetName;
|
asset.Name = assetName;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
if (AddNewAsset != null)
|
||||||
|
AddNewAsset(asset);
|
||||||
|
else if (m_assetCache != null)
|
||||||
m_assetCache.AddAsset(asset);
|
m_assetCache.AddAsset(asset);
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
|
|
@ -234,6 +234,11 @@ namespace OpenSim.Framework.Communications.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
AddItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
public InventoryItemBase UpdateItem(InventoryItemBase item)
|
public InventoryItemBase UpdateItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner);
|
m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner);
|
||||||
|
@ -372,6 +377,11 @@ namespace OpenSim.Framework.Communications.Services
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PostAnAsset(AssetBase asset)
|
||||||
|
{
|
||||||
|
PostAsset(asset);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see>
|
/// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -598,6 +608,10 @@ namespace OpenSim.Framework.Communications.Services
|
||||||
Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory");
|
Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory");
|
||||||
caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/");
|
caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/");
|
||||||
caps.ItemUpdatedCall = UpdateInventoryItemAsset;
|
caps.ItemUpdatedCall = UpdateInventoryItemAsset;
|
||||||
|
caps.AddNewInventoryItem = AddUploadedInventoryItem;
|
||||||
|
caps.AddNewAsset = PostAnAsset;
|
||||||
|
//caps.GetClient =
|
||||||
|
|
||||||
Hashtable capsHandlers = caps.CapsHandlers.CapsDetails;
|
Hashtable capsHandlers = caps.CapsHandlers.CapsDetails;
|
||||||
|
|
||||||
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||||
|
|
Loading…
Reference in New Issue