From 13c1c33ed410566fa341c5affcb93f540f1df95f Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 24 Sep 2007 04:49:05 +0000 Subject: * Added TryGetAvatarByName --- OpenSim/Region/Environment/Scenes/Scene.cs | 20 ++++++++++++++++++++ OpenSim/Region/Environment/Scenes/SceneManager.cs | 14 ++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 97a4ae1..cff832e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1363,5 +1363,25 @@ namespace OpenSim.Region.Environment.Scenes base.Close(); } + + internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) + { + foreach( ScenePresence presence in m_scenePresences.Values ) + { + if( !presence.IsChildAgent ) + { + string name = presence.ControllingClient.FirstName + " " + presence.ControllingClient.LastName; + + if( String.Compare( avatarName, name, true ) == 0 ) + { + avatar = presence; + return true; + } + } + } + + avatar = null; + return false; + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 79fdff7..196976c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -233,5 +233,19 @@ namespace OpenSim.Region.Environment.Scenes m_localScenes.Remove(scene); scene.Close(); } + + public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) + { + foreach (Scene scene in m_localScenes) + { + if (scene.TryGetAvatarByName(avatarName, out avatar)) + { + return true; + } + } + + avatar = null; + return false; + } } } \ No newline at end of file -- cgit v1.1