From 264eeffd0294d27fd1329a27c84c8b61e5fb0993 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 18 Oct 2008 07:27:39 +0000 Subject: Fix thingd so that autoreturn also works when the user is not in the sim. Also add experimental distance ordering for prims --- .../Region/Environment/Scenes/Scene.Inventory.cs | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b91eb83..733392f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1618,19 +1618,17 @@ namespace OpenSim.Region.Environment.Scenes { string sceneObjectXml = objectGroup.ToXmlString(); - CachedUserInfo userInfo = - CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + CachedUserInfo userInfo; if (remoteClient == null) { userInfo = CommsManager.UserProfileCacheService.GetUserDetails( - objectGroup.RootPart.OwnerID); + objectGroup.RootPart.OwnerID); } else { userInfo = CommsManager.UserProfileCacheService.GetUserDetails( - remoteClient.AgentId); + remoteClient.AgentId); } if (userInfo != null) @@ -1648,9 +1646,22 @@ namespace OpenSim.Region.Environment.Scenes (int)AssetType.LostAndFoundFolder); if (folder != null) + { folderID = folder.ID; + } else - folderID = userInfo.RootFolder.ID; + { + if (userInfo.RootFolder != null) + { + folderID = userInfo.RootFolder.ID; + } + else + { + CommsManager.UserProfileCacheService.RequestInventoryForUser(objectGroup.RootPart.OwnerID); + m_log.WarnFormat("[SCENE] Can't find root folder for user, requesting inventory"); + return; + } + } } AssetBase asset = CreateAsset( @@ -1677,7 +1688,7 @@ namespace OpenSim.Region.Environment.Scenes item.InvType = (int)InventoryType.Object; item.Folder = folderID; - if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) + if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) { uint perms=objectGroup.GetEffectivePermissions(); uint nextPerms=(perms & 7) << 13; @@ -1706,7 +1717,7 @@ namespace OpenSim.Region.Environment.Scenes item.CreationDate = Util.UnixTimeSinceEpoch(); userInfo.AddItem(item); - if (item.Owner == remoteClient.AgentId) + if (remoteClient != null && item.Owner == remoteClient.AgentId) { remoteClient.SendInventoryItemCreateUpdate(item); } -- cgit v1.1