aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2014-05-22 10:16:01 -0700
committerDiva Canto2014-05-22 10:16:01 -0700
commitf7b2aa0f49f5eca0a58c20b903103d19742220e9 (patch)
treebbb85d7ec857b4f98ea66ca2ba33e4076f7f51c3 /OpenSim
parentDon't trigger ItemUploaded when no item has been uploaded. (diff)
downloadopensim-SC_OLD-f7b2aa0f49f5eca0a58c20b903103d19742220e9.zip
opensim-SC_OLD-f7b2aa0f49f5eca0a58c20b903103d19742220e9.tar.gz
opensim-SC_OLD-f7b2aa0f49f5eca0a58c20b903103d19742220e9.tar.bz2
opensim-SC_OLD-f7b2aa0f49f5eca0a58c20b903103d19742220e9.tar.xz
Fixed a problem with detaching attachments in situations where the user's asset server is not the same as the simulator's asset server. Unfortunately this still continues to be wasteful -- new assets are created every time an attachment is detached, but the process of storing the new asset goes through the InventoryAccess module, which does all sorts of checks regarding the users' inventory.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs26
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs4
4 files changed, 44 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index e9b2f4f..7333769 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -774,15 +774,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
774 (sbyte)AssetType.Object, 774 (sbyte)AssetType.Object,
775 Utils.StringToBytes(sceneObjectXml), 775 Utils.StringToBytes(sceneObjectXml),
776 sp.UUID); 776 sp.UUID);
777 m_scene.AssetService.Store(asset);
778 777
779 item.AssetID = asset.FullID; 778 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
780 item.Description = asset.Description;
781 item.Name = asset.Name;
782 item.AssetType = asset.Type;
783 item.InvType = (int)InventoryType.Object;
784 779
785 m_scene.InventoryService.UpdateItem(item); 780 invAccess.UpdateInventoryItemAsset(sp.UUID, item, asset);
786 781
787 // If the name of the object has been changed whilst attached then we want to update the inventory 782 // If the name of the object has been changed whilst attached then we want to update the inventory
788 // item in the viewer. 783 // item in the viewer.
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 283a0cf..71570da 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -253,6 +253,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
253 return newAssetID; 253 return newAssetID;
254 } 254 }
255 255
256 ///
257 /// UpdateInventoryItemAsset
258 ///
259 public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
260 {
261 if (base.UpdateInventoryItemAsset(ownerID, item, asset))
262 {
263 UploadInventoryItem(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
264 return true;
265 }
266
267 return false;
268 }
269
256 /// 270 ///
257 /// Used in DeleteToInventory 271 /// Used in DeleteToInventory
258 /// 272 ///
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a116f0f..6e48fcc 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -292,7 +292,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
292 292
293 return UUID.Zero; 293 return UUID.Zero;
294 } 294 }
295 295
296 public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
297 {
298 if (item != null && item.Owner == ownerID && asset != null)
299 {
300 item.AssetID = asset.FullID;
301 item.Description = asset.Description;
302 item.Name = asset.Name;
303 item.AssetType = asset.Type;
304 item.InvType = (int)InventoryType.Object;
305
306 m_Scene.AssetService.Store(asset);
307 m_Scene.InventoryService.UpdateItem(item);
308
309 return true;
310 }
311 else
312 {
313 m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}",
314 (item == null || asset == null? "null item or asset" : "wrong owner"));
315 return false;
316 }
317
318 }
319
296 public virtual List<InventoryItemBase> CopyToInventory( 320 public virtual List<InventoryItemBase> CopyToInventory(
297 DeRezAction action, UUID folderID, 321 DeRezAction action, UUID folderID,
298 List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) 322 List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment)
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 3576e35..6bad018 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -38,7 +38,9 @@ namespace OpenSim.Region.Framework.Interfaces
38 public interface IInventoryAccessModule 38 public interface IInventoryAccessModule
39 { 39 {
40 UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); 40 UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
41 41
42 bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset);
43
42 /// <summary> 44 /// <summary>
43 /// Copy objects to a user's inventory. 45 /// Copy objects to a user's inventory.
44 /// </summary> 46 /// </summary>