aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs99
1 files changed, 56 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index d3a1447..18cfcbc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -99,34 +99,22 @@ namespace OpenSim.Region.Framework.Scenes
99 /// <param name="item"></param> 99 /// <param name="item"></param>
100 public bool AddInventoryItem(InventoryItemBase item) 100 public bool AddInventoryItem(InventoryItemBase item)
101 { 101 {
102 if (UUID.Zero == item.Folder) 102 InventoryFolderBase folder;
103
104 if (item.Folder == UUID.Zero)
103 { 105 {
104 InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); 106 folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
105 if (f != null) 107 if (folder == null)
106 {
107// m_log.DebugFormat(
108// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
109// f.Name, (AssetType)f.Type, item.Name);
110
111 item.Folder = f.ID;
112 }
113 else
114 { 108 {
115 f = InventoryService.GetRootFolder(item.Owner); 109 folder = InventoryService.GetRootFolder(item.Owner);
116 if (f != null) 110
117 { 111 if (folder == null)
118 item.Folder = f.ID;
119 }
120 else
121 {
122 m_log.WarnFormat(
123 "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
124 item.Owner, item.Name);
125 return false; 112 return false;
126 }
127 } 113 }
114
115 item.Folder = folder.ID;
128 } 116 }
129 117
130 if (InventoryService.AddItem(item)) 118 if (InventoryService.AddItem(item))
131 { 119 {
132 int userlevel = 0; 120 int userlevel = 0;
@@ -252,8 +240,7 @@ namespace OpenSim.Region.Framework.Scenes
252 240
253 // Update item with new asset 241 // Update item with new asset
254 item.AssetID = asset.FullID; 242 item.AssetID = asset.FullID;
255 if (group.UpdateInventoryItem(item)) 243 group.UpdateInventoryItem(item);
256 remoteClient.SendAgentAlertMessage("Script saved", false);
257 244
258 part.GetProperties(remoteClient); 245 part.GetProperties(remoteClient);
259 246
@@ -264,12 +251,7 @@ namespace OpenSim.Region.Framework.Scenes
264 { 251 {
265 // Needs to determine which engine was running it and use that 252 // Needs to determine which engine was running it and use that
266 // 253 //
267 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 254 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0);
268 errors = part.Inventory.GetScriptErrors(item.ItemID);
269 }
270 else
271 {
272 remoteClient.SendAgentAlertMessage("Script saved", false);
273 } 255 }
274 part.ParentGroup.ResumeScripts(); 256 part.ParentGroup.ResumeScripts();
275 return errors; 257 return errors;
@@ -683,6 +665,8 @@ namespace OpenSim.Region.Framework.Scenes
683 return; 665 return;
684 } 666 }
685 667
668 if (newName == null) newName = item.Name;
669
686 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 670 AssetBase asset = AssetService.Get(item.AssetID.ToString());
687 671
688 if (asset != null) 672 if (asset != null)
@@ -730,6 +714,24 @@ namespace OpenSim.Region.Framework.Scenes
730 } 714 }
731 715
732 /// <summary> 716 /// <summary>
717 /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit)
718 /// </summary>
719 public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder)
720 {
721 List<InventoryItemBase> moveitems = new List<InventoryItemBase>();
722 foreach (InventoryItemBase b in items)
723 {
724 CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
725 InventoryItemBase n = InventoryService.GetItem(b);
726 n.Folder = destfolder;
727 moveitems.Add(n);
728 remoteClient.SendInventoryItemCreateUpdate(n, 0);
729 }
730
731 MoveInventoryItem(remoteClient, moveitems);
732 }
733
734 /// <summary>
733 /// Move an item within the agent's inventory. 735 /// Move an item within the agent's inventory.
734 /// </summary> 736 /// </summary>
735 /// <param name="remoteClient"></param> 737 /// <param name="remoteClient"></param>
@@ -966,8 +968,12 @@ namespace OpenSim.Region.Framework.Scenes
966 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) 968 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
967 { 969 {
968 SceneObjectPart part = GetSceneObjectPart(localID); 970 SceneObjectPart part = GetSceneObjectPart(localID);
969 SceneObjectGroup group = part.ParentGroup; 971 SceneObjectGroup group = null;
970 if (group != null) 972 if (part != null)
973 {
974 group = part.ParentGroup;
975 }
976 if (part != null && group != null)
971 { 977 {
972 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) 978 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
973 return; 979 return;
@@ -1414,13 +1420,6 @@ namespace OpenSim.Region.Framework.Scenes
1414 { 1420 {
1415 agentTransactions.HandleTaskItemUpdateFromTransaction( 1421 agentTransactions.HandleTaskItemUpdateFromTransaction(
1416 remoteClient, part, transactionID, currentItem); 1422 remoteClient, part, transactionID, currentItem);
1417
1418 if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
1419 remoteClient.SendAgentAlertMessage("Notecard saved", false);
1420 else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
1421 remoteClient.SendAgentAlertMessage("Script saved", false);
1422 else
1423 remoteClient.SendAgentAlertMessage("Item saved", false);
1424 } 1423 }
1425 1424
1426 // Base ALWAYS has move 1425 // Base ALWAYS has move
@@ -1538,7 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes
1538 return; 1537 return;
1539 1538
1540 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1539 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
1541 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), 1540 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
1542 remoteClient.AgentId); 1541 remoteClient.AgentId);
1543 AssetService.Store(asset); 1542 AssetService.Store(asset);
1544 1543
@@ -1733,11 +1732,19 @@ namespace OpenSim.Region.Framework.Scenes
1733 // Invalid id 1732 // Invalid id
1734 SceneObjectPart part = GetSceneObjectPart(localID); 1733 SceneObjectPart part = GetSceneObjectPart(localID);
1735 if (part == null) 1734 if (part == null)
1735 {
1736 //Client still thinks the object exists, kill it
1737 SendKillObject(localID);
1736 continue; 1738 continue;
1739 }
1737 1740
1738 // Already deleted by someone else 1741 // Already deleted by someone else
1739 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1742 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
1743 {
1744 //Client still thinks the object exists, kill it
1745 SendKillObject(localID);
1740 continue; 1746 continue;
1747 }
1741 1748
1742 // Can't delete child prims 1749 // Can't delete child prims
1743 if (part != part.ParentGroup.RootPart) 1750 if (part != part.ParentGroup.RootPart)
@@ -1759,15 +1766,21 @@ namespace OpenSim.Region.Framework.Scenes
1759 } 1766 }
1760 else 1767 else
1761 { 1768 {
1762 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 1769 if (action == DeRezAction.TakeCopy)
1770 {
1771 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
1772 permissionToTakeCopy = false;
1773 }
1774 else
1775 {
1763 permissionToTakeCopy = false; 1776 permissionToTakeCopy = false;
1777 }
1764 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 1778 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1765 permissionToTake = false; 1779 permissionToTake = false;
1766 1780
1767 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 1781 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
1768 permissionToDelete = false; 1782 permissionToDelete = false;
1769 } 1783 }
1770
1771 } 1784 }
1772 1785
1773 // Handle god perms 1786 // Handle god perms