From de3971a8d374f6ef04b1e946bb848b1238ef0acb Mon Sep 17 00:00:00 2001
From: diva
Date: Thu, 26 Mar 2009 04:14:33 +0000
Subject: One more -- CopyItem.
---
.../Hypergrid/HGStandaloneInventoryService.cs | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs
index 879e885..b67f6f3 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs
@@ -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;
+ }
+
+ }
+
///
/// Guid to UUID wrapper for same name IInventoryServices method
///
@@ -650,6 +680,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
"POST", AddAndGetCapUrl(authToken, "/MoveItem/", caps), MoveItem, CheckAuthSession));
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler(
"POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), DeleteItem, CheckAuthSession));
+ httpServer.AddStreamHandler(new RestDeserialiseSecureHandler(
+ "POST", AddAndGetCapUrl(authToken, "/CopyItem/", caps), CopyItem, CheckAuthSession));
httpServer.AddStreamHandler(new RestDeserialiseSecureHandler(
"POST", AddAndGetCapUrl(authToken, "/GetAsset/", caps), GetAsset, CheckAuthSession));
--
cgit v1.1