aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-04 01:36:26 +0100
committerJustin Clark-Casey (justincc)2010-09-04 01:36:26 +0100
commit1e8e98a07fdad6cff4be780083b3d9ad2360b8e7 (patch)
tree525953a28c694123fc1450e882dca65aa620e124
parentCreate Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) (diff)
downloadopensim-SC-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.zip
opensim-SC-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.gz
opensim-SC-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.bz2
opensim-SC-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.xz
Move code that allows llGiveInvetory() to move item into appropriate system folder up from connectors into Scene.Inventory.cs
This fixes the problem for all architectures (hg as well as local and grid) and means we don't have to dupe code between connectors. Not ideal in that it becomes non-modular, but methods in Scene.Inventory.cs should eventually be modularized anyway.
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs23
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs28
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs48
8 files changed, 56 insertions, 80 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index c713e19..4b5710a 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -1602,8 +1602,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1602 destinationItem.CreationDate = item.CreationDate; 1602 destinationItem.CreationDate = item.CreationDate;
1603 destinationItem.Folder = destinationFolder.ID; 1603 destinationItem.Folder = destinationFolder.ID;
1604 1604
1605 inventoryService.AddItem(destinationItem); 1605 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1606 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1606 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1607 1607
1608 // Wear item 1608 // Wear item
1609 AvatarWearable newWearable = new AvatarWearable(); 1609 AvatarWearable newWearable = new AvatarWearable();
@@ -1613,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1613 } 1613 }
1614 else 1614 else
1615 { 1615 {
1616 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); 1616 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
1617 } 1617 }
1618 } 1618 }
1619 } 1619 }
@@ -1655,16 +1655,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1655 destinationItem.CreationDate = item.CreationDate; 1655 destinationItem.CreationDate = item.CreationDate;
1656 destinationItem.Folder = destinationFolder.ID; 1656 destinationItem.Folder = destinationFolder.ID;
1657 1657
1658 inventoryService.AddItem(destinationItem); 1658 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1659 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); 1659 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1660 1660
1661 // Attach item 1661 // Attach item
1662 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1662 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1663 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1663 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1664 } 1664 }
1665 else 1665 else
1666 { 1666 {
1667 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); 1667 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
1668 } 1668 }
1669 } 1669 }
1670 } 1670 }
@@ -1762,16 +1762,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1762 destinationItem.CreationDate = item.CreationDate; 1762 destinationItem.CreationDate = item.CreationDate;
1763 destinationItem.Folder = extraFolder.ID; 1763 destinationItem.Folder = extraFolder.ID;
1764 1764
1765 inventoryService.AddItem(destinationItem); 1765 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
1766 inventoryMap.Add(item.ID, destinationItem.ID); 1766 inventoryMap.Add(item.ID, destinationItem.ID);
1767 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); 1767 m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
1768 1768
1769 // Attach item, if original is attached 1769 // Attach item, if original is attached
1770 int attachpoint = avatarAppearance.GetAttachpoint(item.ID); 1770 int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
1771 if (attachpoint != 0) 1771 if (attachpoint != 0)
1772 { 1772 {
1773 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); 1773 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1774 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); 1774 m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
1775 } 1775 }
1776 } 1776 }
1777 } 1777 }
@@ -1790,7 +1790,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1790 private bool CreateDefaultAvatars() 1790 private bool CreateDefaultAvatars()
1791 { 1791 {
1792 // Only load once 1792 // Only load once
1793
1794 if (m_defaultAvatarsLoaded) 1793 if (m_defaultAvatarsLoaded)
1795 { 1794 {
1796 return false; 1795 return false;
@@ -2048,7 +2047,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2048 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); 2047 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
2049 inventoryItem.Folder = extraFolder.ID; // Parent folder 2048 inventoryItem.Folder = extraFolder.ID; // Parent folder
2050 2049
2051 inventoryService.AddItem(inventoryItem); 2050 m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
2052 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); 2051 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
2053 } 2052 }
2054 2053
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index c791cb4..4609738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
214 { 214 {
215 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); 215 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
216 216
217 IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
218
219 InventoryItemBase item = new InventoryItemBase(); 217 InventoryItemBase item = new InventoryItemBase();
220 item.Owner = ourClient.AgentId; 218 item.Owner = ourClient.AgentId;
221 item.CreatorId = ourClient.AgentId.ToString(); 219 item.CreatorId = ourClient.AgentId.ToString();
@@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
234 item.Flags = (uint) wearableType; 232 item.Flags = (uint) wearableType;
235 item.CreationDate = Util.UnixTimeSinceEpoch(); 233 item.CreationDate = Util.UnixTimeSinceEpoch();
236 234
237 if (invService.AddItem(item)) 235 if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
238 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 236 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
239 else 237 else
240 ourClient.SendAlertMessage("Unable to create inventory item"); 238 ourClient.SendAlertMessage("Unable to create inventory item");
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 22c84e9..52342ec 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
406 // Reset folder ID to the one in which we want to load it 406 // Reset folder ID to the one in which we want to load it
407 item.Folder = loadFolder.ID; 407 item.Folder = loadFolder.ID;
408 408
409 //m_userInfo.AddItem(item); 409 m_scene.AddInventoryItem(item);
410 m_scene.InventoryService.AddItem(item);
411 410
412 return item; 411 return item;
413 } 412 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 2ac2324..d87f7f1 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
425 item.Name = asset.Name; 425 item.Name = asset.Name;
426 item.AssetType = asset.Type; 426 item.AssetType = asset.Type;
427 427
428 m_Scene.InventoryService.AddItem(item); 428 m_Scene.AddInventoryItem(item);
429 429
430 if (remoteClient != null && item.Owner == remoteClient.AgentId) 430 if (remoteClient != null && item.Owner == remoteClient.AgentId)
431 { 431 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 06b40b3..cbd9e05 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
221// m_log.DebugFormat( 221// m_log.DebugFormat(
222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", 222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
223// item.Name, item.Owner, item.Folder); 223// item.Name, item.Owner, item.Folder);
224
225 if (UUID.Zero == item.Folder)
226 {
227 InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
228 if (f != null)
229 {
230// m_log.DebugFormat(
231// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
232// f.Name, (AssetType)f.Type, item.Name);
233
234 item.Folder = f.ID;
235 }
236 else
237 {
238 f = m_InventoryService.GetRootFolder(item.Owner);
239 if (f != null)
240 {
241 item.Folder = f.ID;
242 }
243 else
244 {
245 m_log.WarnFormat(
246 "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
247 item.Owner, item.Name);
248 return false;
249 }
250 }
251 }
252 224
253 return m_InventoryService.AddItem(item); 225 return m_InventoryService.AddItem(item);
254 } 226 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 4211fa9..4ab6947 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
227 public bool AddItem(InventoryItemBase item) 227 public bool AddItem(InventoryItemBase item)
228 { 228 {
229 if (item == null) 229 if (item == null)
230 return false; 230 return false;
231
232 if (UUID.Zero == item.Folder)
233 {
234 InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
235 if (f != null)
236 {
237 item.Folder = f.ID;
238 }
239 else
240 {
241 f = m_RemoteConnector.GetRootFolder(item.Owner);
242 if (f != null)
243 {
244 item.Folder = f.ID;
245 }
246 else
247 {
248 m_log.WarnFormat(
249 "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
250 item.Owner, item.Name);
251 return false;
252 }
253 }
254 }
255 231
256 return m_RemoteConnector.AddItem(item); 232 return m_RemoteConnector.AddItem(item);
257 } 233 }
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 8ce6daf..12750c5 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
219 item.CurrentPermissions |= 16; // Slam! 219 item.CurrentPermissions |= 16; // Slam!
220 item.CreationDate = Util.UnixTimeSinceEpoch(); 220 item.CreationDate = Util.UnixTimeSinceEpoch();
221 221
222 if (m_scene.InventoryService.AddItem(item)) 222 if (m_scene.AddInventoryItem(item))
223 { 223 {
224 remoteClient.SendInventoryItemCreateUpdate(item, 0); 224 remoteClient.SendInventoryItemCreateUpdate(item, 0);
225 } 225 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7cedde0..4e871d9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes
70 70
71 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) 71 public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
72 { 72 {
73 IMoneyModule money=RequestModuleInterface<IMoneyModule>(); 73 IMoneyModule money = RequestModuleInterface<IMoneyModule>();
74 if (money != null) 74 if (money != null)
75 { 75 {
76 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); 76 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
77 } 77 }
78 78
79 AddInventoryItem(agentID, item); 79 AddInventoryItem(item);
80 } 80 }
81 81
82 public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) 82 public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
83 { 83 {
84 if (InventoryService.AddItem(item)) 84 if (AddInventoryItem(item))
85 return true; 85 return true;
86 else 86 else
87 { 87 {
@@ -96,8 +96,36 @@ namespace OpenSim.Region.Framework.Scenes
96 /// Add the given inventory item to a user's inventory. 96 /// Add the given inventory item to a user's inventory.
97 /// </summary> 97 /// </summary>
98 /// <param name="item"></param> 98 /// <param name="item"></param>
99 public void AddInventoryItem(InventoryItemBase item) 99 public bool AddInventoryItem(InventoryItemBase item)
100 { 100 {
101 if (UUID.Zero == item.Folder)
102 {
103 InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
104 if (f != null)
105 {
106// m_log.DebugFormat(
107// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
108// f.Name, (AssetType)f.Type, item.Name);
109
110 item.Folder = f.ID;
111 }
112 else
113 {
114 f = InventoryService.GetRootFolder(item.Owner);
115 if (f != null)
116 {
117 item.Folder = f.ID;
118 }
119 else
120 {
121 m_log.WarnFormat(
122 "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
123 item.Owner, item.Name);
124 return false;
125 }
126 }
127 }
128
101 if (InventoryService.AddItem(item)) 129 if (InventoryService.AddItem(item))
102 { 130 {
103 int userlevel = 0; 131 int userlevel = 0;
@@ -106,6 +134,8 @@ namespace OpenSim.Region.Framework.Scenes
106 userlevel = 1; 134 userlevel = 1;
107 } 135 }
108 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); 136 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
137
138 return true;
109 } 139 }
110 else 140 else
111 { 141 {
@@ -113,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes
113 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", 143 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
114 item.Owner, item.Name, item.ID); 144 item.Owner, item.Name, item.ID);
115 145
116 return; 146 return false;
117 } 147 }
118 } 148 }
119 149
@@ -538,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes
538 itemCopy.SalePrice = item.SalePrice; 568 itemCopy.SalePrice = item.SalePrice;
539 itemCopy.SaleType = item.SaleType; 569 itemCopy.SaleType = item.SaleType;
540 570
541 if (InventoryService.AddItem(itemCopy)) 571 if (AddInventoryItem(itemCopy))
542 { 572 {
543 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 573 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
544 if (invAccess != null) 574 if (invAccess != null)
@@ -764,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes
764 item.BasePermissions = baseMask; 794 item.BasePermissions = baseMask;
765 item.CreationDate = creationDate; 795 item.CreationDate = creationDate;
766 796
767 if (InventoryService.AddItem(item)) 797 if (AddInventoryItem(item))
798 {
768 remoteClient.SendInventoryItemCreateUpdate(item, callbackID); 799 remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
800 }
769 else 801 else
770 { 802 {
771 m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); 803 m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
@@ -1886,7 +1918,7 @@ namespace OpenSim.Region.Framework.Scenes
1886 // sets itemID so client can show item as 'attached' in inventory 1918 // sets itemID so client can show item as 'attached' in inventory
1887 grp.SetFromItemID(item.ID); 1919 grp.SetFromItemID(item.ID);
1888 1920
1889 if (InventoryService.AddItem(item)) 1921 if (AddInventoryItem(item))
1890 remoteClient.SendInventoryItemCreateUpdate(item, 0); 1922 remoteClient.SendInventoryItemCreateUpdate(item, 0);
1891 else 1923 else
1892 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); 1924 m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");