From 25fdbd6cbcfc857c444042745d7d4fa8e495a982 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 9 Jan 2010 09:09:32 -0800
Subject: Less refs to UserProfileCacheService. Compiles but likely doesn't
run.
---
.../Framework/Scenes/Scene.PacketHandlers.cs | 20 ++++++++++++-
OpenSim/Region/Framework/Scenes/Scene.cs | 34 ++++++++++++++++++++--
2 files changed, 51 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 022d79d..139e0ca 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -33,6 +33,7 @@ using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{
@@ -415,7 +416,24 @@ namespace OpenSim.Region.Framework.Scenes
}
);
}
-
+
+ public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
+ {
+ if (uuid == CommsManager.UserProfileCacheService.LibraryRoot.Owner)
+ {
+ remote_client.SendNameReply(uuid, "Mr", "OpenSim");
+ }
+ else
+ {
+ string[] names = GetUserNames(uuid);
+ if (names.Length == 2)
+ {
+ remote_client.SendNameReply(uuid, names[0], names[1]);
+ }
+
+ }
+ }
+
///
/// Handle a fetch inventory request from the client
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ef62b79..90d476e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -841,6 +841,36 @@ namespace OpenSim.Region.Framework.Scenes
return m_simulatorVersion;
}
+ public string[] GetUserNames(UUID uuid)
+ {
+ string[] returnstring = new string[0];
+
+ UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid);
+
+ if (account != null)
+ {
+ returnstring = new string[2];
+ returnstring[0] = account.FirstName;
+ returnstring[1] = account.LastName;
+ }
+
+ return returnstring;
+ }
+
+ public string GetUserName(UUID uuid)
+ {
+ string[] names = GetUserNames(uuid);
+ if (names.Length == 2)
+ {
+ string firstname = names[0];
+ string lastname = names[1];
+
+ return firstname + " " + lastname;
+
+ }
+ return "(hippos)";
+ }
+
///
/// Another region is up.
///
@@ -2804,7 +2834,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientGridEvents(IClientAPI client)
{
- client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
+ client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
client.OnSetStartLocationRequest += SetHomeRezPoint;
@@ -2959,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
{
- client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest;
+ client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
client.OnSetStartLocationRequest -= SetHomeRezPoint;
--
cgit v1.1