From dbbf43663e688b136d806965edfb82b4cd9e3e91 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 24 Jan 2011 02:16:28 +0100 Subject: Add a careminster API to scripting again --- .../UserAccounts/RemoteUserAccountServiceConnector.cs | 11 +++++++++++ .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 13 +++++++++++++ 2 files changed, 24 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 3321b38..348ad42 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs @@ -33,6 +33,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors; +using OpenSim.Framework; using OpenMetaverse; @@ -101,6 +102,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts return; scene.RegisterModuleInterface(this); + + scene.EventManager.OnNewClient += OnNewClient; } public void RemoveRegion(Scene scene) @@ -115,6 +118,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts return; } + // When a user actually enters the sim, clear them from + // cache so the sim will have the current values for + // flags, title, etc. And country, don't forget country! + private void OnNewClient(IClientAPI client) + { + m_Cache.Remove(client.Name); + } + #region Overwritten methods from IUserAccountService public override UserAccount GetUserAccount(UUID scopeID, UUID userID) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index 155335b..07c127e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -91,5 +91,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts return null; } + + public void Remove(string name) + { + if (!m_NameCache.Contains(name)) + return; + + UUID uuid = UUID.Zero; + if (m_NameCache.TryGetValue(name, out uuid)) + { + m_NameCache.Remove(name); + m_UUIDCache.Remove(uuid); + } + } } } -- cgit v1.1