From 124f66bfc25984a01491b8447fa97bea2633281c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 18 Aug 2009 22:17:47 -0700 Subject: jhurliman's patch in http://opensimulator.org/mantis/view.php?id=4024 --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 ++- .../Region/CoreModules/Avatar/Gestures/GesturesModule.cs | 6 ++++-- .../Avatar/Inventory/Transfer/InventoryTransferModule.cs | 13 ++++++------- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 3 +-- .../CoreModules/World/Permissions/PermissionsModule.cs | 9 ++++++--- 5 files changed, 19 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 582beee..35c59aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -130,7 +130,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } else { - InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); + InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); + baseItem = invService.GetItem(baseItem); if (baseItem != null) { diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index a68db1b..ff12361 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); + InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); + item = invService.GetItem(item); if (item != null) { item.Flags = 1; @@ -80,7 +81,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId)); + InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); + item = invService.GetItem(item); if (item != null) { item.Flags = 0; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 5315c11..3a65336 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -257,8 +257,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip - - InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID)); + + InventoryItemBase item = new InventoryItemBase(inventoryEntityID, client.AgentId); + item = invService.GetItem(item); InventoryFolderBase folder = null; if (item != null && trashFolder != null) @@ -271,7 +272,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer } else { - folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID)); + folder = new InventoryFolderBase(inventoryEntityID, client.AgentId); + folder = invService.GetFolder(folder); if (folder != null & trashFolder != null) { @@ -451,10 +453,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer else { UUID itemID = new UUID(msg.binaryBucket, 1); - InventoryItemBase item = new InventoryItemBase(); - - item.ID = itemID; - item.Owner = user.ControllingClient.AgentId; + InventoryItemBase item = new InventoryItemBase(itemID, user.ControllingClient.AgentId); // Fetch from service // diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index dd451ef..492598e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -483,12 +483,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); string uri = m_LocalGridInventoryURI.TrimEnd('/'); - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri); - if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) { return true; } + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user is foreign({0} - {1})", userInventoryServerURI, uri); return false; } diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 9c71b41..f360577 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -966,7 +966,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); + InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); @@ -1385,7 +1386,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script)); + InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); @@ -1479,7 +1481,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (objectID == UUID.Zero) // User inventory { IInventoryService invService = m_scene.InventoryService; - InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); + InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); + assetRequestItem = invService.GetItem(assetRequestItem); if (assetRequestItem == null) // Library item { assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); -- cgit v1.1 From e5f33e75055a8f83cf4e11a6120774cb90dbc3be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 18 Aug 2009 22:36:03 -0700 Subject: GetFolderItems implemented. It's not being called, but it might. --- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 11 +++++++++-- .../Inventory/RemoteInventoryServiceConnector.cs | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 492598e..3649097 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -290,7 +290,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + if (IsLocalGridUser(userID)) + return m_GridService.GetFolderItems(userID, folderID); + else + { + UUID sessionID = GetSessionID(userID); + string uri = GetUserInventoryURI(userID) + "/" + userID; + return m_HGService.GetFolderItems(uri, folderID, sessionID); + } } public override bool AddFolder(InventoryFolderBase folder) @@ -487,7 +494,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { return true; } - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user is foreign({0} - {1})", userInventoryServerURI, uri); + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri); return false; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index bef716b..522f680 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + UUID sessionID = GetSessionID(userID); + return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); } public override bool AddFolder(InventoryFolderBase folder) -- cgit v1.1 From c5af39239f7f2a1725d9c08bea80522de8835e0f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 00:13:51 -0700 Subject: A better purge of trash folder. --- .../Inventory/Transfer/InventoryTransferModule.cs | 4 +++- .../Inventory/BaseInventoryConnector.cs | 2 +- .../Inventory/HGInventoryBroker.cs | 18 +++++++++++------- .../Inventory/LocalInventoryServiceConnector.cs | 4 ++-- .../Inventory/RemoteInventoryServiceConnector.cs | 10 ++++++---- 5 files changed, 23 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 3a65336..5afbf68 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -267,7 +267,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer item.Folder = trashFolder.ID; // Diva comment: can't we just update this item??? - invService.DeleteItem(item); + List uuids = new List(); + uuids.Add(item.ID); + invService.DeleteItems(item.Owner, uuids); scene.AddInventoryItem(client, item); } else diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index ef5ffe1..d1ae3e4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public abstract bool DeleteItem(InventoryItemBase item); + public abstract bool DeleteItems(UUID ownerID, List itemIDs); public abstract InventoryItemBase GetItem(InventoryItemBase item); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 3649097..6a1f2d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -393,18 +393,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - if (item == null) + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); + + if (itemIDs == null) return false; + if (itemIDs.Count == 0) + return true; - if (IsLocalGridUser(item.Owner)) - return m_GridService.DeleteItem(item); + if (IsLocalGridUser(ownerID)) + return m_GridService.DeleteItems(ownerID, itemIDs); else { - UUID sessionID = GetSessionID(item.Owner); - string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); - return m_HGService.DeleteItem(uri, item, sessionID); + UUID sessionID = GetSessionID(ownerID); + string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); + return m_HGService.DeleteItems(uri, itemIDs, sessionID); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 2fbc5fe..b2640af 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -294,9 +294,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - return m_InventoryService.DeleteItem(item); + return m_InventoryService.DeleteItems(ownerID, itemIDs); } public override InventoryItemBase GetItem(InventoryItemBase item) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 522f680..012f0e3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -273,13 +273,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } - public override bool DeleteItem(InventoryItemBase item) + public override bool DeleteItems(UUID ownerID, List itemIDs) { - if (item == null) + if (itemIDs == null) return false; + if (itemIDs.Count == 0) + return true; - UUID sessionID = GetSessionID(item.Owner); - return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); + UUID sessionID = GetSessionID(ownerID); + return m_RemoteConnector.DeleteItems(ownerID.ToString(), itemIDs, sessionID); } public override InventoryItemBase GetItem(InventoryItemBase item) -- cgit v1.1 From 4382f28efc6ffe70e3c6f6e8cd7e7c729d1f12af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 00:33:02 -0700 Subject: Async purge so that the client thread doesn't wait. --- .../Inventory/RemoteInventoryServiceConnector.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 012f0e3..081d0f7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -323,14 +323,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private UUID GetSessionID(UUID userID) { - if (m_Scene == null) - { - m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); - } + //if (m_Scene == null) + //{ + // m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); + //} if (m_UserProfileService == null) { - m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); + //m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); return UUID.Zero; } -- cgit v1.1 From d519f1885f587409592cf92bc0f4ba8533a1866f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 10:56:08 -0700 Subject: Added MoveItems, which is most useful upon viewer-delete inventory operation. Moving a batch of items is a 1-time operation. Made it async anyway, so that the viewer doesn't wait in case the DB layer is dumb (which is the case currently). --- .../Inventory/BaseInventoryConnector.cs | 2 ++ .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 17 +++++++++++++++++ .../Inventory/LocalInventoryServiceConnector.cs | 6 ++++++ .../Inventory/RemoteInventoryServiceConnector.cs | 10 ++++++++++ 4 files changed, 35 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index d1ae3e4..d4cb616 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -181,6 +181,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// true if the item was successfully updated public abstract bool UpdateItem(InventoryItemBase item); + public abstract bool MoveItems(UUID ownerID, List items); + /// /// Delete an item from the user's inventory /// diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 6a1f2d5..787c6c8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -393,6 +393,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } + public override bool MoveItems(UUID ownerID, List items) + { + if (items == null) + return false; + if (items.Count == 0) + return true; + + if (IsLocalGridUser(ownerID)) + return m_GridService.MoveItems(ownerID, items); + else + { + UUID sessionID = GetSessionID(ownerID); + string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); + return m_HGService.MoveItems(uri, items, sessionID); + } + } + public override bool DeleteItems(UUID ownerID, List itemIDs) { m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index b2640af..562c5dd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -289,6 +289,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.UpdateItem(item); } + + public override bool MoveItems(UUID ownerID, List items) + { + return m_InventoryService.MoveItems(ownerID, items); + } + /// /// Delete an item from the user's inventory /// diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 081d0f7..201442c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -273,6 +273,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } + public override bool MoveItems(UUID ownerID, List items) + { + if (items == null) + return false; + + UUID sessionID = GetSessionID(ownerID); + return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID); + } + + public override bool DeleteItems(UUID ownerID, List itemIDs) { if (itemIDs == null) -- cgit v1.1