From 7aa54593e0b6672979feec97b8151ed134388723 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Aug 2009 20:39:48 -0700 Subject: Redirected all calls to CachedUserProfile methods to the inventory service. Redirection of the RootFolder property is still todo. This compiles but probably inventory will be inconsistent. --- .../AssetTransaction/AgentAssetsTransactions.cs | 47 ++++++++------------ .../Agent/AssetTransaction/AssetXferUploader.cs | 51 ++++++++++------------ 2 files changed, 40 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/CoreModules/Agent/AssetTransaction') diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 8d586c4..c9ee54f 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -192,40 +192,29 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { if (XferUploaders.ContainsKey(transactionID)) { - CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); - if (userInfo != null) - { - UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); - - AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString()); - - if (asset == null) - { - asset = GetTransactionAsset(transactionID); - } - - if (asset != null && asset.FullID == assetID) - { - // Assets never get updated, new ones get created - asset.FullID = UUID.Random(); - asset.Name = item.Name; - asset.Description = item.Description; - asset.Type = (sbyte)item.AssetType; - item.AssetID = asset.FullID; - - Manager.MyScene.AssetService.Store(asset); - } + AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString()); - userInfo.UpdateItem(item); + if (asset == null) + { + asset = GetTransactionAsset(transactionID); } - else + + if (asset != null && asset.FullID == assetID) { - m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update", - remoteClient.AgentId); + // Assets never get updated, new ones get created + asset.FullID = UUID.Random(); + asset.Name = item.Name; + asset.Description = item.Description; + asset.Type = (sbyte)item.AssetType; + item.AssetID = asset.FullID; + + Manager.MyScene.AssetService.Store(asset); } + + IInventoryService invService = Manager.MyScene.InventoryService; + invService.UpdateItem(item); } } } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index afd9f5a..e192b81 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -32,6 +32,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { @@ -214,39 +215,31 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction private void DoCreateItem(uint callbackID) { m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); - CachedUserInfo userInfo = - m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( - ourClient.AgentId); - if (userInfo != null) - { - InventoryItemBase item = new InventoryItemBase(); - item.Owner = ourClient.AgentId; - item.CreatorId = ourClient.AgentId.ToString(); - item.ID = UUID.Random(); - item.AssetID = m_asset.FullID; - item.Description = m_description; - item.Name = m_name; - item.AssetType = type; - item.InvType = invType; - item.Folder = InventFolder; - item.BasePermissions = 0x7fffffff; - item.CurrentPermissions = 0x7fffffff; - item.GroupPermissions=0; - item.EveryOnePermissions=0; - item.NextPermissions = nextPerm; - item.Flags = (uint) wearableType; - item.CreationDate = Util.UnixTimeSinceEpoch(); + IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService; + + InventoryItemBase item = new InventoryItemBase(); + item.Owner = ourClient.AgentId; + item.CreatorId = ourClient.AgentId.ToString(); + item.ID = UUID.Random(); + item.AssetID = m_asset.FullID; + item.Description = m_description; + item.Name = m_name; + item.AssetType = type; + item.InvType = invType; + item.Folder = InventFolder; + item.BasePermissions = 0x7fffffff; + item.CurrentPermissions = 0x7fffffff; + item.GroupPermissions=0; + item.EveryOnePermissions=0; + item.NextPermissions = nextPerm; + item.Flags = (uint) wearableType; + item.CreationDate = Util.UnixTimeSinceEpoch(); - userInfo.AddItem(item); + if (invService.AddItem(item)) ourClient.SendInventoryItemCreateUpdate(item, callbackID); - } else - { - m_log.ErrorFormat( - "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", - ourClient.AgentId); - } + ourClient.SendAlertMessage("Unable to create inventory item"); } /// -- cgit v1.1