From 1e1b2ab221851efc414678b7ea52ef2ca788ce9f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 10 Jan 2010 10:40:07 -0800 Subject: * OMG! All but one references to UserProfileCacheService have been rerouted! * HG is seriously broken here * Compiles. Untested. --- .../Interfaces/IInventoryArchiverModule.cs | 3 +- .../Scenes/Hypergrid/HGScene.Inventory.cs | 3 +- .../Region/Framework/Scenes/Hypergrid/HGScene.cs | 77 ---------------------- .../Hypergrid/HGSceneCommunicationService.cs | 13 ++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 +-- OpenSim/Region/Framework/Scenes/Scene.cs | 19 +----- .../Framework/Scenes/SceneCommunicationService.cs | 7 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 ++-- 8 files changed, 28 insertions(+), 118 deletions(-) delete mode 100644 OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 2d038ce..57efe16 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs @@ -28,6 +28,7 @@ using System; using System.IO; using OpenSim.Framework.Communications.Cache; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Interfaces { @@ -41,7 +42,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream to which the archive was saved /// Contains the exception generated if the save did not succeed public delegate void InventoryArchiveSaved( - Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException); + Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); public interface IInventoryArchiverModule { diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index 6f7f34f..76d7a09 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs @@ -33,6 +33,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes.Hypergrid { @@ -82,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) { - CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(avatarID); + UserAccount userInfo = UserAccountService.GetUserAccount(RegionInfo.ScopeID, avatarID); if (userInfo != null) { m_assMapper.Post(assetID, avatarID); diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs deleted file mode 100644 index b1981b6..0000000 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications.Cache; -using TPFlags = OpenSim.Framework.Constants.TeleportFlags; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; - -namespace OpenSim.Region.Framework.Scenes.Hypergrid -{ - public partial class HGScene : Scene - { - /// - /// Teleport an avatar to their home region - /// - /// - /// - public override void TeleportClientHome(UUID agentId, IClientAPI client) - { - m_log.Debug("[HGScene]: TeleportClientHome " + client.FirstName + " " + client.LastName); - - CachedUserInfo uinfo = CommsManager.UserProfileCacheService.GetUserDetails(agentId); - if (uinfo != null) - { - UserProfileData UserProfile = uinfo.UserProfile; - - if (UserProfile != null) - { - GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID); - //if (regionInfo != null) - //{ - // UserProfile.HomeRegionID = regionInfo.RegionID; - // //CommsManager.UserService.UpdateUserProfile(UserProfile); - //} - if (regionInfo == null) - { - // can't find the Home region: Tell viewer and abort - client.SendTeleportFailed("Your home-region could not be found."); - return; - } - RequestTeleportLocation( - client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, - (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); - } - } - else - client.SendTeleportFailed("Sorry! I lost your home-region information."); - - } - - } -} diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs index f64a7a0..61419e6 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -141,13 +141,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null); bool isHomeUser = true; ulong realHandle = regionHandle; - CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); - if (uinfo != null) - { - isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID); - realHandle = m_hg.FindRegionHandle(regionHandle); - m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); - } + isHomeUser = HyperlinkService.IsLocalUser(avatar.UUID); + realHandle = m_hg.FindRegionHandle(regionHandle); + m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); /// /// Hypergrid mod stop /// @@ -352,7 +348,8 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid // so the userinfo in UserProfileCache is not reliable any more, delete it if (avatar.Scene.NeedSceneCacheClear(avatar.UUID) || isHyperLink) { - m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); + // REFACTORING PROBLEM!!!! + //m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); m_log.DebugFormat( "[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1c5c247..476873a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -744,13 +744,9 @@ namespace OpenSim.Region.Framework.Scenes if (transactionID == UUID.Zero) { - CachedUserInfo userInfo - = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); - - if (userInfo != null) + ScenePresence presence; + if (TryGetAvatar(remoteClient.AgentId, out presence)) { - ScenePresence presence; - TryGetAvatar(remoteClient.AgentId, out presence); byte[] data = null; if (invType == (sbyte)InventoryType.Landmark && presence != null) @@ -772,7 +768,7 @@ namespace OpenSim.Region.Framework.Scenes else { m_log.ErrorFormat( - "userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem", + "ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", remoteClient.AgentId); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 90d476e..53c51e6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3207,10 +3207,9 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGraph.removeUserCount(!childagentYN); CapsModule.RemoveCapsHandler(agentID); - if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) - { - CommsManager.UserProfileCacheService.RemoveUser(agentID); - } + // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever + // this method is doing is HORRIBLE!!! + avatar.Scene.NeedSceneCacheClear(avatar.UUID); if (!avatar.IsChildAgent) { @@ -3512,18 +3511,6 @@ namespace OpenSim.Region.Framework.Scenes m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - // rewrite session_id - CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); - if (userinfo != null) - { - userinfo.SessionID = agent.SessionID; - } - else - { - m_log.WarnFormat( - "[CONNECTION BEGIN]: We couldn't find a User Info record for {0}. This is usually an indication that the UUID we're looking up is invalid", agent.AgentID); - } - return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 8b14f61..ce3c16c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -967,9 +967,10 @@ namespace OpenSim.Region.Framework.Scenes // if (teleport success) // seems to be always success here // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it + + // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) { - m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); m_log.DebugFormat( "[SCENE COMMUNICATION SERVICE]: User {0} is going to another region, profile cache removed", avatar.UUID); @@ -1404,11 +1405,11 @@ namespace OpenSim.Region.Framework.Scenes agent.Scene.NotifyMyCoarseLocationChange(); // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it + // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! if (agent.Scene.NeedSceneCacheClear(agent.UUID)) { - agent.Scene.CommsManager.UserProfileCacheService.RemoveUser(agent.UUID); m_log.DebugFormat( - "[SCENE COMM]: User {0} is going to another region, profile cache removed", agent.UUID); + "[SCENE COMM]: User {0} is going to another region", agent.UUID); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 385a9cd..97415f4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -39,6 +39,7 @@ using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Types; using OpenSim.Region.Physics.Manager; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes { @@ -2870,11 +2871,14 @@ namespace OpenSim.Region.Framework.Scenes // For now, assign god level 200 to anyone // who is granted god powers, but has no god level set. // - CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); - if (profile.UserProfile.GodLevel > 0) - m_godlevel = profile.UserProfile.GodLevel; - else - m_godlevel = 200; + UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID); + if (account != null) + { + if (account.UserLevel > 0) + m_godlevel = account.UserLevel; + else + m_godlevel = 200; + } } else { -- cgit v1.1