From 328ab79b783d4beaa5f954918e3b306950153c1a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 16 Aug 2008 02:00:36 +0000 Subject: Refactor a lot of direct calls to OGS1 to use the cached version instead. Scripts can now no longer DOS the user server and there are a lot fewer gratuitious lookups of user profile data. --- .../Avatar/Currency/SampleMoney/SampleMoneyModule.cs | 7 ++++--- .../Modules/World/Archiver/ArchiveReadRequest.cs | 4 +++- OpenSim/Region/Environment/Scenes/Scene.cs | 17 ----------------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 9 ++++----- 4 files changed, 11 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index 0d22ab9..f038975 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs @@ -39,6 +39,7 @@ using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; +using OpenSim.Framework.Communications.Cache; namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney { @@ -589,10 +590,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney { // try avatar username surname Scene scene = GetRandomScene(); - UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(agentID); - if (profile != null) + CachedUserInfo profile = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); + if (profile != null && profile.UserProfile != null) { - string avatarname = profile.FirstName + " " + profile.SurName; + string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName; return avatarname; } return String.Empty; diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index e6597c3..1340f8b 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -29,6 +29,7 @@ using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Modules.World.Serialiser; using OpenSim.Region.Environment.Modules.World.Terrain; +using OpenSim.Framework.Communications.Cache; using System; using Axiom.Math; using System.Collections.Generic; @@ -187,7 +188,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { if (!m_validUserUuids.ContainsKey(uuid)) { - if (m_scene.CommsManager.UserService.GetUserProfile(uuid) != null) + CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(uuid); + if (profile != null && profile.UserProfile != null) m_validUserUuids.Add(uuid, true); else m_validUserUuids.Add(uuid, false); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 00d8298..22251e9 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -3777,22 +3777,5 @@ namespace OpenSim.Region.Environment.Scenes //Console.WriteLine("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); client.SendLayerData(patchX, patchY, Heightmap.GetFloatsSerialised()); } - -// public bool IsAdministrator(LLUUID user) -// { -// if(RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero) -// { -// if(RegionInfo.MasterAvatarAssignedUUID == user) -// return true; -// } -// -// UserProfileData userProfile = -// CommsManager.UserService.GetUserProfile(user); -// -// if(userProfile.GodLevel >= 200) -// return true; -// -// return false; -// } } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b22643f..8dcfc03 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -2026,13 +2026,12 @@ namespace OpenSim.Region.Environment.Scenes { if (godStatus) { - // TODO: remove this cruft once the master avatar is fully - // deprecated. For now, assign god level 200 to anyone + // For now, assign god level 200 to anyone // who is granted god powers, but has no god level set. // - UserProfileData userProfile = m_scene.CommsManager.UserService.GetUserProfile(agentID); - if(userProfile.GodLevel > 0) - m_godlevel = userProfile.GodLevel; + CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); + if(profile.UserProfile.GodLevel > 0) + m_godlevel = profile.UserProfile.GodLevel; else m_godlevel = 200; } -- cgit v1.1