From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 19 Aug 2011 00:45:22 +0100
Subject: Stop NPC's getting hypergrid like names in some circumstances.
This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts).
May address http://opensimulator.org/mantis/view.php?id=5645
---
OpenSim/Region/Framework/Scenes/Scene.cs | 42 +++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ae88a87..513c0ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2582,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- if (GetScenePresence(client.AgentId) != null)
+ ScenePresence createdSp = GetScenePresence(client.AgentId);
+ if (createdSp != null)
{
m_LastLogin = Util.EnvironmentTickCount();
// Cache the user's name
- CacheUserName(aCircuit);
+ CacheUserName(createdSp, aCircuit);
EventManager.TriggerOnNewClient(client);
if (vialogin)
@@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- private void CacheUserName(AgentCircuitData aCircuit)
+ ///
+ /// Cache the user name for later use.
+ ///
+ ///
+ ///
+ private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
{
IUserManagement uMan = RequestModuleInterface();
if (uMan != null)
{
- string homeURL = string.Empty;
string first = aCircuit.firstname, last = aCircuit.lastname;
- if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
- homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
-
- if (aCircuit.lastname.StartsWith("@"))
+ if (sp.PresenceType == PresenceType.Npc)
+ {
+ uMan.AddUser(aCircuit.AgentID, first, last);
+ }
+ else
{
- string[] parts = aCircuit.firstname.Split('.');
- if (parts.Length >= 2)
+ string homeURL = string.Empty;
+
+ if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
+ homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
+
+ if (aCircuit.lastname.StartsWith("@"))
{
- first = parts[0];
- last = parts[1];
+ string[] parts = aCircuit.firstname.Split('.');
+ if (parts.Length >= 2)
+ {
+ first = parts[0];
+ last = parts[1];
+ }
}
- }
- uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ }
}
}
--
cgit v1.1