diff options
author | Justin Clark-Casey (justincc) | 2010-09-04 01:36:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-04 01:36:26 +0100 |
commit | 1e8e98a07fdad6cff4be780083b3d9ad2360b8e7 (patch) | |
tree | 525953a28c694123fc1450e882dca65aa620e124 /OpenSim/Region | |
parent | Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) (diff) | |
download | opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.zip opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.gz opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.bz2 opensim-SC_OLD-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 '')
7 files changed, 45 insertions, 68 deletions
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"); |