One more -- CopyItem.

0.6.5-rc1
diva 2009-03-26 04:14:33 +00:00
parent 3b08f17fc2
commit de3971a8d3
1 changed files with 32 additions and 0 deletions

View File

@ -399,6 +399,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
}
}
public InventoryItemBase DeleteItem(InventoryItemBase item)
{
item = m_inventoryService.GetInventoryItem(item.ID);
@ -411,6 +412,35 @@ namespace OpenSim.Region.CoreModules.Hypergrid
}
}
public InventoryItemBase CopyItem(InventoryItemBase olditem)
{
InventoryItemBase Item = m_inventoryService.GetInventoryItem(olditem.ID); // this is the old item id
// BIG HACK here
UUID newID = olditem.AssetID;
if (Item != null)
{
if (olditem.Name != String.Empty)
{
Item.Name = olditem.Name;
}
Item.ID = newID;
Item.Folder = olditem.Folder;
// There should be some tests here about the owner, etc but I'm going to ignore that
// because I'm not sure it makes any sense
// Also I should probably close the asset...
m_inventoryService.AddItem(Item);
return Item;
}
else
{
m_log.Debug("[HGStandaloneInvService]: Failed to find item " + olditem.ID);
olditem.ID = UUID.Zero;
return olditem;
}
}
/// <summary>
/// Guid to UUID wrapper for same name IInventoryServices method
/// </summary>
@ -650,6 +680,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
"POST", AddAndGetCapUrl(authToken, "/MoveItem/", caps), MoveItem, CheckAuthSession));
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
"POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), DeleteItem, CheckAuthSession));
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
"POST", AddAndGetCapUrl(authToken, "/CopyItem/", caps), CopyItem, CheckAuthSession));
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, AssetBase>(
"POST", AddAndGetCapUrl(authToken, "/GetAsset/", caps), GetAsset, CheckAuthSession));