diff options
author | Justin Clark-Casey (justincc) | 2011-08-19 00:45:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-19 00:45:22 +0100 |
commit | c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a (patch) | |
tree | ca0e224639979b65c36c0d169d900ed707a6f991 /OpenSim/Region/Framework | |
parent | Don't need to try both AssetService.Get and GetCached in GetMesh since Get al... (diff) | |
download | opensim-SC_OLD-c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a.zip opensim-SC_OLD-c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a.tar.gz opensim-SC_OLD-c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a.tar.bz2 opensim-SC_OLD-c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IUserManagement.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 42 |
2 files changed, 64 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 5d30aa8..c66e053 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs | |||
@@ -5,13 +5,48 @@ using OpenMetaverse; | |||
5 | 5 | ||
6 | namespace OpenSim.Region.Framework.Interfaces | 6 | namespace OpenSim.Region.Framework.Interfaces |
7 | { | 7 | { |
8 | /// <summary> | ||
9 | /// This maintains the relationship between a UUID and a user name. | ||
10 | /// </summary> | ||
8 | public interface IUserManagement | 11 | public interface IUserManagement |
9 | { | 12 | { |
10 | string GetUserName(UUID uuid); | 13 | string GetUserName(UUID uuid); |
11 | string GetUserHomeURL(UUID uuid); | 14 | string GetUserHomeURL(UUID uuid); |
12 | string GetUserUUI(UUID uuid); | 15 | string GetUserUUI(UUID uuid); |
13 | string GetUserServerURL(UUID uuid, string serverType); | 16 | string GetUserServerURL(UUID uuid, string serverType); |
14 | void AddUser(UUID uuid, string userData); | 17 | |
18 | /// <summary> | ||
19 | /// Add a user. | ||
20 | /// </summary> | ||
21 | /// <remarks> | ||
22 | /// If an account is found for the UUID, then the names in this will be used rather than any information | ||
23 | /// extracted from creatorData. | ||
24 | /// </remarks> | ||
25 | /// <param name="uuid"></param> | ||
26 | /// <param name="creatorData">The creator data for this user.</param> | ||
27 | void AddUser(UUID uuid, string creatorData); | ||
28 | |||
29 | /// <summary> | ||
30 | /// Add a user. | ||
31 | /// </summary> | ||
32 | /// <remarks> | ||
33 | /// The UUID is related to the name without any other checks being performed, such as user account presence. | ||
34 | /// </remarks> | ||
35 | /// <param name="uuid"></param> | ||
36 | /// <param name="firstName"></param> | ||
37 | /// <param name="lastName"></param> | ||
38 | void AddUser(UUID uuid, string firstName, string lastName); | ||
39 | |||
40 | /// <summary> | ||
41 | /// Add a user. | ||
42 | /// </summary> | ||
43 | /// <remarks> | ||
44 | /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the | ||
45 | /// AddUser(UUID uuid, string creatorData) method. | ||
46 | /// </remarks> | ||
47 | /// <param name="uuid"></param> | ||
48 | /// <param name="firstName"></param> | ||
49 | /// <param name="profileURL"></param> | ||
15 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); | 50 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); |
16 | } | 51 | } |
17 | } | 52 | } |
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 | |||
2582 | } | 2582 | } |
2583 | } | 2583 | } |
2584 | 2584 | ||
2585 | if (GetScenePresence(client.AgentId) != null) | 2585 | ScenePresence createdSp = GetScenePresence(client.AgentId); |
2586 | if (createdSp != null) | ||
2586 | { | 2587 | { |
2587 | m_LastLogin = Util.EnvironmentTickCount(); | 2588 | m_LastLogin = Util.EnvironmentTickCount(); |
2588 | 2589 | ||
2589 | // Cache the user's name | 2590 | // Cache the user's name |
2590 | CacheUserName(aCircuit); | 2591 | CacheUserName(createdSp, aCircuit); |
2591 | 2592 | ||
2592 | EventManager.TriggerOnNewClient(client); | 2593 | EventManager.TriggerOnNewClient(client); |
2593 | if (vialogin) | 2594 | if (vialogin) |
@@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | } | 2596 | } |
2596 | } | 2597 | } |
2597 | 2598 | ||
2598 | private void CacheUserName(AgentCircuitData aCircuit) | 2599 | /// <summary> |
2600 | /// Cache the user name for later use. | ||
2601 | /// </summary> | ||
2602 | /// <param name="sp"></param> | ||
2603 | /// <param name="aCircuit"></param> | ||
2604 | private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) | ||
2599 | { | 2605 | { |
2600 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | 2606 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); |
2601 | if (uMan != null) | 2607 | if (uMan != null) |
2602 | { | 2608 | { |
2603 | string homeURL = string.Empty; | ||
2604 | string first = aCircuit.firstname, last = aCircuit.lastname; | 2609 | string first = aCircuit.firstname, last = aCircuit.lastname; |
2605 | 2610 | ||
2606 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2611 | if (sp.PresenceType == PresenceType.Npc) |
2607 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2612 | { |
2608 | 2613 | uMan.AddUser(aCircuit.AgentID, first, last); | |
2609 | if (aCircuit.lastname.StartsWith("@")) | 2614 | } |
2615 | else | ||
2610 | { | 2616 | { |
2611 | string[] parts = aCircuit.firstname.Split('.'); | 2617 | string homeURL = string.Empty; |
2612 | if (parts.Length >= 2) | 2618 | |
2619 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
2620 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
2621 | |||
2622 | if (aCircuit.lastname.StartsWith("@")) | ||
2613 | { | 2623 | { |
2614 | first = parts[0]; | 2624 | string[] parts = aCircuit.firstname.Split('.'); |
2615 | last = parts[1]; | 2625 | if (parts.Length >= 2) |
2626 | { | ||
2627 | first = parts[0]; | ||
2628 | last = parts[1]; | ||
2629 | } | ||
2616 | } | 2630 | } |
2617 | } | ||
2618 | 2631 | ||
2619 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); | 2632 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); |
2633 | } | ||
2620 | } | 2634 | } |
2621 | } | 2635 | } |
2622 | 2636 | ||