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.
---
.../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 +++--
.../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 6 ++--
.../AsyncCommandPlugins/SensorRepeat.cs | 7 ++--
.../Shared/Api/Implementation/LSL_Api.cs | 6 ++--
.../Api/Implementation/Plugins/SensorRepeat.cs | 7 ++--
prebuild.xml | 38 ++++++++++++++++++++++
9 files changed, 63 insertions(+), 38 deletions(-)
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;
}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 32e9085..d7cd027 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -645,10 +645,10 @@ namespace OpenSim.Region.ScriptEngine.Common
public string resolveName(LLUUID objecUUID)
{
// try avatar username surname
- UserProfileData profile = World.CommsManager.UserService.GetUserProfile(objecUUID);
- if (profile != null)
+ CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID);
+ if (profile != null && profile.UserProfile != null)
{
- string avatarname = profile.FirstName + " " + profile.SurName;
+ string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
return avatarname;
}
// try an scene object
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
index aaea2ee..9b636fd 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
+using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins
{
@@ -272,10 +273,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
string entname =ent.Name;
// try avatar username surname
- UserProfileData profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserService.GetUserProfile(ent.UUID);
- if (profile != null)
+ CachedUserInfo profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserProfileCacheService.GetUserDetails(ent.UUID);
+ if (profile != null && profile.UserProfile != null)
{
- avatarname = profile.FirstName + " " + profile.SurName;
+ avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
}
// try an scene object
SceneObjectPart SOP = m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(ent.UUID);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 15793e4..5ab6c4d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -633,10 +633,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string resolveName(LLUUID objecUUID)
{
// try avatar username surname
- UserProfileData profile = World.CommsManager.UserService.GetUserProfile(objecUUID);
- if (profile != null)
+ CachedUserInfo profile = World.CommsManager.UserProfileCacheService.GetUserDetails(objecUUID);
+ if (profile != null && profile.UserProfile != null)
{
- string avatarname = profile.FirstName + " " + profile.SurName;
+ string avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
return avatarname;
}
// try an scene object
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5833512..eaf4bd0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
+using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
@@ -263,10 +264,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
string entname =ent.Name;
// try avatar username surname
- UserProfileData profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserService.GetUserProfile(ent.UUID);
- if (profile != null)
+ CachedUserInfo profile = m_CmdManager.m_ScriptEngine.World.CommsManager.UserProfileCacheService.GetUserDetails(ent.UUID);
+ if (profile != null && profile.UserProfile != null)
{
- avatarname = profile.FirstName + " " + profile.SurName;
+ avatarname = profile.UserProfile.FirstName + " " + profile.UserProfile.SurName;
}
// try an scene object
SceneObjectPart SOP = m_CmdManager.m_ScriptEngine.World.GetSceneObjectPart(ent.UUID);
diff --git a/prebuild.xml b/prebuild.xml
index 495cdba..48ef580 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -816,6 +816,44 @@
+
+
+
+ ../../bin/
+
+
+
+
+ ../../bin/
+
+
+
+ ../../bin/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1